Re: [PATCH] KVM: VMX: use same MSR bitmaps for 32-/64-bit modes, fix MSR bitmaps for processor tracing

From: Paolo Bonzini
Date: Tue Jan 09 2018 - 04:36:00 EST


On 05/01/2018 16:43, Paolo Bonzini wrote:
> KVM has a small optimization where it doesn't save/restore
> MSR_KERNEL_GS_BASE if the guest is in 32-bit mode. However,
> this complicates the code noticeably by doubling the number of
> possible MSR bitmaps. In addition, pt_disable_intercept_for_msr
> was only updating the "basic" MSR bitmap, because x2apic and
> x2apic_apicv are memcpy'd just once in hardware_setup.
>
> Remove the long-mode bitmaps set, and touch all the three remaining
> bitmaps in vmx_disable_intercept_for_msr and vmx_enable_intercept_for_msr.
>
> Fixes: 3bd1f85e893daec4f3982d1d45b6bfc0683442c4
> Cc: Luwei Kang <luwei.kang@xxxxxxxxx>
> Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
> ---
> arch/x86/kvm/vmx.c | 126 ++++++++++++++++++++---------------------------------
> 1 file changed, 48 insertions(+), 78 deletions(-)

Scratch it, this patch is wrong. You cannot change the MSR bitmaps,
they are shared across all VCPUs.

Paolo