From: Steven Rostedt <rostedt@goodmis.org>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH 2/3] x86: Remove cmpxchg from i386 NMI nesting code
Date: Fri, 08 Jun 2012 13:36:15 -0400 [thread overview]
Message-ID: <1339176975.13377.56.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <4FD23626.4020802@zytor.com>
On Fri, 2012-06-08 at 10:28 -0700, H. Peter Anvin wrote:
> On 06/08/2012 09:41 AM, Steven Rostedt wrote:
>
> >>
> >> #define nmi_nesting_postprocess() \
> >> do { \
> >> - if (cmpxchg(&__get_cpu_var(nmi_state), \
> >> - NMI_EXECUTING, NMI_NOT_RUNNING) != NMI_EXECUTING) \
> >> + if (!local_dec_and_test(&__get_cpu_var(nmi_state))) \
> >
> > Now this is where I think the patch helps. I'm almost certain that
> > local_dec_and_test is faster than a cmpxchg by many cycles. Especially
> > on i386.
> >
>
> On i386 it's infinite, but again, I don't think the code will ever be
> exercised on i386. I'm much more concerned about performance on current
> processors.
I'm not worried about non i386 here. Some context missing from the patch
is that this code is surrounded by:
#ifdef CONFIG_X86_32
[...]
#else
The '#else' part does something completely different, as this work is
done in the assembly handler on x86_64.
And yes, this code is executed on i386 (well when I boot my x86_64 into
an i386 kernel it does).
>
> But yes, local_dec_and_test should at least not be more expensive. Even
> better, use this_cpu_dec_return().
Oh! That would make this much better! I'll update the patch set.
Thanks!
-- Steve
next prev parent reply other threads:[~2012-06-08 17:36 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-08 13:52 [PATCH 0/3] [GIT PULL][3.6] x86: cr2 and cmpxchg issues of NMI Steven Rostedt
2012-06-08 13:52 ` [PATCH 1/3] x86: Save cr2 in NMI in case NMIs take a page fault Steven Rostedt
2012-06-08 13:52 ` [PATCH 2/3] x86: Remove cmpxchg from i386 NMI nesting code Steven Rostedt
2012-06-08 16:10 ` H. Peter Anvin
2012-06-08 16:41 ` Steven Rostedt
2012-06-08 17:28 ` H. Peter Anvin
2012-06-08 17:36 ` Steven Rostedt [this message]
2012-06-08 17:39 ` H. Peter Anvin
2012-06-08 17:52 ` Steven Rostedt
2012-06-08 18:04 ` H. Peter Anvin
2012-06-08 18:09 ` Borislav Petkov
2012-06-11 0:25 ` Maciej W. Rozycki
2012-06-11 2:23 ` H. Peter Anvin
2012-06-11 3:14 ` Maciej W. Rozycki
2012-06-11 3:17 ` H. Peter Anvin
2012-06-08 13:52 ` [PATCH 3/3] x86: Save cr2 in NMI in case NMIs take a page fault (for i386) Steven Rostedt
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=1339176975.13377.56.camel@gandalf.stny.rr.com \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
/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
all inboxes | Powered by JetHome®