public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Alexey Dobriyan <adobriyan@openvz.org>,
	Kirill Korotaev <dev@sw.ru>
Subject: Re: [PATCH] printk deadlocks if called with runqueue lock held
Date: Wed, 23 Jan 2008 13:31:49 +0000	[thread overview]
Message-ID: <20080123133149.GA4059@ucw.cz> (raw)
In-Reply-To: <Pine.LNX.4.58.0801172000430.32679@gandalf.stny.rr.com>

Hi!

> I thought that one could place a printk anywhere without worrying.
> But it seems that it is not wise to place a printk where the runqueue
> lock is held.
> 
> I just spent two hours debugging why some of my code was locking up,
> to find that the lockup was caused by some debugging printk's that
> I had in the scheduler.  The printk's were only in rare paths so
> they shouldn't be too much of a problem, but after I hit the printk
> the system locked up.
> 
> Thinking that it was locking up on my code I went looking down the
> wrong path. I finally found (after examining an NMI dump) that
> the lockup happened because printk was trying to wakeup the klogd
> daemon, which caused a deadlock when the try_to_wakeup code tries
> to grab the runqueue lock.

Could try_to_wakeup use trylock, and only avoid wakeup if lock is
already held?
							Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

  parent reply	other threads:[~2008-01-23 18:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-18  1:04 [PATCH] printk deadlocks if called with runqueue lock held Steven Rostedt
2008-01-18  1:19 ` Andrew Morton
2008-01-18  1:57   ` Steven Rostedt
2008-01-18  1:31 ` Linus Torvalds
2008-01-18  1:52   ` Steven Rostedt
2008-01-18 11:04 ` Jiri Kosina
2008-01-18 11:35   ` Steven Rostedt
2008-01-18 14:55     ` Jan Kiszka
2008-01-18 16:26       ` Steven Rostedt
2008-01-18 17:30       ` Linus Torvalds
2008-01-23 13:31 ` Pavel Machek [this message]
2008-01-23 18:36   ` Steven Rostedt
2008-01-24  9:00     ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080123133149.GA4059@ucw.cz \
    --to=pavel@ucw.cz \
    --cc=adobriyan@openvz.org \
    --cc=akpm@linux-foundation.org \
    --cc=dev@sw.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox