Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Sep 2000 00:44:24 -0700 (PDT)
From:      John Baldwin <jhb@FreeBSD.ORG>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        current@FreeBSD.ORG, "Andrey A. Chernov" <ache@nagual.pp.ru>, smp@FreeBSD.ORG
Subject:   Re: recent kernel, microuptime went backwards
Message-ID:  <XFMail.000920004424.jhb@FreeBSD.org>
In-Reply-To: <Pine.BSF.4.21.0009200514520.2289-100000@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On 19-Sep-00 Bruce Evans wrote:
> On Tue, 19 Sep 2000, Andrey A. Chernov wrote:
> 
>> With very latest kernel I got lots of
>> 
>> microuptime() went backwards (1.3624050 -> 1.998840)
>> 
>> messages just before
>> 
>> Mounting root from ufs:/dev/da0s1a
> 
> It really does go backwards.  This is caused by the giant lock preventing
> the clock interrupt task from running soon enough.  The giant lock can
> also prevent the clock interrupt task from running often enough even
> after booting.  E.g., "dd if=/dev/random of=/dev/null bs=large" does
> several bad things.

It's not the Giant lock that is at fault.  We give up Giant during mi_switch().
 Then scheduling problem is in the way that the top-level scheduler runs.  We
decide to schedule another process due to the timeslice ending during the clk
interrupt thread.  In the past, this was not run as a thread, so it ran, set
the AST_* constant for needing a resched and then exited.  During doreti, we
notice an AST is pending and call ast(). ast() calls userret() which notices
that a resched is needed and calls mi_switch().  In the New World Order, when
the clock interrupt occurs, we set the AST_* constant for every interrupt
before returning from sched_ithd().  This results in the actual interrupt
threads being schedule from ast().  However, when the clk ithread finishes, it
simply calls mi_switch() to enter the next process in ithd_loop().  The
need_resched() that it sets isn't handled until the next call to userret()
either via a hardware interrupt or a syscall return.  Thus, the problem isn't
due to Giant, but rather to interrupt threads.  As for the micruptime()
messages on boot, they only occur here on a UP kernel.  On an SMP kernel I
don't get them.  Also, they always occur during mi_switch() when an interrupt
thread is finishing and going back to sleep.  The first such thread to be run
to generate thet error message is the irq0: clk ithread, so the clk ithread is
running fine.

> Bruce

-- 

John Baldwin <jhb@FreeBSD.org> -- http://www.FreeBSD.org/~jhb/
PGP Key: http://www.cslab.vt.edu/~jobaldwi/pgpkey.asc
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.000920004424.jhb>