Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756361AbYAWRdL (ORCPT ); Wed, 23 Jan 2008 12:33:11 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756588AbYAWR1Z (ORCPT ); Wed, 23 Jan 2008 12:27:25 -0500 Received: from ms-smtp-04.nyroc.rr.com ([24.24.2.58]:47447 "EHLO ms-smtp-04.nyroc.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757129AbYAWR1Y (ORCPT ); Wed, 23 Jan 2008 12:27:24 -0500 Date: Wed, 23 Jan 2008 12:27:12 -0500 (EST) From: Steven Rostedt X-X-Sender: rostedt@gandalf.stny.rr.com To: Daniel Walker cc: LKML , Ingo Molnar , Linus Torvalds , Andrew Morton , Peter Zijlstra , Christoph Hellwig , Mathieu Desnoyers , Gregory Haskins , Arnaldo Carvalho de Melo , Thomas Gleixner , Tim Bird , Sam Ravnborg , "Frank Ch. Eigler" , Jan Kiszka , John Stultz , Arjan van de Ven , Steven Rostedt Subject: Re: [PATCH 01/20 -v5] printk - dont wakeup klogd with interrupts disabled In-Reply-To: <1201107978.13596.16.camel@imap.mvista.com> Message-ID: References: <20080123160236.969334052@goodmis.org> <20080123160441.236562634@goodmis.org> <1201107978.13596.16.camel@imap.mvista.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: 1662 Lines: 61 On Wed, 23 Jan 2008, Daniel Walker wrote: > > On Wed, 2008-01-23 at 11:02 -0500, Steven Rostedt wrote: > > > + if (!irqs_disabled() && wake_klogd) > > wake_up_klogd(); > > This causes a regression .. When printk is called during an OOPS in > kernels without this change then the OOPS will get logged, since the > logging process (klogd) is woken to handle the messages.. If you apply > this change klogd doesn't wakeup, and hence doesn't log the oops.. So if > you remove the wakeup here you have to add it someplace else to maintain > the logging .. > > (I'm not theorizing here, I have defects logged against this specific > piece of code..) It wont get woken up anyway. Did you look at wake_up_klogd? void wake_up_klogd(void) { if (!oops_in_progress && waitqueue_active(&log_wait)) wake_up_interruptible(&log_wait); } So if oops_in_progress is set, then it still wont get woken. Perhaps it got woken some other way? Or is oops_in_progress not set in these oops? One other solution is to make the runqueue locks visible externally. Like: in sched.c: int runqueue_is_locked(void) { int cpu = get_cpu(); struct rq *rq = cpu_rq(cpu); int ret; ret = spin_is_locked(&rq->lock); put_cpu(); return ret; } And in printk we could do: if (wake_klogd && !runqueue_is_locked()) wake_up_klogd(); This probably is the cleanest solution since it simply prevents the deadlock from occurring. -- Steve -- 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/