[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YvJ0EpvDhc00NTSx@google.com>
Date: Tue, 9 Aug 2022 14:49:54 +0000
From: Sean Christopherson <seanjc@...gle.com>
To: Paolo Bonzini <pbonzini@...hat.com>
Cc: kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
David Matlack <dmatlack@...gle.com>,
Yan Zhao <yan.y.zhao@...el.com>,
Mingwei Zhang <mizhang@...gle.com>,
Ben Gardon <bgardon@...gle.com>
Subject: Re: [PATCH v3 8/8] KVM: x86/mmu: explicitly check nx_hugepage in
disallowed_hugepage_adjust()
On Tue, Aug 09, 2022, Paolo Bonzini wrote:
> On 8/6/22 01:05, Sean Christopherson wrote:
> > !is_large_pte(spte)) {
> > + u64 page_mask;
> > +
> > + /*
> > + * Ensure nx_huge_page_disallowed is read after checking for a
> > + * present shadow page. A different vCPU may be concurrently
> > + * installing the shadow page if mmu_lock is held for read.
> > + * Pairs with the smp_wmb() in kvm_tdp_mmu_map().
> > + */
> > + smp_rmb();
> > +
> > + if (!spte_to_child_sp(spte)->nx_huge_page_disallowed)
> > + return;
> > +
>
> I wonder if the barrier shouldn't be simply in to_shadow_page(), i.e. always
> assume in the TDP MMU code that sp->xyz is read after the SPTE that points
> to that struct kvm_mmu_page.
If we can get away with it, I'd prefer to rely on the READ_ONCE() in
kvm_tdp_mmu_read_spte() and required ordering of:
READ_ONCE() => PRESENT => spte_to_child_sp()
Powered by blists - more mailing lists