Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753694AbbK3QmV (ORCPT ); Mon, 30 Nov 2015 11:42:21 -0500 Received: from mail-pa0-f47.google.com ([209.85.220.47]:34254 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752033AbbK3QmT (ORCPT ); Mon, 30 Nov 2015 11:42:19 -0500 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.0 \(3094\)) Subject: Re: [PATCH v2 5/5] printk/nmi: Increase the size of the temporary buffer From: yalin wang In-Reply-To: <1448622572-16900-6-git-send-email-pmladek@suse.com> Date: Mon, 30 Nov 2015 08:42:04 -0800 Cc: Andrew Morton , Peter Zijlstra , Steven Rostedt , Russell King , Daniel Thompson , Jiri Kosina , Ingo Molnar , Thomas Gleixner , linux-kernel , x86@kernel.org, linux-arm-kernel@lists.infradead.org, adi-buildroot-devel@lists.sourceforge.net, linux-cris-kernel@axis.com, linux-mips@linux-mips.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org Content-Transfer-Encoding: 7bit Message-Id: <81211733-2484-40A9-9D4A-644AA27FBC73@gmail.com> References: <1448622572-16900-1-git-send-email-pmladek@suse.com> <1448622572-16900-6-git-send-email-pmladek@suse.com> To: Petr Mladek X-Mailer: Apple Mail (2.3094) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1565 Lines: 50 > On Nov 27, 2015, at 19:09, Petr Mladek wrote: > > Testing has shown that the backtrace sometimes does not fit > into the 4kB temporary buffer that is used in NMI context. > > The warnings are gone when I double the temporary buffer size. > > Note that this problem existed even in the x86-specific > implementation that was added by the commit a9edc8809328 > ("x86/nmi: Perform a safe NMI stack trace on all CPUs"). > Nobody noticed it because it did not print any warnings. > > Signed-off-by: Petr Mladek > --- > kernel/printk/nmi.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/printk/nmi.c b/kernel/printk/nmi.c > index 8af1e4016719..6111644d5f01 100644 > --- a/kernel/printk/nmi.c > +++ b/kernel/printk/nmi.c > @@ -42,7 +42,7 @@ atomic_t nmi_message_lost; > struct nmi_seq_buf { > atomic_t len; /* length of written data */ > struct irq_work work; /* IRQ work that flushes the buffer */ > - unsigned char buffer[PAGE_SIZE - sizeof(atomic_t) - > + unsigned char buffer[2 * PAGE_SIZE - sizeof(atomic_t) - > sizeof(struct irq_work)]; > }; > why not define like this: union { struct {atomic_t len; struct irq_work work; } unsigned char buffer[PAGE_SIZE * 2] ; } we can make sure the union is 2 PAGE_SIZE . Thanks -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/