Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760565AbYARBdH (ORCPT ); Thu, 17 Jan 2008 20:33:07 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757521AbYARBc4 (ORCPT ); Thu, 17 Jan 2008 20:32:56 -0500 Received: from smtp2.linux-foundation.org ([207.189.120.14]:53438 "EHLO smtp2.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756258AbYARBcz (ORCPT ); Thu, 17 Jan 2008 20:32:55 -0500 Date: Thu, 17 Jan 2008 17:31:49 -0800 (PST) From: Linus Torvalds To: Steven Rostedt cc: LKML , Andrew Morton , Alexey Dobriyan , Kirill Korotaev , Ingo Molnar Subject: Re: [PATCH] printk deadlocks if called with runqueue lock held In-Reply-To: Message-ID: References: User-Agent: Alpine 1.00 (LFD 882 2007-12-20) 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: 1295 Lines: 42 On Thu, 17 Jan 2008, Steven Rostedt wrote: > > Calling printk with interrupts disabled should only be done for > emergencies and debugging anyway. Agreed, I think this is sane. > And with this patch, my code ran fine ;-) Patch looks fine, but I'm saddened: > + /* > + * 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(); ..because we actually *have* the old hardware irq enable/disable value in in that "flags" parameter we just restored, so it's more than a bit sad to then ask again whether they were disabled or not! IOW, I think this should be if (raw_irqs_disabled_flags(flags) && wake_klogd) wake_up_klogd(); Of course, not all architectures seem to suport that thing (it's currently only used by the CONFIG_TRACE_IRQFLAGS config option). Damn. So close, yet so far away. Linus -- 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/