Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1763461AbYARQ3e (ORCPT ); Fri, 18 Jan 2008 11:29:34 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1762657AbYARQ2O (ORCPT ); Fri, 18 Jan 2008 11:28:14 -0500 Received: from ms-smtp-05.nyroc.rr.com ([24.24.2.59]:64123 "EHLO ms-smtp-05.nyroc.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1763166AbYARQ2N (ORCPT ); Fri, 18 Jan 2008 11:28:13 -0500 Date: Fri, 18 Jan 2008 11:26:28 -0500 (EST) From: Steven Rostedt X-X-Sender: rostedt@gandalf.stny.rr.com To: Jan Kiszka cc: Jiri Kosina , LKML , Linus Torvalds , Andrew Morton , Alexey Dobriyan , Kirill Korotaev Subject: Re: [PATCH] printk deadlocks if called with runqueue lock held In-Reply-To: <4790BDD1.40808@siemens.com> Message-ID: References: <4790BDD1.40808@siemens.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1464 Lines: 44 On Fri, 18 Jan 2008, Jan Kiszka wrote: > Steven Rostedt wrote: > .... > > @@ -978,7 +980,13 @@ void release_console_sem(void) > > console_locked = 0; > > up(&console_sem); > > Hmm, just looking at this fragment: Doesn't up() include the risk of > running onto the runqueue lock as well? Very little risk (if any). If printk fails to get the console_sem it doesn't block. So there would be no waiters on the semaphore, and thus try_to_wake_up would not be called. The only place I see the down actually being called is in suspend code, and even then, we would need to lock the rq of the task that is trying to grab the console_sem and the deadlock would only occur if that was on the same CPU. And honestly, I'm not sure that's even possible. -- Steve > > > spin_unlock_irqrestore(&logbuf_lock, flags); > > - if (wake_klogd) > > + /* > > + * If we try to wake up klogd while printing with the runqueue lock > > + * held, this will deadlock. We don't have access to the runqueue > > + * lock from here, but just checking for interrupts disabled > > + * should be enough. > > + */ > > + if (!irqs_disabled() && wake_klogd) > > wake_up_klogd(); > > } > > EXPORT_SYMBOL(release_console_sem); > > Jan > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/