Re: [PATCH 1/2] KVM: X86: Move ignore_msrs handling upper the stack

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 26/06/20 20:18, Sean Christopherson wrote:
>> Btw, would it be more staightforward to check "vcpu->arch.arch_capabilities &
>> ARCH_CAP_TSX_CTRL_MSR" rather than "*ebx | (F(RTM) | F(HLE))" even if we want
>> to have such a fix?
> Not really, That ends up duplicating the check in vmx_get_msr().  From an
> emulation perspective, this really is a "guest" access to the MSR, in the
> sense that it the virtual CPU is in the guest domain, i.e. not a god-like
> entity that gets to break the rules of emulation.

But if you wrote a guest that wants to read MSR_IA32_TSX_CTRL, there are
two choices:

1) check ARCH_CAPABILITIES first

2) blindly access it and default to 0.

Both are fine, because we know MSR_IA32_TSX_CTRL has no
reserved/must-be-one bits.  Calling __kvm_get_msr and checking for an
invalid MSR through the return value is not breaking the rules of
emulation, it is "faking" a #GP handler.

So I think Peter's patch is fine, but (possibly on top as a third patch)
__must_check should be added to MSR getters and setters.  Also one
possibility is to return -EINVAL for invalid MSRs.

Paolo




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux