From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935111AbbGHIOQ (ORCPT ); Wed, 8 Jul 2015 04:14:16 -0400 Received: from cantor2.suse.de ([195.135.220.15]:60590 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934475AbbGHINh (ORCPT ); Wed, 8 Jul 2015 04:13:37 -0400 Date: Wed, 8 Jul 2015 10:13:34 +0200 From: Petr Mladek To: Gavin Hu Cc: linux-kernel@vger.kernel.org, Alex Elder , "Luis R. Rodriguez" , "Steven Rostedt (Red Hat)" , Joe Perches , Peter Hurley , Tejun Heo , cxie4@marvell.com, cldu@marvell.com, xjian@marvell.com, fswu@marvell.com, Jan Kara Subject: Re: printk: preempt_disable with long time resulting in softlockup/RCU stall issues Message-ID: <20150708081334.GJ32664@pathway.suse.cz> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Wed 2015-07-08 15:20:01, Gavin Hu wrote: > Hi, > You know, a simple pirntk like printk("hello world!\n") via serial > console may consume 21 seconds above, because any printk is obligated to > pump out all the characters in the log buffer > with preempt disable until it is empty (vprintk_emit() and > console_unlock()), not just "hello world!" itself. > > And in the end, long time preempt disable may result in the softlock/RCU > stall issues. Some systems are configured to trigger a kernel panic when > meet softlock/ RCU stall. So heavy printk may result in kernel panic. > Usually, the solution is to remove related pritnks or limit the printk > times. So sometimes, the low-level developers have to handle various heavy > pirntk issues. > > Why don't make the printk mechanism more flexible and configurable, for > example, just pump out 1000 messages per printk calling, to avoid preempt > disable with a long time? > And we can disable or enable this feature by a proc interface. Be default, > this feature is disabled. So it doesn't influence boot-time message printk. > > Anyway, we maybe can give the low-level developers more options. > > Any comments are welcome! I add Jack into CC because he made several attempts to address this issue in the past. For example, see https://lkml.org/lkml/2013/2/26/743 Jack's approach was similar but also tried to schedule further writing to the console. With your approach, the console might stay far behind the reality for a long time. IMHO, we also want to make sure that all messages go out when the system is panicking. Best Regards, Petr