[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140312131344.GA28695@quack.suse.cz>
Date: Wed, 12 Mar 2014 14:13:44 +0100
From: Jan Kara <jack@...e.cz>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: John Stultz <john.stultz@...aro.org>, Jiri Bohac <jbohac@...e.cz>,
linux-kernel@...r.kernel.org,
Peter Zijlstra <a.p.zijlstra@...llo.nl>
Subject: Re: is printk() safe within a timekeeper_seq write section?
On Tue 11-03-14 22:32:26, Thomas Gleixner wrote:
> On Tue, 11 Mar 2014, John Stultz wrote:
> > I was also surprised the seqlock lockdep enablement changes wouldn't
> > catch this, but Jiri pointed out printk calls lockdep_off in
> > vprintk_emit() - which makes sense as you don't want lockdep splats
> > calling printk and recursing - but is frustrating to have that hole in
> > the checking.
> >
> > There's a few spots where we do printks with the timekeeping seqlock
> > held, and they're annoyingly nested far enough to make deferring the
> > printk awkward. So I'm half thinking we could have some sort of buffer
> > something like time_printk() could fill and then flush it after the lock
> > is dropped. Then we just need something to warn if any new printks' are
> > added to timekeeping seqlock sequences.
> >
> > The whole thing makes my head spin a bit, since even if we remove the
> > explicit printks, I'm not sure where else printk might be triggered
> > (like via lockdep warnings, for instance), where it might be unsafe.
> >
> > Peter/Thomas: Any thoughts on the deferred printk buffer? Does printk
> > already have something like this? Any other ideas here?
>
> I was thinking about something like that for RT as on RT printk is a
> complete nightmare. It's simple to implement that, but as we know from
> the RT experience it can lead to painful loss of debug output.
>
> Assume you printk inside such a region, which just fills the dmesg
> buffer and schedules the delayed output. Now in that same region you
> run into a deadlock which causes the whole machine to freeze. Then you
> won't see the debug output, which might actually give you the hint why
> the system deadlocked ....
Certainly just adding messages to printk buffer is more prone to loosing
the messages on error. OTOH if we schedule something like irq work to do
the printing (as currently happens with scheduler messages), loosing
messages should be relatively rare, shouldn't it?
Honza
--
Jan Kara <jack@...e.cz>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists