Re: [PATCH] KVM: x86: Keep masked bits unmodified on kvm_set_shared_msr

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

 



On Aug 21, 2014, at 2:56 PM, Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote:

> Il 21/08/2014 10:05, Wanpeng Li ha scritto:
>> Hi Nadav,
>> On Wed, Aug 20, 2014 at 03:11:51PM +0300, Nadav Amit wrote:
>>> Currently, when an msr is updated using kvm_set_shared_msr the masked bits are
>>> zeroed.  This behavior is currently valid since the only MSR with partial mask
>> 
>> Why zeroed? vmx_vcpu_setup() set all mask to -1ull.
> 
> He meant they are passed as zero in the WRMSR but actually they're not
> zeroed.  They're set to the value that is passed to kvm_set_shared_msr,
> and this value is massaged elsewhere to do mix guest and host bugs.  See
> update_transition_efer.
> 
> So I'm removing this patch, it's wrong.

I stand corrected - they are massaged in update_transition_efer.

The question is whether this massaging is specific to EFER, or a general one.
Currently update_transition_efer does:

        guest_efer &= ~ignore_bits;
        guest_efer |= host_efer & ignore_bits;
	vmx->guest_msrs[efer_offset].data = guest_efer;

I think this is a general behaviour - taking the masked bits from the host, and the rest from the guest. Therefore, it makes sense to put this logic into kvm_set_shared_msr.
I understand the EFER is currently the only MSR which is only partially masked. Nonetheless, kvm_set_shared_msr can be useful for other purposes.

Nadav

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail


[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