Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp4480181imc; Mon, 25 Feb 2019 05:45:38 -0800 (PST) X-Google-Smtp-Source: AHgI3IY30q9nnOCQIgng8p9ixm/uS7bZ/HssuVqhCnlLEDUu/x9H8lXGLdee7pJxZcTPIalLfYoI X-Received: by 2002:aa7:8b09:: with SMTP id f9mr11892597pfd.168.1551102338354; Mon, 25 Feb 2019 05:45:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551102338; cv=none; d=google.com; s=arc-20160816; b=m9aJtimQllUTgN/Z1crO44AfP0fVLGjNjPxYIlb3ygyq58rK/AEdJ4uoA3TW7MdeT6 qxpol6GtlVLk04q1ZUhXb1dX4Ok3+aWbk/4+uvYHnghJgZJobmeEj9nFlpw0H2TrRhQO x5am4E6Vo/20yjrA+UYDGgM1ysKUqgqZlD4wnta8/KJRx/WHZlyGBORRDrmGTGixbVjW EhE/7MAwDhkuCAm/CTKfPEmhSwP9tfRw8oKLQzI+5g7fWocGcWnEJRMaIhYXSICvhbe6 so8vDmiy1hMzWx8xFCsVOxi2xdFsX0Dxr/Aj1FRCf60Nt7IWd31pe4DMnyEjIfW7nNGB 33xA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=TxYxAO/lToT+nMHO2qEu13DXOdBvcfWR8f3gg2lzmZM=; b=DZlTRHVACAJCxOir9s6wAsKWkMKgugJpt3zQLHpbibLdyyouUpk0L+7qTuxchKAdOG iF1f18Y3g5f0e/l8K4dtfmM2caK/wvv3XQFgdBwiP1+7TbIIvZ2BsvDh6Ev65O++KDdJ EDXTvNsd7j+9LCBpJxycz+ohUu1rHwhnsXcJFj7WzsfGSADXigN7N/T1eEz2CLCLoJVr gmRQLvEoNEX8nzSE/EnzNorbu30Sd4Hjx3RjJ24BSXxTD6k58Qj1CJquzD8k734AuPCf yfFNzaqbC/C/4N1bxZz41eAEIFi0u8+0SiVHBUAtoTfJiNpjypnKe1VVPMK7bzzXi+kc 58vA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k72si9163241pge.188.2019.02.25.05.45.23; Mon, 25 Feb 2019 05:45:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727117AbfBYNog (ORCPT + 99 others); Mon, 25 Feb 2019 08:44:36 -0500 Received: from mx2.suse.de ([195.135.220.15]:33858 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726420AbfBYNog (ORCPT ); Mon, 25 Feb 2019 08:44:36 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 933C3ABDE; Mon, 25 Feb 2019 13:44:34 +0000 (UTC) Date: Mon, 25 Feb 2019 14:44:32 +0100 From: Petr Mladek To: John Ogness Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Sergey Senozhatsky , Steven Rostedt , Daniel Wang , Andrew Morton , Linus Torvalds , Greg Kroah-Hartman , Alan Cox , Jiri Slaby , Peter Feiner , linux-serial@vger.kernel.org, Sergey Senozhatsky Subject: Re: [RFC PATCH v1 12/25] printk: minimize console locking implementation Message-ID: <20190225134432.upiq6fuc42w4vfbg@pathway.suse.cz> References: <20190212143003.48446-1-john.ogness@linutronix.de> <20190212143003.48446-13-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190212143003.48446-13-john.ogness@linutronix.de> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 2019-02-12 15:29:50, John Ogness wrote: > Since printing of the printk buffer is now handled by the printk > kthread, minimize the console locking functions to just handle > locking of the console. > > NOTE: With this console_flush_on_panic will no longer flush. > > Signed-off-by: John Ogness > --- > kernel/printk/printk.c | 255 +------------------------------------------------ > 1 file changed, 1 insertion(+), 254 deletions(-) > > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c > index 073ff9fd6872..ece54c24ea0d 100644 > --- a/kernel/printk/printk.c > +++ b/kernel/printk/printk.c > @@ -209,19 +209,7 @@ static int nr_ext_console_drivers; > > static int __down_trylock_console_sem(unsigned long ip) > { > - int lock_failed; > - unsigned long flags; > - > - /* > - * Here and in __up_console_sem() we need to be in safe mode, > - * because spindump/WARN/etc from under console ->lock will > - * deadlock in printk()->down_trylock_console_sem() otherwise. > - */ > - printk_safe_enter_irqsave(flags); > - lock_failed = down_trylock(&console_sem); > - printk_safe_exit_irqrestore(flags); > - > - if (lock_failed) > + if (down_trylock(&console_sem)) > return 1; > mutex_acquire(&console_lock_dep_map, 0, 1, ip); > return 0; > @@ -230,13 +218,9 @@ static int __down_trylock_console_sem(unsigned long ip) > > static void __up_console_sem(unsigned long ip) > { > - unsigned long flags; > - > mutex_release(&console_lock_dep_map, 1, ip); > > - printk_safe_enter_irqsave(flags); > up(&console_sem); > - printk_safe_exit_irqrestore(flags); > } > #define up_console_sem() __up_console_sem(_RET_IP_) > It might be obvious from the previous mails. But just to be sure. I would remove printk_safe stuff in one patch after switching to the new ring buffer implementation. > @@ -1498,82 +1482,6 @@ static void format_text(struct printk_log *msg, u64 seq, > } > > /* > - * Special console_lock variants that help to reduce the risk of soft-lockups. > - * They allow to pass console_lock to another printk() call using a busy wait. > - */ [...] > -static void console_lock_spinning_enable(void) The console waiter logic is another story. It can get removed only after we have a reasonable alternative. That means an acceptable offload that handles emergency situations and sudden death reasonable well. I would move this into a separate patchset. Best Regards, Petr