Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1280103

Re: [PATCH v2 5/5] printk/nmi: Increase the size of the temporary buffer

From yalin wang <yalin.wang2010@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 5/5] printk/nmi: Increase the size of the temporary buffer
Date 2015-11-30 17:50 +0100
Message-ID <qAzOj-66r-35@gated-at.bofh.it> (permalink)
References <qzp4E-243-71@gated-at.bofh.it> <qzpei-27s-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


> On Nov 27, 2015, at 19:09, Petr Mladek <pmladek@suse.com> 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 <pmladek@suse.com>
> ---
> 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/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/5] Cleaning printk stuff in NMI context Petr Mladek <pmladek@suse.com> - 2015-11-27 12:10 +0100
  [PATCH v2 1/5] printk/nmi: Generic solution for safe printk in NMI Petr Mladek <pmladek@suse.com> - 2015-11-27 12:20 +0100
    Re: [PATCH v2 1/5] printk/nmi: Generic solution for safe printk in  NMI kbuild test robot <lkp@intel.com> - 2015-11-27 13:00 +0100
      Re: [PATCH v2 1/5] printk/nmi: Generic solution for safe printk in  NMI Petr Mladek <pmladek@suse.com> - 2015-11-27 16:40 +0100
        Re: [PATCH v2 1/5] printk/nmi: Generic solution for safe printk in  NMI Jiri Kosina <jikos@kernel.org> - 2015-12-02 00:30 +0100
          Re: [PATCH v2 1/5] printk/nmi: Generic solution for safe printk in  NMI Petr Mladek <pmladek@suse.com> - 2015-12-04 18:00 +0100
    Re: [PATCH v2 1/5] printk/nmi: Generic solution for safe printk in NMI Max Filippov <jcmvbkbc@gmail.com> - 2015-11-27 15:30 +0100
      Re: [PATCH v2 1/5] printk/nmi: Generic solution for safe printk in  NMI Petr Mladek <pmladek@suse.com> - 2015-11-30 15:30 +0100
    Re: [PATCH v2 1/5] printk/nmi: Generic solution for safe printk in  NMI Michael Ellerman <mpe@ellerman.id.au> - 2015-12-02 03:50 +0100
      Re: [PATCH v2 1/5] printk/nmi: Generic solution for safe printk in  NMI Petr Mladek <pmladek@suse.com> - 2015-12-04 16:30 +0100
  [PATCH v2 4/5] printk/nmi: Warn when some message has been lost in NMI context Petr Mladek <pmladek@suse.com> - 2015-11-27 12:20 +0100
  [PATCH v2 5/5] printk/nmi: Increase the size of the temporary buffer Petr Mladek <pmladek@suse.com> - 2015-11-27 12:20 +0100
    Re: [PATCH v2 5/5] printk/nmi: Increase the size of the temporary buffer yalin wang <yalin.wang2010@gmail.com> - 2015-11-30 17:50 +0100
      RE: [PATCH v2 5/5] printk/nmi: Increase the size of the temporary  buffer David Laight <David.Laight@ACULAB.COM> - 2015-12-02 17:30 +0100
        Re: [PATCH v2 5/5] printk/nmi: Increase the size of the temporary  buffer Petr Mladek <pmladek@suse.com> - 2015-12-04 16:50 +0100
      Re: [PATCH v2 5/5] printk/nmi: Increase the size of the temporary  buffer Petr Mladek <pmladek@suse.com> - 2015-12-07 15:20 +0100
  [PATCH v2 2/5] printk/nmi: Use IRQ work only when ready Petr Mladek <pmladek@suse.com> - 2015-11-27 12:20 +0100
  [PATCH v2 3/5] printk/nmi: Try hard to print Oops message in NMI context Petr Mladek <pmladek@suse.com> - 2015-11-27 12:20 +0100
    Re: [PATCH v2 3/5] printk/nmi: Try hard to print Oops message in NMI  context Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-12-02 00:50 +0100
      Re: [PATCH v2 3/5] printk/nmi: Try hard to print Oops message in NMI  context Petr Mladek <pmladek@suse.com> - 2015-12-04 16:30 +0100
        Re: [PATCH v2 3/5] printk/nmi: Try hard to print Oops message in NMI  context Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-12-04 18:20 +0100
          RE: [PATCH v2 3/5] printk/nmi: Try hard to print Oops message in  NMI context David Laight <David.Laight@ACULAB.COM> - 2015-12-07 17:00 +0100
            Re: [PATCH v2 3/5] printk/nmi: Try hard to print Oops message in NMI  context Petr Mladek <pmladek@suse.com> - 2015-12-08 15:50 +0100
          Re: [PATCH v2 3/5] printk/nmi: Try hard to print Oops message in NMI  context Petr Mladek <pmladek@suse.com> - 2015-12-08 12:30 +0100

csiph-web