[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yh/1hPMhqeFKO0ih@google.com>
Date: Wed, 2 Mar 2022 22:53:56 +0000
From: Sean Christopherson <seanjc@...gle.com>
To: Paolo Bonzini <pbonzini@...hat.com>
Cc: Christian Borntraeger <borntraeger@...ux.ibm.com>,
Janosch Frank <frankja@...ux.ibm.com>,
David Hildenbrand <david@...hat.com>,
Claudio Imbrenda <imbrenda@...ux.ibm.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, Ben Gardon <bgardon@...gle.com>,
Lai Jiangshan <jiangshanlai@...il.com>
Subject: Re: [PATCH v2 4/7] KVM: x86/mmu: Zap only obsolete roots if a root
shadow page is zapped
On Wed, Mar 02, 2022, Paolo Bonzini wrote:
> On 3/2/22 20:45, Sean Christopherson wrote:
> > AMD NPT is hosed because KVM's awful ASID scheme doesn't assign an ASID per root
> > and doesn't force a new ASID. IMO, this is an SVM mess and not a TDP MMU bug.
>
> I agree.
>
> > In the short term, I think something like the following would suffice. Long term,
> > we really need to redo SVM ASID management so that ASIDs are tied to a KVM root.
>
>
> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> index c5e3f219803e..7899ca4748c7 100644
> --- a/arch/x86/kvm/svm/svm.c
> +++ b/arch/x86/kvm/svm/svm.c
> @@ -3857,6 +3857,9 @@ static void svm_load_mmu_pgd(struct kvm_vcpu *vcpu,
> hpa_t root_hpa,
> unsigned long cr3;
>
> if (npt_enabled) {
> + if (is_tdp_mmu_root(root_hpa))
> + svm->current_vmcb->asid_generation = 0;
> +
> svm->vmcb->control.nested_cr3 = __sme_set(root_hpa);
> vmcb_mark_dirty(svm->vmcb, VMCB_NPT);
>
> Why not just new_asid
My mental coin flip came up tails? new_asid() is definitely more intuitive.
> (even unconditionally, who cares)?
Heh, I was going to say we do care to some extent for nested transitions, then
I remembered we flush on every nested transition anyways, in no small part because
the ASID handling is a mess.
Powered by blists - more mailing lists