From owner-freebsd-bugs Tue Sep 11 7:20: 5 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 0D32F37B403 for ; Tue, 11 Sep 2001 07:20:01 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id f8BEK1i69395; Tue, 11 Sep 2001 07:20:01 -0700 (PDT) (envelope-from gnats) Date: Tue, 11 Sep 2001 07:20:01 -0700 (PDT) Message-Id: <200109111420.f8BEK1i69395@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Bruce Evans Subject: Re: kern/30482: calcru calls printf while holding a spin lock Reply-To: Bruce Evans Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR kern/30482; it has been noted by GNATS. From: Bruce Evans To: Ville-Pertti Keinonen Cc: Subject: Re: kern/30482: calcru calls printf while holding a spin lock Date: Wed, 12 Sep 2001 00:13:38 +1000 (EST) On Mon, 10 Sep 2001, Ville-Pertti Keinonen wrote: > >Description: > A machine that previously frequently reported problems with > microuptime() going backwards in calcru started crashing after a > recent update. > > I'm just guessing based on the stack trace and the panic message > (and this is the first time I look at anything related to SMPng > locking), but it seems that calcru calls printf which eventually > tries to wake up another process and grab allproc_lock while > sched_lock is held... > > This seems like an obvious enough bug that it should not require > further details. This is a bug in printf(). printf() must work when ordinary spinlocks like sched_lock are held (for debugging). Known bugs in printf(): - the syscons console driver is not reentrant. The corresponding "microtime() goes backwards" printf() in mi_switch() was ifdefed out a long time ago to avoid panicing for this bug. - the TIOCCONS ioctl causes ordinary printf()s to go to a tty (usually a pty). This can never have worked for printf()s from interrupt handlers and now causes a panic instead of random misbehaviour when printf() is called with a spinlock held. Workaround: always use a serial console and don't permit it to be stolen by TIOCCONS. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message