Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1281425
| From | Michael Ellerman <mpe@ellerman.id.au> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2 1/5] printk/nmi: Generic solution for safe printk in NMI |
| Date | 2015-12-02 03:50 +0100 |
| Message-ID | <qB5Eu-1am-13@gated-at.bofh.it> (permalink) |
| References | <qzp4E-243-71@gated-at.bofh.it> <qzpei-27s-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, 2015-11-27 at 12:09 +0100, Petr Mladek wrote:
> printk() takes some locks and could not be used a safe way in NMI
> context.
>
> The chance of a deadlock is real especially when printing
> stacks from all CPUs. This particular problem has been addressed
> on x86 by the commit a9edc8809328 ("x86/nmi: Perform a safe NMI stack
> trace on all CPUs").
...
> diff --git a/kernel/printk/nmi.c b/kernel/printk/nmi.c
> new file mode 100644
> index 000000000000..3989e13a0021
> --- /dev/null
> +++ b/kernel/printk/nmi.c
> @@ -0,0 +1,200 @@
...
> +
> +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) -
> + sizeof(struct irq_work)];
> +};
> +static DEFINE_PER_CPU(struct nmi_seq_buf, nmi_print_seq);
PAGE_SIZE isn't always 4K.
On typical powerpc systems this will give you 128K, and on some 512K, which is
probably not what we wanted.
The existing code just did:
#define NMI_BUF_SIZE 4096
So I think you should just go back to doing that.
cheers
--
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 | Next — Next in thread | Find similar | Unroll thread
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
csiph-web