lkml.org 
[lkml]   [2022]   [Feb]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v2 13/18] KVM: x86: reset and reinitialize the MMU in __set_sregs_common
    On Thu, Feb 17, 2022, Paolo Bonzini wrote:
    > Do a full unload of the MMU in KVM_SET_SREGS and KVM_SEST_REGS2, in
    > preparation for not doing so in kvm_mmu_reset_context. There is no
    > need to delay the reset until after the return, so do it directly in
    > the __set_sregs_common function and remove the mmu_reset_needed output
    > parameter.
    >
    > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    > ---

    Reviewed-by: Sean Christopherson <seanjc@google.com>

    > + kvm_init_mmu(vcpu);
    > if (update_pdptrs) {
    > idx = srcu_read_lock(&vcpu->kvm->srcu);
    > - if (is_pae_paging(vcpu)) {
    > + if (is_pae_paging(vcpu))
    > load_pdptrs(vcpu, kvm_read_cr3(vcpu));
    > - *mmu_reset_needed = 1;

    Eww (not your code, just this whole pile). It might be worth calling out in the
    changelog that calling kvm_init_mmu() before load_pdptrs() will (subtly) _not_
    impact the functionality of load_pdptrs(). If the MMU is nested, kvm_init_mmu()
    will modify vcpu->arch.nested_mmu, whereas kvm_translate_gpa() will walk
    vcpu->arch.guest_mmu. And if the MMU is not nested, kvm_translate_gpa() will not
    consuming vcpu->arch.mmu other than to check if it's == &guest_mmu.

    > - }
    > srcu_read_unlock(&vcpu->kvm->srcu, idx);
    > }
    >

    \
     
     \ /
      Last update: 2022-02-19 01:25    [W:4.179 / U:0.196 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site