Subject: Re: kprintf locking problem.
To: Anders Magnusson <ragge@ludd.luth.se>
From: Jason R Thorpe <thorpej@zembu.com>
List: tech-smp
Date: 06/03/2001 08:07:36
On Sun, Jun 03, 2001 at 04:55:04PM +0200, Anders Magnusson wrote:

 > The kernel printf routines are protected by a spinlock so that only
 > one processor can be in the printf routnes at the same time. I assume
 > that this locking is to protect the console hardware from being accessed
 > from more than one CPU at a time. This causes problem on machines where
 > only one CPU can access the system console and the rest must send their
 > data over via IPI: if a slave CPU enters the printf routines, and then
 > the master CPU also tries to do a printf, the master will spinlock at
 > high ipl. Meanwhile the slave has reached putchar() and sends an IPI 
 > which will never reach the master, hence the deadlock.

Well, it's also designed to prevent interleaved printf characters, i.e.
you want to be able to see:

cpu0
cpu1

not:

cpcpuu01

Does the VAX's scheme deal with that okay?  Also, where do you want
to put the new #define?  Probably should be in sys/types.h, or something,
as __NO_KPRINTF_LOCK.

-- 
        -- Jason R. Thorpe <thorpej@zembu.com>