• Sean Christopherson's avatar
    KVM: VMX: Use flag to indicate "active" uret MSRs instead of sorting list · ee9d22e0
    Sean Christopherson authored
    Explicitly flag a uret MSR as needing to be loaded into hardware instead of
    resorting the list of "active" MSRs and tracking how many MSRs in total
    need to be loaded.  The only benefit to sorting the list is that the loop
    to load MSRs during vmx_prepare_switch_to_guest() doesn't need to iterate
    over all supported uret MRS, only those that are active.  But that is a
    pointless optimization, as the most common case, running a 64-bit guest,
    will load the vast majority of MSRs.  Not to mention that a single WRMSR is
    far more expensive than iterating over the list.
    
    Providing a stable list order obviates the need to track a given MSR's
    "slot" in the per-CPU list of user return MSRs; all lists simply use the
    same ordering.  Future patches will take advantage of the stable order to
    further simplify the related code.
    Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
    Message-Id: <20210504171734.1434054-10-seanjc@google.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    ee9d22e0
vmx.c 227 KB