[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aYY9qhsOMv_M9Ray@google.com>
Date: Fri, 6 Feb 2026 11:14:50 -0800
From: Sean Christopherson <seanjc@...gle.com>
To: Yosry Ahmed <yosry.ahmed@...ux.dev>
Cc: Jim Mattson <jmattson@...gle.com>, Paolo Bonzini <pbonzini@...hat.com>,
Thomas Gleixner <tglx@...nel.org>, Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>, Shuah Khan <shuah@...nel.org>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org
Subject: Re: [PATCH v3 3/8] KVM: x86: nSVM: Set vmcb02.g_pat correctly for
nested NPT
On Fri, Feb 06, 2026, Yosry Ahmed wrote:
> February 6, 2026 at 10:23 AM, "Sean Christopherson" <seanjc@...gle.com> wrote:
> > > if (svm->nested.vmcb12_gpa != svm->nested.last_vmcb12_gpa) {
> > > new_vmcb12 = true;
> > > @@ -656,6 +653,19 @@ static void nested_vmcb02_prepare_save(struct vcpu_svm *svm, struct vmcb *vmcb12
> > > svm->nested.force_msr_bitmap_recalc = true;
> > > }
> > >
> > > + if (npt_enabled) {
> > > + if (nested_npt_enabled(svm)) {
> > > + if (unlikely(new_vmcb12 ||
> > > + vmcb_is_dirty(vmcb12, VMCB_NPT))) {
> > > + vmcb02->save.g_pat = svm->nested.gpat;
> > > + vmcb_mark_dirty(vmcb02, VMCB_NPT);
> > > + }
> > > + } else {
> > > + vmcb02->save.g_pat = vcpu->arch.pat;
> > > + vmcb_mark_dirty(vmcb02, VMCB_NPT);
> > > + }
> > > + }
> > >
> > To reduce indentation, how about this? There's a consistency check for
> > nested_npt_enabled() vs. npt_enabled, so it's guaranteed to do the right thing.
>
> You mean the one that goes away after this patch: https://lore.kernel.org/kvm/20260115011312.3675857-16-yosry.ahmed@linux.dev/?
Heh, still fine. All that matters is that nested_npt_enabled() can't be %true
if npt_enabled is %false.
Powered by blists - more mailing lists