From owner-freebsd-smp Wed Sep 20 0:46:55 2000 Delivered-To: freebsd-smp@freebsd.org Received: from pike.osd.bsdi.com (pike.osd.bsdi.com [204.216.28.222]) by hub.freebsd.org (Postfix) with ESMTP id 4B9C937B424; Wed, 20 Sep 2000 00:46:51 -0700 (PDT) Received: from foo.osd.bsdi.com (root@foo.osd.bsdi.com [204.216.28.137]) by pike.osd.bsdi.com (8.11.0/8.9.3) with ESMTP id e8K7kji66814; Wed, 20 Sep 2000 00:46:45 -0700 (PDT) (envelope-from jhb@foo.osd.bsdi.com) Received: (from jhb@localhost) by foo.osd.bsdi.com (8.11.0/8.11.0) id e8K7iPx93296; Wed, 20 Sep 2000 00:44:25 -0700 (PDT) (envelope-from jhb) Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: Date: Wed, 20 Sep 2000 00:44:24 -0700 (PDT) Organization: BSD, Inc. From: John Baldwin To: Bruce Evans Subject: Re: recent kernel, microuptime went backwards Cc: current@FreeBSD.ORG, "Andrey A. Chernov" , smp@FreeBSD.ORG Sender: owner-freebsd-smp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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 -- 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-smp" in the body of the message