From owner-freebsd-current@freebsd.org Tue Jan 17 21:29:22 2017 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2CD0CB5517 for ; Tue, 17 Jan 2017 21:29:22 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9DF571DAE; Tue, 17 Jan 2017 21:29:22 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 9ADA41FE025; Tue, 17 Jan 2017 22:29:04 +0100 (CET) From: Hans Petter Selasky Subject: Re: Strange issue after early AP startup To: Ian Lepore , John Baldwin References: <2215603.KuBd8pM5Pm@ralph.baldwin.cx> <3cbe6454-82cc-0592-4ee6-3c1552b19f9a@selasky.org> <4212167.Wq8tLU1ohU@ralph.baldwin.cx> <1484682389.86335.166.camel@freebsd.org> Cc: FreeBSD Current , Konstantin Belousov Message-ID: <11f27a15-f9bc-8988-a17e-78aeff1745fb@selasky.org> Date: Tue, 17 Jan 2017 22:28:47 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1484682389.86335.166.camel@freebsd.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jan 2017 21:29:22 -0000 On 01/17/17 20:46, Ian Lepore wrote: >>> Does this matter for the first tick? How often is configtimer() called? >> > >> > As I said, it is called at runtime when profclock is started / stopped, not >> > just at boot. Those changes at runtime probably have existing callouts >> > active and your change will not process any callouts until the next hardclock >> > tick fires (but only because you are setting nextcallopt to the bogus >> > 'next' value). > On some platforms, configtimer() can be called quite often. Power > saving modes can change the frequency of the timer, and systems that > suppport such dynamic frequency scaling call configtimer() > (via cpu_et_frequency()) to handle the changes. Hi, I propose the following patch then: diff --git a/sys/kern/kern_clocksource.c b/sys/kern/kern_clocksource.c index 7f7769d..5ae925b 100644 --- a/sys/kern/kern_clocksource.c +++ b/sys/kern/kern_clocksource.c @@ -511,8 +511,13 @@ configtimer(int start) state->nexthard = next; state->nextstat = next; state->nextprof = next; - state->nextcall = next; - state->nextcallopt = next; + /* + * Force callout_process() to be called + * instantly, so that the correct value of + * "nextcall" can be computed: + */ + state->nextcall = SBT_MAX; + state->nextcallopt = now + 1; hardclock_sync(cpu); } busy = 0; Then there is no problem having to wait for the next tick or anything, like John Baldwin pointed out. --HPS