• Vitaly Kuznetsov's avatar
    KVM: x86: VMX: hyper-v: Enlightened MSR-Bitmap support · ceef7d10
    Vitaly Kuznetsov authored
    Enlightened MSR-Bitmap is a natural extension of Enlightened VMCS:
    Hyper-V Top Level Functional Specification states:
    
    "The L1 hypervisor may collaborate with the L0 hypervisor to make MSR
    accesses more efficient. It can enable enlightened MSR bitmaps by setting
    the corresponding field in the enlightened VMCS to 1. When enabled, the L0
    hypervisor does not monitor the MSR bitmaps for changes. Instead, the L1
    hypervisor must invalidate the corresponding clean field after making
    changes to one of the MSR bitmaps."
    
    I reached out to Hyper-V team for additional details and I got the
    following information:
    
    "Current Hyper-V implementation works as following:
    
    If the enlightened MSR bitmap is not enabled:
    - All MSR accesses of L2 guests cause physical VM-Exits
    
    If the enlightened MSR bitmap is enabled:
    - Physical VM-Exits for L2 accesses to certain MSRs (currently FS_BASE,
      GS_BASE and KERNEL_GS_BASE) are avoided, thus making these MSR accesses
      faster."
    
    I tested my series with a tight rdmsrl loop in L2, for KERNEL_GS_BASE the
    results are:
    
    Without Enlightened MSR-Bitmap: 1300 cycles/read
    With Enlightened MSR-Bitmap: 120 cycles/read
    Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
    Tested-by: default avatarLan Tianyu <Tianyu.Lan@microsoft.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    ceef7d10
hyperv-tlfs.h 20.3 KB