From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751834AbcCUA41 (ORCPT ); Sun, 20 Mar 2016 20:56:27 -0400 Received: from LGEAMRELO11.lge.com ([156.147.23.51]:52169 "EHLO lgeamrelo11.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750787AbcCUA4Z (ORCPT ); Sun, 20 Mar 2016 20:56:25 -0400 X-Original-SENDERIP: 156.147.1.125 X-Original-MAILFROM: byungchul.park@lge.com X-Original-SENDERIP: 10.177.222.33 X-Original-MAILFROM: byungchul.park@lge.com Date: Mon, 21 Mar 2016 09:56:08 +0900 From: Byungchul Park To: Sergey Senozhatsky Cc: Sergey Senozhatsky , Andrew Morton , Jan Kara , Petr Mladek , Tejun Heo , Tetsuo Handa , linux-kernel@vger.kernel.org, Jan Kara Subject: Re: [RFC][PATCH v5 1/2] printk: Make printk() completely async Message-ID: <20160321005608.GQ5220@X58A-UD3R> References: <1458483191-3596-1-git-send-email-sergey.senozhatsky@gmail.com> <1458483191-3596-2-git-send-email-sergey.senozhatsky@gmail.com> <20160321000647.GP5220@X58A-UD3R> <20160321004347.GA563@swordfish> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160321004347.GA563@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 Mon, Mar 21, 2016 at 09:43:47AM +0900, Sergey Senozhatsky wrote: > On (03/21/16 09:06), Byungchul Park wrote: > > On Sun, Mar 20, 2016 at 11:13:10PM +0900, Sergey Senozhatsky wrote: > [..] > > > + if (!sync_print) { > > > + if (in_sched) { > > > + /* > > > + * @in_sched messages may come too early, when we don't > > > + * yet have @printk_kthread. We can't print deferred > > > + * messages directly, because this may deadlock, route > > > + * them via IRQ context. > > > + */ > > > + __this_cpu_or(printk_pending, > > > + PRINTK_PENDING_OUTPUT); > > > + irq_work_queue(this_cpu_ptr(&wake_up_klogd_work)); > > > + } else if (printk_kthread && !in_panic) { > > > + /* Offload printing to a schedulable context. */ > > > + wake_up_process(printk_kthread); > > > > It will not print the "lockup suspected" message at all, for e.g. rq->lock, > > p->pi_lock and any locks which are used within wake_up_process(). > > this will switch to old SYNC printk() mode should such a lockup ever > happen, which is a giant advantage over any other implementation; doing > wake_up_process() within the 'we can detect recursive printk() here' > gives us better control. > > why > printk()->IRQ->wake_up_process()->spin_dump()->printk()->IRQ->wake_up_process()->spin_dump()->printk()->IRQ... > is better? What is IRQ? And I didn't say the recursion is good. I just said it can be avoid without using the last resort. > > > > Furtheremore, any printk() within wake_up_process() cannot work at all, as > > well. > > there is printk_deferred() which has LOGLEVEL_SCHED and which must be used > in sched functions. It would be good for all scheduler code to use the printk_deferred() as you said, but it's not true yet. > > -ss