From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754350AbdEQPIW (ORCPT ); Wed, 17 May 2017 11:08:22 -0400 Received: from mx2.suse.de ([195.135.220.15]:49730 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754341AbdEQPIU (ORCPT ); Wed, 17 May 2017 11:08:20 -0400 Date: Wed, 17 May 2017 17:08:17 +0200 From: Petr Mladek To: Sergey Senozhatsky Cc: Steven Rostedt , Andrew Morton , Peter Zijlstra , Russell King , Daniel Thompson , Ingo Molnar , Thomas Gleixner , Chris Metcalf , x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: Re: [PATCH v2] printk: Use the main logbuf in NMI when logbuf_lock is available Message-ID: <20170517150817.GD8621@pathway.suse.cz> References: <1493912763-24873-1-git-send-email-pmladek@suse.com> <20170505022141.GA418@tigerII.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170505022141.GA418@tigerII.localdomain> 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 Fri 2017-05-05 11:21:41, Sergey Senozhatsky wrote: > On (05/04/17 17:46), Petr Mladek wrote: > [..] > > Suggested-by: Sergey Senozhatsky > > Signed-off-by: Petr Mladek > > Acked-by: Sergey Senozhatsky Thanks for ack. > a small nitpick, > > [..] > > void printk_nmi_enter(void) > > { > > - this_cpu_or(printk_context, PRINTK_NMI_CONTEXT_MASK); > > + /* > > + * The size of the extra per-CPU buffer is limited. Use it only when > > + * the main one is locked. If this CPU is not in the safe context, > > + * the lock must be taken on another CPU and we could wait for it. > > + */ > > + if (raw_spin_is_locked(&logbuf_lock) && > > + this_cpu_read(printk_context) & PRINTK_SAFE_CONTEXT_MASK) { > > + this_cpu_or(printk_context, PRINTK_NMI_CONTEXT_MASK); > > could we please check `printk_context' (local to a particular CPU) > first and, if positive, then access `logbuf_lock' (which is global)? OK, I did so and queued the fix for-4.13, see https://git.kernel.org/pub/scm/linux/kernel/git/pmladek/printk.git/commit/?h=for-4.13&id=ad30113010b7b2dd886923261aea7034de07cce6 Best Regards, Petr