lkml.org 
[lkml]   [2022]   [Aug]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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()

\
 
 \ /
  Last update: 2022-08-09 16:50    [W:1.051 / U:0.288 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site