From: Steven Rostedt <rostedt@goodmis.org>
To: Andi Kleen <andi@firstfloor.org>
Cc: Linus Torvalds <torvalds@linux-foundation.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>,
Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>,
Paul Turner <pjt@google.com>
Subject: Re: Perhaps a side effect regarding NMI returns
Date: Tue, 29 Nov 2011 15:35:20 -0500 [thread overview]
Message-ID: <1322598920.17003.71.camel@frodo> (raw)
In-Reply-To: <m2r50qlmgk.fsf@firstfloor.org>
On Tue, 2011-11-29 at 12:09 -0800, Andi Kleen wrote:
> Linus Torvalds <torvalds@linux-foundation.org> writes:
>
> Not sure what problem Steven thinks is there. Once you
> switched the stack any nesting is fine.
Problem? I never said there was a problem. I just said there was a
subtle side effect, that may or may not be a problem. But I never said
there was an actually problem.
There may be a problem where you are profiling at a high frequency, and
then hit this and suddenly, your high frequency NMIs are stopped till
the next interrupt. If you are running at 100HZ, the next interrupt may
not happen for 10ms, where we don't have an NMI triggered until then.
Perhaps for some reason NEED_RESCHED is set, but the task is no longer
going to run. Not sure if that could even happen, but for kicks, lets
assume it can. Then we schedule into the idle task that goes to sleep.
With NO_HZ, we may not even get another interrupt for a very long time.
But we keep NMIs disabled.
The difference here is that we call schedule without ever enabling NMIs.
Now is that a problem? It may be.
>
> > I would suggest that the actual NMI handler itself should probably
> > never use that paranoid exit at all, and just always use a regular
> > iret. Screw scheduling and TIF checks.
>
> The reason I added them originally is to prevent the race of remote
> kernel events being delayed for a long time. With Frederic's nohz work
> this will be more important in the future. Today it would be eventually
> picked up by the regular timer interrupts.
I'm curious to what remote events can be set by an NMI that wont take
affect in what the NMI interrupted. I would think that NMIs should be
treated as if they didn't exist, because they should not be calling
anything that sets NEED_RESCHED or grabbing locks and such.
If a process on another CPU sets NEED_RESCHED on the task for this CPU,
it doesn't matter if it is in an NMI or not. The other process still
needs to send an IPI or something (that will be blocked until the NMI
finishes) in which case, the return from the NMI will trigger the
scheduling.
I don't see the problem where we can't just ignore the flags for NMIs.
What exactly is the race that causes issues when NMIs are not checking
for scheduling and such?
-- Steve
next prev parent reply other threads:[~2011-11-29 20:35 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 [this message]
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
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=1322598920.17003.71.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=mathieu.desnoyers@polymtl.ca \
--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