From: Oleg Nesterov <oleg@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
linux-kernel <linux-kernel@vger.kernel.org>,
mingo@kernel.org
Subject: Re: [RFC][PATCH] perf, intel: Don't touch MSR_IA32_DEBUGCTLMSR from NMI context
Date: Wed, 12 Sep 2012 19:36:24 +0200 [thread overview]
Message-ID: <20120912173624.GA8902@redhat.com> (raw)
In-Reply-To: <1347466967.15764.63.camel@twins>
On 09/12, Peter Zijlstra wrote:
>
> Oleg and Sebastian found that touching MSR_IA32_DEBUGCTLMSR from NMI
> context is problematic since the only way to change the various
> unrelated bits in there is:
>
> debugctl = get_debugctlmsr()
> /* frob flags in debugctl */
> update_debugctlmsr(debugctl);
>
> Which is entirely unsafe if we prod at the MSR from NMI context.
>
> In particular the path that is responsible is:
>
> x86_pmu_handle_irq() (NMI handler)
> x86_pmu_stop()
> x86_pmu.disable -> intel_pmu_disable_event()
> intel_pmu_lbr_disable()
> __intel_pmu_lbr_disable()
> wrmsrl(MSR_IA32_DEBUGCTLMSR,... );
Not only.
x86_pmu_handle_irq() does intel_pmu_disable_all() and intel_pmu_enable_all(),
this leads to intel_pmu_enable_bts() and intel_pmu_disable_bts().
And those intel_pmu_*_bts() are also called by intel_pmu_disable_event()
and intel_pmu_enable_event(), the latter is probably fine.
Oleg.
next prev parent reply other threads:[~2012-09-12 17:34 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-12 16:22 [RFC][PATCH] perf, intel: Don't touch MSR_IA32_DEBUGCTLMSR from NMI context Peter Zijlstra
2012-09-12 16:42 ` Stephane Eranian
2012-09-12 17:37 ` Peter Zijlstra
2012-09-12 17:45 ` Peter Zijlstra
2012-09-12 18:00 ` Stephane Eranian
2012-09-12 18:17 ` Peter Zijlstra
2012-09-12 18:50 ` Stephane Eranian
2012-09-12 18:52 ` Peter Zijlstra
2012-09-12 19:00 ` Stephane Eranian
2012-09-12 17:36 ` Oleg Nesterov [this message]
2012-09-12 17:41 ` Peter Zijlstra
2012-09-13 10:23 ` Peter Zijlstra
2012-09-13 11:49 ` Stephane Eranian
2012-09-13 12:11 ` Peter Zijlstra
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=20120912173624.GA8902@redhat.com \
--to=oleg@redhat.com \
--cc=bigeasy@linutronix.de \
--cc=eranian@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.