From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752200AbcLJDKc (ORCPT ); Fri, 9 Dec 2016 22:10:32 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:33388 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751672AbcLJDKa (ORCPT ); Fri, 9 Dec 2016 22:10:30 -0500 Date: Sat, 10 Dec 2016 12:10:22 +0900 From: Sergey Senozhatsky To: Petr Mladek Cc: Sergey Senozhatsky , Andrew Morton , Jan Kara , Tejun Heo , Calvin Owens , Thomas Gleixner , Steven Rostedt , Ingo Molnar , Peter Zijlstra , Andy Lutomirski , Linus Torvalds , linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: Re: [RFC][PATCHv5 3/7] printk: introduce per-cpu safe_print seq buffer Message-ID: <20161210031022.GA493@tigerII.localdomain> References: <20161201135546.15549-1-sergey.senozhatsky@gmail.com> <20161201135546.15549-4-sergey.senozhatsky@gmail.com> <20161209164625.GL3506@pathway.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161209164625.GL3506@pathway.suse.cz> User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (12/09/16 17:46), Petr Mladek wrote: > > -/* > > - * Safe printk() for NMI context. It uses a per-CPU buffer to > > - * store the message. NMIs are not nested, so there is always only > > - * one writer running. But the buffer might get flushed from another > > - * CPU, so we need to be careful. > > - */ > > We should keep/create a good description here because the function > has a non-trivial code. What about something like? > which is really not related to this patch set. > > * Make sure that all old data have been read before the buffer was > > @@ -261,14 +263,95 @@ void printk_safe_flush_on_panic(void) > > printk_safe_flush(); > > } > > > > +#ifdef CONFIG_PRINTK_NMI > > +/* > > + * Safe printk() for NMI context. It uses a per-CPU buffer to > > + * store the message. NMIs are not nested, so there is always only > > + * one writer running. But the buffer might get flushed from another > > + * CPU, so we need to be careful. > > + */ > > Hmm, I wanted to describe why we need another per-CPU buffer in NMI > and I am not sure that we really need it. NMI-printk can interrupt safe-printk's vsnprintf() in the middle of the "while (*fmt)" loop: safe-priNMI-PRINTK -ss