Subject: Re: kprintf locking problem.
To: None <ragge@ludd.luth.se, thorpej@zembu.com>
From: Ross Harvey <ross@ghs.com>
List: tech-smp
Date: 06/03/2001 09:45:09
> From: Anders Magnusson <ragge@ludd.luth.se>
> > 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:
> > 
> [...]
> > Does the VAX's scheme deal with that okay?
> >
> Not from the slave CPUs (because the chars are sent via IPI).
>
> > Also, where do you want
> > to put the new #define?  Probably should be in sys/types.h, or something,
> > as __NO_KPRINTF_LOCK.
> > 
> It doesn't matter at all, I just want this to work for some degree of "work".
> I am interested in all suggestions as long as this problem is solved.


I don't think that your problem is the printf lock. You have a general
problem with the slave attempting to print when the master is spinning
on _any_ lock, since the slave can't proceed until it prints, but the
master won't acquire its lock until the slave proceeds.

I think you need a more general fix.

// ross