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 <[EMAIL PROTECTED]> -- 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 [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to