public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andi Kleen <andi@firstfloor.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	"H. Peter Anvin" <hpa@linux.intel.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Paul Turner <pjt@google.com>
Subject: Re: Perhaps a side effect regarding NMI returns
Date: Wed, 07 Dec 2011 12:31:56 -0500	[thread overview]
Message-ID: <1323279116.30977.109.camel@frodo> (raw)
In-Reply-To: <CA+55aFzvGcVRDdm82OdjwP-D-fnrgTVFekVVVKYZSbsexGhN-w@mail.gmail.com>

On Wed, 2011-12-07 at 08:44 -0800, Linus Torvalds wrote:

> Sure. If it's tested, I have no problem with signing off on it, so
> just add it. Do you have some kind of commit message that makes sense
> and explains the NMI shadow issue?

How about something like this:

The NMI handler uses the paranoid_exit routine that checks the
NEED_RESCHED flag, and if it is set and the return is for userspace,
then interrupts are enabled, the stack is swapped to the thread's stack,
and schedule is called. The problem with this is that we are still in an
NMI context until an iret is executed. This means that any new NMIs are
now starved until an interrupt or exception occurs and does the iret.

As NMIs can not be masked and can interrupt any location, they are
treated as a special case. NEED_RESCHED should not be set in an NMI
handler. The interruption by the NMI should not disturb the work flow
for scheduling. Any IPI sent to a processor after sending the
NEED_RESCHED would have to wait for the NMI anyway, and after the IPI
finishes the schedule would be called as required.

There is no reason to do anything special leaving an NMI. Remove the
call to paranoid_exit and do a simple return. This not only fixes the
bug of starved NMIs, but it also cleans up the code.

-- Steve


  reply	other threads:[~2011-12-07 17:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-29  4:07 Perhaps a side effect regarding NMI returns Steven Rostedt
2011-11-29  4:53 ` Linus Torvalds
2011-11-29  7:33   ` Paul Turner
2011-11-29 20:09   ` Andi Kleen
2011-11-29 20:12     ` Linus Torvalds
2011-11-29 20:31       ` Andi Kleen
2011-11-29 20:36         ` Linus Torvalds
2011-11-29 20:58           ` Steven Rostedt
2011-11-29 21:05             ` Linus Torvalds
2011-11-29 21:22               ` Steven Rostedt
2011-11-29 22:14             ` Jason Baron
2011-11-29 22:51               ` Steven Rostedt
2011-11-30 11:56                 ` Peter Zijlstra
2011-11-29 20:35     ` Steven Rostedt
2011-11-29 20:44       ` Linus Torvalds
2011-12-07 16:36         ` Steven Rostedt
2011-12-07 16:44           ` Linus Torvalds
2011-12-07 17:31             ` Steven Rostedt [this message]
2011-12-07 17:48               ` Linus Torvalds
2011-12-07 17:51           ` Andi Kleen
2012-01-08  8:55         ` [tip:perf/core] x86: Do not schedule while still in NMI context tip-bot for Linus Torvalds
2011-11-29 21:28       ` Perhaps a side effect regarding NMI returns Andi Kleen

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=1323279116.30977.109.camel@frodo \
    --to=rostedt@goodmis.org \
    --cc=andi@firstfloor.org \
    --cc=fweisbec@gmail.com \
    --cc=hpa@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --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