lkml.org 
[lkml]   [2021]   [Apr]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    Subject[PATCH 2/4] KVM: nSVM: Drop pointless pdptrs_changed() check on nested transition
    From
    Remove the "PDPTRs unchanged" check to skip PDPTR loading during nested
    SVM transitions as it's not at all an optimization. Reading guest memory
    to get the PDPTRs isn't magically cheaper by doing it in pdptrs_changed(),
    and if the PDPTRs did change, KVM will end up doing the read twice.

    Signed-off-by: Sean Christopherson <seanjc@google.com>
    ---
    arch/x86/kvm/svm/nested.c | 6 ++----
    1 file changed, 2 insertions(+), 4 deletions(-)

    diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
    index 540d43ba2cf4..9cc95895866a 100644
    --- a/arch/x86/kvm/svm/nested.c
    +++ b/arch/x86/kvm/svm/nested.c
    @@ -391,10 +391,8 @@ static int nested_svm_load_cr3(struct kvm_vcpu *vcpu, unsigned long cr3,
    return -EINVAL;

    if (!nested_npt && is_pae_paging(vcpu) &&
    - (cr3 != kvm_read_cr3(vcpu) || pdptrs_changed(vcpu))) {
    - if (CC(!load_pdptrs(vcpu, vcpu->arch.walk_mmu, cr3)))
    - return -EINVAL;
    - }
    + CC(!load_pdptrs(vcpu, vcpu->arch.walk_mmu, cr3)))
    + return -EINVAL;

    /*
    * TODO: optimize unconditional TLB flush/MMU sync here and in
    --
    2.31.1.498.g6c1eba8ee3d-goog
    \
     
     \ /
      Last update: 2021-04-23 02:07    [W:35.160 / U:0.212 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site