From: "H. Peter Anvin" <hpa@zytor.com>
To: Gleb Natapov <gleb@kernel.org>, Peter Wu <peter@lekensteyn.nl>
Cc: Venkatesh Srinivas <venkateshs@google.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>, Andi Kleen <ak@linux.intel.com>,
Linux Kernel Developers List <linux-kernel@vger.kernel.org>,
kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: GPF in intel_pmu_lbr_reset() with qemu -cpu host
Date: Sat, 22 Mar 2014 14:46:49 -0700 [thread overview]
Message-ID: <19dca85e-1557-4696-aaf1-89222ef70cfc@email.android.com> (raw)
In-Reply-To: <20140322122758.GA4292@minantech.com>
Using _safe has it's own issues if noone checks the errors.
On March 22, 2014 5:27:59 AM PDT, Gleb Natapov <gleb@kernel.org> wrote:
>On Sat, Mar 22, 2014 at 11:05:03AM +0100, Peter Wu wrote:
>> On Saturday 22 March 2014 10:50:45 Gleb Natapov wrote:
>> > On Fri, Mar 21, 2014 at 12:04:32PM -0700, Venkatesh Srinivas wrote:
>> > > On Fri, Mar 21, 2014 at 10:46 AM, Peter Wu <peter@lekensteyn.nl>
>wrote:
>> > [skip]
>> >
>> > > When -cpu host is used, qemu/kvm passed the host CPUID F/M/S to
>the
>> > > guest. intel_pmu_cpu_*() -> intel_pmu_lbr_reset() uses rdmsr() /
>> > > wrmsr(), rather than the safe variants; if KVM does not support
>the
>> > > particular MSRs in question, you will see a #GP(0) there. See
>> > > https://lkml.org/lkml/2014/3/13/453 for a similar bug other PMU
>code.
>> > >
>> > When kernel is compiled with guest support all rdmsr()/wrmsr()
>become _safe(),
>> > so the question for Peter is if his guest kernel has guest support
>enabled?
>>
>> Linux guest support (CONFIG_HYPERVISOR_GUEST) was not enabled, see
>> .config in the first mail[1]. Enabling that option does not change
>the
>> situation.
>>
>> With CONFIG_PARAVIRT and CONFIG_KVM_GUEST enabled, the PMU GPF is
>gone,
>Yeah, it should be PARAVIRT indeed since rdmsr()/wrmsr() is substituted
>by _safe()
>using paravirt calls.
>
>> but now I have a NULL dereference (in rapl_pmu_init). Previously,
>when
>> `-cpu SandyBridge` was passed to qemu, it would show this:
>>
>> [ 0.016995] Performance Events: unsupported p6 CPU model 42 no
>PMU driver, software events only.
>>
>> The same NULL pointer deref would be visible (slightly different
>> addresses, but the Code lines are equal). With `-host`, the NULL
>deref
>> with `-cpu host` contains:
>>
>> [ 0.016445] Performance Events: 16-deep LBR, IvyBridge events,
>Intel PMU driver.
>>
>> Full dmesg below.
>>
>I am confused. Do you see crash now with -cpu SandyBridge and -cpu
>host, or -cpu host only?
>
>--
> Gleb.
--
Sent from my mobile phone. Please pardon brevity and lack of formatting.
next prev parent reply other threads:[~2014-03-22 21:48 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-21 17:42 Peter Wu
2014-03-21 17:46 ` Peter Wu
2014-03-21 19:04 ` Venkatesh Srinivas
2014-03-21 19:09 ` H. Peter Anvin
2014-03-22 7:54 ` Paolo Bonzini
2014-03-22 8:50 ` Gleb Natapov
2014-03-22 10:05 ` Peter Wu
2014-03-22 12:27 ` Gleb Natapov
2014-03-22 21:46 ` H. Peter Anvin [this message]
2014-03-22 22:00 ` Peter Wu
2014-03-26 7:23 ` Wu, Feng
2014-03-26 9:38 ` Paolo Bonzini
2014-03-21 19:29 ` Andi Kleen
2014-03-21 20:46 ` H. Peter Anvin
2014-03-21 21:37 ` Andi Kleen
2014-03-21 21:41 ` H. Peter Anvin
2014-03-21 21:48 ` Andi Kleen
2014-03-21 21:55 ` H. Peter Anvin
2014-03-22 0:22 ` Andi Kleen
2014-03-22 0:26 ` H. Peter Anvin
2014-03-22 0:30 ` Andi Kleen
2014-03-22 0:34 ` H. Peter Anvin
2014-03-22 10:01 ` Borislav Petkov
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=19dca85e-1557-4696-aaf1-89222ef70cfc@email.android.com \
--to=hpa@zytor.com \
--cc=ak@linux.intel.com \
--cc=gleb@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=pbonzini@redhat.com \
--cc=peter@lekensteyn.nl \
--cc=peterz@infradead.org \
--cc=venkateshs@google.com \
/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®