From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752498AbcBKLrO (ORCPT ); Thu, 11 Feb 2016 06:47:14 -0500 Received: from mx2.suse.de ([195.135.220.15]:47807 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752436AbcBKLrM (ORCPT ); Thu, 11 Feb 2016 06:47:12 -0500 Date: Thu, 11 Feb 2016 12:47:10 +0100 From: Petr Mladek To: Sergey Senozhatsky Cc: Steven Rostedt , Denys Vlasenko , linux-kernel@vger.kernel.org, srostedt@redhat.com, Tejun Heo , Peter Hurley , Jan Kara , Andrew Morton , Kyle McMartin , KY Srinivasan , Dave Jones , Calvin Owens Subject: Re: [PATCH] printk: avoid livelock if another CPU printks continuously Message-ID: <20160211114710.GK3305@pathway.suse.cz> References: <1454963703-20433-1-git-send-email-dvlasenk@redhat.com> <20160210144416.GE12548@pathway.suse.cz> <20160210161016.GF12548@pathway.suse.cz> <20160210112530.04c5512f@gandalf.local.home> <20160211082112.GC895@swordfish> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160211082112.GC895@swordfish> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 2016-02-11 17:21:12, Sergey Senozhatsky wrote: > Hello, > Thanks for Cc-ing, and sorry for long reply, I'm traveling now. > > On (02/10/16 11:25), Steven Rostedt wrote: > > On Wed, 10 Feb 2016 17:10:16 +0100 > > Petr Mladek wrote: > > > > > > Note, it's not that performance critical, and the loop only happens if > > > > someone else is adding to the console, which hopefully, should be rare. > > > > > > I probably used too strong words. It is possible that the performance > > > impact will not be critical. But the behavior is non-deterministic. > > > I think that the approach taken by Jack is more promising. > > > I mean the offloading of the console stuff to a workqueue. > > > > My worry about that is that it never comes out. The point about printk, > > is that it should pretty much be guaranteed to print. If the system is > > dying, and we push it off to a work queue, and that workqueue never > > runs, then we lose critical data. > > correct, IIRC Jan agreed to switch to 'direct' (current behaviour) printk when > one of the CPUs calls panic() (we still can use that approach even with > workqueue based printk) > http://marc.info/?l=linux-kernel&m=145200464309562 Yup. > the other thing with workqueues based approach is that all of them can be 'blocked' > in some OOM cases, so sort of fallback mechanism is also needed here > http://marc.info/?l=linux-kernel&m=145251885502488 If this proves to be a problem. We could always use a workqueue with a rescue worker. Regarding the patch from Pan Xinhui. My main problem with it is that it adds many handshakes and twists to the already complicated printk code. Also it does not solve the problem if the flood of messages comes entirely from an IRQ context. Workqueues code is not trivial but mature. And the usage of the workqueues in printk is quite straightforward. Best Regards, Petr