Re: [RFC][PATCH 3/3] x86/nmi: Perform a safe NMI stack trace on all CPUs

From: Jiri Kosina
Date: Wed Nov 19 2014 - 05:44:57 EST

On Wed, 19 Nov 2014, Borislav Petkov wrote:

> I'm wondering if this could be used in a generic manner throughout code
> where we could say "ok, I'm in an NMI context, so lemme switch printk's
> and do some printing" so that NMI and NMI-like atomic contexts could use
> printk. Lemme do an mce example:
> do_machine_check(..)
> {
> printk_func_t printk_func_save = this_cpu_read(printk_func);
> ...
> /* in #MC handler, switch printks */
> this_cpu_write(printk_func, nmi_vprintk);
> printk("This is a hw error, details: ...\n");
> /* more bla */
> this_cpu_write(printk_func, printk_func_save);
> }
> or should we change that in entry.S, before we call the handler?

If we are going down this path, do_nmi() should be early enough to do it,
no need to pollute NMI assembly code with this.

Jiri Kosina
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at