From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>,
Thomas Gleixner <tglx@linutronix.de>,
Peter Zijlstra <peterz@infradead.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
"H. Peter Anvin" <hpa@zytor.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
Jason Baron <jbaron@redhat.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
"H. Peter Anvin" <hpa@linux.intel.com>,
Paul Turner <pjt@google.com>
Subject: Re: [RFC][PATCH 3/3] x86: Add workaround to NMI iret woes
Date: Fri, 09 Dec 2011 10:20:34 -0500 [thread overview]
Message-ID: <1323444034.1937.20.camel@frodo> (raw)
In-Reply-To: <1323398616.30977.167.camel@frodo>
On Thu, 2011-12-08 at 21:43 -0500, Steven Rostedt wrote:
> diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c
> index b9c8628..d35f554 100644
> --- a/arch/x86/kernel/nmi.c
> +++ b/arch/x86/kernel/nmi.c
> @@ -407,13 +407,29 @@ static notrace __kprobes void default_do_nmi(struct pt_regs *regs)
> dotraplinkage notrace __kprobes void
> do_nmi(struct pt_regs *regs, long error_code)
> {
> + int update_debug_stack = 0;
> +
> nmi_enter();
>
> + /*
> + * If we interrupted a breakpoint, it is possible that
> + * the nmi handler will have breakpoints too. We need to
> + * change the IDT such that breakpoints that happen here
> + * continue to use the NMI stack.
> + */
> + if (unlikely(is_debug_stack(regs->sp))) {
For kicks, I made the update happen every NMI, but also changed the IDT
entry of the NMI to also not change the stack. Then I was able to move a
lot of the hacks from assembly into C code, just before the nmi_enter()
above. It seems it can work too. I didn't finish it, I just wanted to
see if it was doable. But I'm not sure we want to change the IDT (twice)
for all NMIs.
-- Steve
> + zero_debug_stack();
> + update_debug_stack = 1;
> + }
> +
> inc_irq_stat(__nmi_count);
>
> if (!ignore_nmis)
> default_do_nmi(regs);
>
> + if (unlikely(update_debug_stack))
> + reset_debug_stack();
> +
> nmi_exit();
> }
next prev parent reply other threads:[~2011-12-09 15:20 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-08 19:30 [RFC][PATCH 0/3] x86: Find a way to allow breakpoints in NMIs Steven Rostedt
2011-12-08 19:30 ` [RFC][PATCH 1/3] x86: Do not schedule while still in NMI context Steven Rostedt
2011-12-08 19:30 ` [RFC][PATCH 2/3] x86: Document the NMI handler about not using paranoid_exit Steven Rostedt
2011-12-08 19:30 ` [RFC][PATCH 3/3] x86: Add workaround to NMI iret woes Steven Rostedt
2011-12-08 19:36 ` Steven Rostedt
2011-12-09 2:43 ` Steven Rostedt
2011-12-09 9:22 ` Peter Zijlstra
2011-12-09 15:00 ` Steven Rostedt
2011-12-09 15:10 ` Peter Zijlstra
2011-12-09 15:25 ` Steven Rostedt
2011-12-09 15:20 ` Steven Rostedt [this message]
2011-12-09 16:34 ` Steven Rostedt
2011-12-09 17:19 ` Steven Rostedt
2011-12-09 17:49 ` Borislav Petkov
2011-12-09 18:20 ` Steven Rostedt
2011-12-09 16:49 ` Jason Baron
2011-12-09 17:14 ` Steven Rostedt
2011-12-09 12:40 ` Mathieu Desnoyers
2011-12-09 13:02 ` Mathieu Desnoyers
2011-12-09 14:49 ` Steven Rostedt
2011-12-09 15:02 ` Mathieu Desnoyers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1323444034.1937.20.camel@frodo \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=fweisbec@gmail.com \
--cc=hpa@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jbaron@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=pjt@google.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox