kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Write to read-only msr MSR_IA32_PERF_STATUS is harmless, ignore it!
@ 2010-08-31 12:17 Jes.Sorensen
  2010-08-31 16:28 ` Avi Kivity
  0 siblings, 1 reply; 9+ messages in thread
From: Jes.Sorensen @ 2010-08-31 12:17 UTC (permalink / raw)
  To: kvm; +Cc: avi

From: Jes Sorensen <Jes.Sorensen@redhat.com>

We regularly see bug reports over this one, however it is a write to
a read-only register which some operating systems (including Linux)
tend to write to once in a while.

Ignore the writes since they do no harm.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 arch/x86/kvm/x86.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 4014d6c..2e1ae7f 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1439,6 +1439,12 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data)
 		pr_unimpl(vcpu, "unimplemented perfctr wrmsr: "
 			"0x%x data 0x%llx\n", msr, data);
 		break;
+	case MSR_IA32_PERF_STATUS:
+		/*
+		 * Write to read-only register, has no effect, so
+		 * lets not bother users with a warning about this.
+		 */
+		break;
 	case HV_X64_MSR_GUEST_OS_ID ... HV_X64_MSR_SINT15:
 		if (kvm_hv_msr_partition_wide(msr)) {
 			int r;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] Write to read-only msr MSR_IA32_PERF_STATUS is harmless, ignore it!
  2010-08-31 12:17 [PATCH] Write to read-only msr MSR_IA32_PERF_STATUS is harmless, ignore it! Jes.Sorensen
@ 2010-08-31 16:28 ` Avi Kivity
  2010-08-31 16:33   ` Jes Sorensen
  0 siblings, 1 reply; 9+ messages in thread
From: Avi Kivity @ 2010-08-31 16:28 UTC (permalink / raw)
  To: Jes.Sorensen; +Cc: kvm

  On 08/31/2010 03:17 PM, Jes.Sorensen@redhat.com wrote:
> From: Jes Sorensen<Jes.Sorensen@redhat.com>
>
> We regularly see bug reports over this one, however it is a write to
> a read-only register which some operating systems (including Linux)
> tend to write to once in a while.
>
> Ignore the writes since they do no harm.
>

Does Linux write it with wrmsr_safe()?  If not, I don't see how it 
works.  If it does, then we shouldn't ignore the write, instead issue 
the #GP as usual, but be silent about it.

-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Write to read-only msr MSR_IA32_PERF_STATUS is harmless, ignore it!
  2010-08-31 16:28 ` Avi Kivity
@ 2010-08-31 16:33   ` Jes Sorensen
  2010-08-31 16:44     ` Avi Kivity
  2010-08-31 20:02     ` Marcelo Tosatti
  0 siblings, 2 replies; 9+ messages in thread
From: Jes Sorensen @ 2010-08-31 16:33 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm

On 08/31/10 18:28, Avi Kivity wrote:
>  On 08/31/2010 03:17 PM, Jes.Sorensen@redhat.com wrote:
>> From: Jes Sorensen<Jes.Sorensen@redhat.com>
>>
>> We regularly see bug reports over this one, however it is a write to
>> a read-only register which some operating systems (including Linux)
>> tend to write to once in a while.
>>
>> Ignore the writes since they do no harm.
>>
> 
> Does Linux write it with wrmsr_safe()?  If not, I don't see how it
> works.  If it does, then we shouldn't ignore the write, instead issue
> the #GP as usual, but be silent about it.

To be honest, I am having a hard time determining where the write
happens. I looked at this with Gleb and the rip obtained by
kvm_read_rip(vcpu) in the code doesn't indicate anything that resembles
a wrmsr().

It was either a
560					outb(0xfe, 0x64); /* pulse reset low */
or
49		asm volatile("sti; hlt": : :"memory");

which makes no sense to me, but given it's x86, I am not sure if it
could have come from the BIOS or something during reboot?

Jes

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Write to read-only msr MSR_IA32_PERF_STATUS is harmless, ignore it!
  2010-08-31 16:33   ` Jes Sorensen
@ 2010-08-31 16:44     ` Avi Kivity
  2010-08-31 17:04       ` Jes Sorensen
  2010-08-31 20:02     ` Marcelo Tosatti
  1 sibling, 1 reply; 9+ messages in thread
From: Avi Kivity @ 2010-08-31 16:44 UTC (permalink / raw)
  To: Jes Sorensen; +Cc: kvm

  On 08/31/2010 07:33 PM, Jes Sorensen wrote:
> On 08/31/10 18:28, Avi Kivity wrote:
>>   On 08/31/2010 03:17 PM, Jes.Sorensen@redhat.com wrote:
>>> From: Jes Sorensen<Jes.Sorensen@redhat.com>
>>>
>>> We regularly see bug reports over this one, however it is a write to
>>> a read-only register which some operating systems (including Linux)
>>> tend to write to once in a while.
>>>
>>> Ignore the writes since they do no harm.
>>>
>> Does Linux write it with wrmsr_safe()?  If not, I don't see how it
>> works.  If it does, then we shouldn't ignore the write, instead issue
>> the #GP as usual, but be silent about it.
> To be honest, I am having a hard time determining where the write
> happens. I looked at this with Gleb and the rip obtained by
> kvm_read_rip(vcpu) in the code doesn't indicate anything that resembles
> a wrmsr().
>
> It was either a
> 560					outb(0xfe, 0x64); /* pulse reset low */
> or
> 49		asm volatile("sti; hlt": : :"memory");
>
> which makes no sense to me,

Just grep for the msr name in a guest kernel source that's known to 
trigger the message.

>   but given it's x86, I am not sure if it
> could have come from the BIOS or something during reboot?

The bios is the same for all kernels (and is unlikely to mess with 
performance counter msrs anyway).


-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Write to read-only msr MSR_IA32_PERF_STATUS is harmless, ignore it!
  2010-08-31 16:44     ` Avi Kivity
@ 2010-08-31 17:04       ` Jes Sorensen
  2010-08-31 20:00         ` David S. Ahern
  0 siblings, 1 reply; 9+ messages in thread
From: Jes Sorensen @ 2010-08-31 17:04 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm

On 08/31/10 18:44, Avi Kivity wrote:
>  On 08/31/2010 07:33 PM, Jes Sorensen wrote:
>> On 08/31/10 18:28, Avi Kivity wrote:
>>>   On 08/31/2010 03:17 PM, Jes.Sorensen@redhat.com wrote:
>>>> From: Jes Sorensen<Jes.Sorensen@redhat.com>
>>>>
>>>> We regularly see bug reports over this one, however it is a write to
>>>> a read-only register which some operating systems (including Linux)
>>>> tend to write to once in a while.
>>>>
>>>> Ignore the writes since they do no harm.
>>>>
>>> Does Linux write it with wrmsr_safe()?  If not, I don't see how it
>>> works.  If it does, then we shouldn't ignore the write, instead issue
>>> the #GP as usual, but be silent about it.
>> To be honest, I am having a hard time determining where the write
>> happens. I looked at this with Gleb and the rip obtained by
>> kvm_read_rip(vcpu) in the code doesn't indicate anything that resembles
>> a wrmsr().
>>
>> It was either a
>> 560                    outb(0xfe, 0x64); /* pulse reset low */
>> or
>> 49        asm volatile("sti; hlt": : :"memory");
>>
>> which makes no sense to me,
> 
> Just grep for the msr name in a guest kernel source that's known to
> trigger the message.

Been there, done that! This happens with an F13 kernel during reboot.
Ran the search on the expanded 2.6.32.8-149 tree and found no reference
to anything trying to write it, except for KVM backing up the flag, but
that shouldn't happen in the guest.

>>   but given it's x86, I am not sure if it
>> could have come from the BIOS or something during reboot?
> 
> The bios is the same for all kernels (and is unlikely to mess with
> performance counter msrs anyway).

I was fooled by this too, it's not a performance counter MSR, it's a CPU
frequency scaling MSR.

Cheers,
Jes

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Write to read-only msr MSR_IA32_PERF_STATUS is harmless, ignore it!
  2010-08-31 17:04       ` Jes Sorensen
@ 2010-08-31 20:00         ` David S. Ahern
  0 siblings, 0 replies; 9+ messages in thread
From: David S. Ahern @ 2010-08-31 20:00 UTC (permalink / raw)
  To: Jes Sorensen; +Cc: Avi Kivity, kvm



On 08/31/10 11:04, Jes Sorensen wrote:
>> Just grep for the msr name in a guest kernel source that's known to
>> trigger the message.
> 
> Been there, done that! This happens with an F13 kernel during reboot.
> Ran the search on the expanded 2.6.32.8-149 tree and found no reference
> to anything trying to write it, except for KVM backing up the flag, but
> that shouldn't happen in the guest.

I've been seeing the messages with a 32-bit Fedora 10 guest running a
2.6.27 variant. The wrmsr messages are generated by the time the grub
menu appears. ie., pre-OS.

David


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Write to read-only msr MSR_IA32_PERF_STATUS is harmless, ignore it!
  2010-08-31 16:33   ` Jes Sorensen
  2010-08-31 16:44     ` Avi Kivity
@ 2010-08-31 20:02     ` Marcelo Tosatti
  2010-09-01  7:37       ` Avi Kivity
  2010-09-01  8:42       ` Jes Sorensen
  1 sibling, 2 replies; 9+ messages in thread
From: Marcelo Tosatti @ 2010-08-31 20:02 UTC (permalink / raw)
  To: Jes Sorensen; +Cc: Avi Kivity, kvm

On Tue, Aug 31, 2010 at 06:33:34PM +0200, Jes Sorensen wrote:
> On 08/31/10 18:28, Avi Kivity wrote:
> >  On 08/31/2010 03:17 PM, Jes.Sorensen@redhat.com wrote:
> >> From: Jes Sorensen<Jes.Sorensen@redhat.com>
> >>
> >> We regularly see bug reports over this one, however it is a write to
> >> a read-only register which some operating systems (including Linux)
> >> tend to write to once in a while.
> >>
> >> Ignore the writes since they do no harm.
> >>
> > 
> > Does Linux write it with wrmsr_safe()?  If not, I don't see how it
> > works.  If it does, then we shouldn't ignore the write, instead issue
> > the #GP as usual, but be silent about it.
> 
> To be honest, I am having a hard time determining where the write
> happens. I looked at this with Gleb and the rip obtained by
> kvm_read_rip(vcpu) in the code doesn't indicate anything that resembles
> a wrmsr().
> 
> It was either a
> 560					outb(0xfe, 0x64); /* pulse reset low */
> or
> 49		asm volatile("sti; hlt": : :"memory");
> 
> which makes no sense to me, but given it's x86, I am not sure if it
> could have come from the BIOS or something during reboot?
> 
> Jes

kvm_reset_msrs in qemu-kvm-x86.c.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Write to read-only msr MSR_IA32_PERF_STATUS is harmless, ignore it!
  2010-08-31 20:02     ` Marcelo Tosatti
@ 2010-09-01  7:37       ` Avi Kivity
  2010-09-01  8:42       ` Jes Sorensen
  1 sibling, 0 replies; 9+ messages in thread
From: Avi Kivity @ 2010-09-01  7:37 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: Jes Sorensen, kvm

  On 08/31/2010 11:02 PM, Marcelo Tosatti wrote:
>
> kvm_reset_msrs in qemu-kvm-x86.c.

I posted a patch to fix this.

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Write to read-only msr MSR_IA32_PERF_STATUS is harmless, ignore it!
  2010-08-31 20:02     ` Marcelo Tosatti
  2010-09-01  7:37       ` Avi Kivity
@ 2010-09-01  8:42       ` Jes Sorensen
  1 sibling, 0 replies; 9+ messages in thread
From: Jes Sorensen @ 2010-09-01  8:42 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: Avi Kivity, kvm

On 08/31/10 22:02, Marcelo Tosatti wrote:
> On Tue, Aug 31, 2010 at 06:33:34PM +0200, Jes Sorensen wrote:
>> which makes no sense to me, but given it's x86, I am not sure if it
>> could have come from the BIOS or something during reboot?
> 
> kvm_reset_msrs in qemu-kvm-x86.c.

Interesting, I hadn't thought KVM would be able to cause itself to trap
writes like this. Avi's patch looks good though :)

Cheers,
Jes

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-09-01  8:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-31 12:17 [PATCH] Write to read-only msr MSR_IA32_PERF_STATUS is harmless, ignore it! Jes.Sorensen
2010-08-31 16:28 ` Avi Kivity
2010-08-31 16:33   ` Jes Sorensen
2010-08-31 16:44     ` Avi Kivity
2010-08-31 17:04       ` Jes Sorensen
2010-08-31 20:00         ` David S. Ahern
2010-08-31 20:02     ` Marcelo Tosatti
2010-09-01  7:37       ` Avi Kivity
2010-09-01  8:42       ` Jes Sorensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).