Re: [PATCH] KVM: Handle MSR_IA32_PERF_CTL

From: Radim KrÄmÃÅ
Date: Fri May 27 2016 - 11:22:39 EST


2016-05-27 09:49+0300, kmeaw@xxxxxxxxxxxxxx:
> 26.05.2016, 23:44, "Gabriel L. Somlo" <gsomlo@xxxxxxxxx>:
>> On Thu, May 26, 2016 at 10:39:31PM +0200, Radim KrÄmÃÅ wrote:
>>> Â2016-05-26 10:32+0300, kmeaw@xxxxxxxxxxxxxx:
>>> Â> This patch implements a dummy handler for MSR_IA32_PERF_CTL to avoid the
>>> Â> crashes. Most notably it fixes an issue with MacOS X 10.10 kernel.
>>> ÂDoes MacOS X write it too?
>>
>> After setting /sys/module/kvm/parameters/ignore_msrs, all I get in
>> dmesg after firing up OS X is:
>>
>> ÂÂÂÂÂÂÂÂvcpu0 ignored rdmsr: 0x199
>>
>> So no, I don't think it would try to write it.
>
> That's right, OS X does not issue an wrmsr to 0x199. More specifically, I have not
> observed that on my KVM instances. Should I remove the "wrmsr" portion from the
> patch?

Yes, please. Silently ignoring the write is worse than #GP and #GP is
not a problem, so I wouldn't bother with a phony implementation.
Returning 0 on read is ok as seems to mean P-state=0, which is within
expectations.

(I wonder why MacOS X doesn't read IA32_PERF_STATUS, though.)