Re: [PATCH v5 7/7] KVM: x86/mmu: explicitly check nx_hugepage in disallowed_hugepage_adjust()
From: Sean Christopherson
Date: Mon Oct 10 2022 - 12:32:02 EST
On Mon, Oct 10, 2022, Yan Zhao wrote:
> On Fri, Sep 30, 2022 at 11:48:54PM +0000, Sean Christopherson wrote:
> > diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> > index 54005b7f1499..688beed3a41e 100644
> > --- a/arch/x86/kvm/mmu/mmu.c
> > +++ b/arch/x86/kvm/mmu/mmu.c
> > @@ -3110,6 +3110,11 @@ void disallowed_hugepage_adjust(struct kvm_page_fault *fault, u64 spte, int cur_
> > cur_level == fault->goal_level &&
> > is_shadow_present_pte(spte) &&
> > !is_large_pte(spte)) {
> > + u64 page_mask;
> > +
> > + if (!spte_to_child_sp(spte)->nx_huge_page_disallowed)
> > + return;
> Merge this "if" with the upper level "if" ?
Ya, good call. The separate check is no longer necessary now that the superfluous
smp_rmb() is gone. That'll minimize the diff to.