From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f65.google.com ([74.125.83.65]:44940 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751221AbeERGiZ (ORCPT ); Fri, 18 May 2018 02:38:25 -0400 Date: Fri, 18 May 2018 15:38:20 +0900 From: Sergey Senozhatsky To: Sergey Senozhatsky Cc: Petr Mladek , Sergey Senozhatsky , Steven Rostedt , Peter Zijlstra , Tetsuo Handa , linux-kernel@vger.kernel.org, "4 . 13+" Subject: Re: [PATCH] printk/nmi: Prevent deadlock when serializing NMI backtraces Message-ID: <20180518063820.GA1504@jagdpanzerIV> References: <20180517143903.19339-1-pmladek@suse.com> <20180518020705.GB1160@jagdpanzerIV> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180518020705.GB1160@jagdpanzerIV> Sender: stable-owner@vger.kernel.org List-ID: On (05/18/18 11:07), Sergey Senozhatsky wrote: > > if (this_cpu_read(printk_context) & PRINTK_SAFE_CONTEXT_MASK) || > raw_spin_is_locked(&logbuf_lock) > > just to check per-CPU `printk_context' first and only afterwards > access the global `logbuf_lock'. printk_nmi_enter() happens on > every CPU, so maybe we can avoid some overhead by checking the > local per-CPU data first. Nah, may be it won't. This, probably, would have been the case if we had continue to call console drivers from printk_safe section [at least]. CPUs don't spend that much time in printk_safe sections. -ss