From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S941691AbcJSOVA (ORCPT ); Wed, 19 Oct 2016 10:21:00 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:60665 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S941303AbcJSOU4 (ORCPT ); Wed, 19 Oct 2016 10:20:56 -0400 Date: Wed, 19 Oct 2016 15:34:19 +0200 From: Peter Zijlstra To: Petr Mladek Cc: Sergey Senozhatsky , Andrew Morton , Jan Kara , Tejun Heo , Calvin Owens , Thomas Gleixner , Mel Gorman , Steven Rostedt , Ingo Molnar , linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: Re: [RFC][PATCHv3 0/6] printk: use printk_safe to handle printk() recursive calls Message-ID: <20161019133419.GO3102@twins.programming.kicks-ass.net> References: <20161018154045.7364-1-sergey.senozhatsky@gmail.com> <20161018170754.GA3102@twins.programming.kicks-ass.net> <20161019131836.GF11071@pathway.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161019131836.GF11071@pathway.suse.cz> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 19, 2016 at 03:18:36PM +0200, Petr Mladek wrote: > On Tue 2016-10-18 19:07:54, Peter Zijlstra wrote: > > The entire class of deadlocks you've missed is that console->write() is > > a piece of crap too ;-) Even the bog standard 8250 serial console driver > > can do wakeups. > > I wonder if all the hard problems are actually related to the console > handling. > > There are problems with the single logbuffer but these should get > eliminated by the NMI/safe temporary per-CPU buffers. > > All might be easier if we always offload the console handling > into a kthread or so and trigger it via the minimalist > irq_work. It would kill huge bunch of possible deadlocks. > It will even allow to get rid of printk_deferred() and > the uncertainty where it is needed. > > The penalty would be "slightly" delayed console output. But is > it a real problem? It should not be a big deal when everything works. > We could always try hard when panicking. And there always > might be a fallback with that direct early_console(). Right, so I've had to debug quite a few situations where that 'later' simply never happens... I agree that such a scenario is basically all the regular console drivers are capable of though. It might make sense to go there, but allow early_console to print on the go, keeping synchronous output available. We would still need the logbuf to become NMI safe wrt adding entries though. It would however place hard requirements of early_console implementations; already violated by for instance the USB3-debug-port implementation I just looked at: lkml.kernel.org/r/20161019130943.GA3175@twins.programming.kicks-ass.net