From owner-freebsd-current@freebsd.org Thu Jan 19 08:24: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 E08F3CB47E8 for ; Thu, 19 Jan 2017 08:24:22 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (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 A737F13C7; Thu, 19 Jan 2017 08:24: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 610E81FE025; Thu, 19 Jan 2017 09:23:54 +0100 (CET) Subject: Re: Strange issue after early AP startup To: John Baldwin References: <1484682389.86335.166.camel@freebsd.org> <11f27a15-f9bc-8988-a17e-78aeff1745fb@selasky.org> <3558195.Ack1AKBXSB@ralph.baldwin.cx> <24593c49-b0d5-8aaf-e11b-bfef4704267e@selasky.org> Cc: Ian Lepore , FreeBSD Current , Konstantin Belousov , Bruce Evans , Jia-Shiun Li From: Hans Petter Selasky Message-ID: Date: Thu, 19 Jan 2017 09:23:39 +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: <24593c49-b0d5-8aaf-e11b-bfef4704267e@selasky.org> Content-Type: multipart/mixed; boundary="------------A39E9900D0A639AF85AD82CA" 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: Thu, 19 Jan 2017 08:24:23 -0000 This is a multi-part message in MIME format. --------------A39E9900D0A639AF85AD82CA Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit On 01/18/17 09:00, Hans Petter Selasky wrote: > On 01/18/17 02:18, John Baldwin wrote: >> You might still want to adjust 'nextevent' to schedule the next interrupt >> to be sooner than 'timerperiod' though. You could just set >> 'nextevent' to >> 'now' in that case instead of 'next'. > > Right, I'll give that a spin. Would have to be "now + 1" instead of > "now", due to check before et_start() ? > Hi John, Here is another variant of my patch which solves the EARLY AP startup problem with timers. What do you think? > diff --git a/sys/kern/kern_clocksource.c b/sys/kern/kern_clocksource.c > index 7f7769d..8bacff6 100644 > --- a/sys/kern/kern_clocksource.c > +++ b/sys/kern/kern_clocksource.c > @@ -207,7 +207,7 @@ handleevents(sbintime_t now, int fake) > } > } else > state->nextprof = state->nextstat; > - if (now >= state->nextcallopt) { > + if (now >= state->nextcallopt || now >= state->nextcall) { > state->nextcall = state->nextcallopt = SBT_MAX; > callout_process(now); > } I can add prints/asserts to show that what happens is that "state->nextcallopt > now" while "state->nextcall <= now". This situtation is allowed to persist due to the way getnextcpuevent() is currently implemented. Can the people CC'ed give the attached patch a spin and report back? --HPS --------------A39E9900D0A639AF85AD82CA Content-Type: text/x-patch; name="timer_init_fix2.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="timer_init_fix2.diff" diff --git a/sys/kern/kern_clocksource.c b/sys/kern/kern_clocksource.c index 7f7769d..8bacff6 100644 --- a/sys/kern/kern_clocksource.c +++ b/sys/kern/kern_clocksource.c @@ -207,7 +207,7 @@ handleevents(sbintime_t now, int fake) } } else state->nextprof = state->nextstat; - if (now >= state->nextcallopt) { + if (now >= state->nextcallopt || now >= state->nextcall) { state->nextcall = state->nextcallopt = SBT_MAX; callout_process(now); } --------------A39E9900D0A639AF85AD82CA--