Linux Documentation
 help / color / mirror / Atom feed
From: Yosry Ahmed <yosry@kernel.org>
To: Sean Christopherson <seanjc@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Jonathan Corbet <corbet@lwn.net>,
	 Shuah Khan <skhan@linuxfoundation.org>,
	Thomas Gleixner <tglx@kernel.org>,
	 Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	 Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	 kvm@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org,  Jim Mattson <jmattson@google.com>
Subject: Re: [PATCH v8 0/8] KVM: x86: nSVM: Improve PAT virtualization
Date: Wed, 20 May 2026 20:30:31 +0000	[thread overview]
Message-ID: <ag4ZwD53B7a0ivgT@google.com> (raw)
In-Reply-To: <177915062620.2226127.1264745848157211491.b4-ty@google.com>

On Mon, May 18, 2026 at 05:41:06PM -0700, Sean Christopherson wrote:
> On Tue, 07 Apr 2026 12:03:23 -0700, Jim Mattson wrote:
> > Currently, KVM's implementation of nested SVM treats the PAT MSR the same
> > way whether or not nested NPT is enabled: L1 and L2 share a single
> > PAT. However, the AMD APM specifies that when nested NPT is enabled, the host
> > (L1) and the guest (L2) should have independent PATs: hPAT for L1 and gPAT
> > for L2.
> > 
> > This patch series implements independent PATs for L1 and L2 when nested NPT
> > is enabled, but only when a new quirk, KVM_X86_QUIRK_NESTED_SVM_SHARED_PAT,
> > is disabled. By default, the quirk is enabled, preserving KVM's legacy
> > behavior. When the quirk is disabled, KVM correctly virtualizes a separate
> > PAT register for L2, using the g_pat field in the VMCB.
> > 
> > [...]
> 
> Applied to kvm-x86 svm.  Yosry and/or Jim, please double check the result, the
> goof with patch 5 was slightly more annoying than I was expecting.

The result looks good to me. I also ran the selftest from v7 and it
passes. I couldn't help myself from reworking it and cleaning it up, I
will send a patch your way soon.

> 
> Thanks!
> 
> [1/8] KVM: x86: Define KVM_X86_QUIRK_NESTED_SVM_SHARED_PAT
>       https://github.com/kvm-x86/linux/commit/822790ab0149
> [2/8] KVM: x86: nSVM: Clear VMCB_NPT clean bit when updating hPAT from guest mode
>       https://github.com/kvm-x86/linux/commit/0a8aeb15848e
> [3/8] KVM: x86: nSVM: Cache and validate vmcb12 g_pat
>       https://github.com/kvm-x86/linux/commit/4b83e4ba836e
> [4/8] KVM: x86: nSVM: Set vmcb02.g_pat correctly for nested NPT
>       https://github.com/kvm-x86/linux/commit/02233c73f8ae
> [6/8] KVM: x86: nSVM: Save gPAT to vmcb12.g_pat on VMEXIT
>       https://github.com/kvm-x86/linux/commit/d65cf222b899
> [7/8] KVM: Documentation: document KVM_{GET,SET}_NESTED_STATE for SVM
>       https://github.com/kvm-x86/linux/commit/32ebdbce3b23
> [8/8] KVM: x86: nSVM: Save/restore gPAT with KVM_{GET,SET}_NESTED_STATE
>       https://github.com/kvm-x86/linux/commit/4f256d5770fe
> 
> --
> https://github.com/kvm-x86/linux/tree/next

  reply	other threads:[~2026-05-20 20:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-07 19:03 [PATCH v8 0/8] KVM: x86: nSVM: Improve PAT virtualization Jim Mattson
2026-04-07 19:03 ` [PATCH v8 1/8] KVM: x86: Define KVM_X86_QUIRK_NESTED_SVM_SHARED_PAT Jim Mattson
2026-04-07 19:03 ` [PATCH v8 2/8] KVM: x86: nSVM: Clear VMCB_NPT clean bit when updating hPAT from guest mode Jim Mattson
2026-04-07 19:03 ` [PATCH v8 3/8] KVM: x86: nSVM: Cache and validate vmcb12 g_pat Jim Mattson
2026-04-07 19:03 ` [PATCH v8 4/8] KVM: x86: nSVM: Set vmcb02.g_pat correctly for nested NPT Jim Mattson
2026-04-07 19:03 ` [PATCH] KVM: x86: nSVM: Redirect IA32_PAT accesses to either hPAT or gPAT Jim Mattson
2026-04-07 19:24   ` Sean Christopherson
2026-04-07 20:51     ` Jim Mattson
2026-04-07 23:52       ` Sean Christopherson
2026-04-07 19:03 ` [PATCH v8 6/8] KVM: x86: nSVM: Save gPAT to vmcb12.g_pat on VMEXIT Jim Mattson
2026-04-07 19:03 ` [PATCH v8 7/8] KVM: Documentation: document KVM_{GET,SET}_NESTED_STATE for SVM Jim Mattson
2026-04-07 19:03 ` [PATCH v8 8/8] KVM: x86: nSVM: Save/restore gPAT with KVM_{GET,SET}_NESTED_STATE Jim Mattson
2026-05-19  0:41 ` [PATCH v8 0/8] KVM: x86: nSVM: Improve PAT virtualization Sean Christopherson
2026-05-20 20:30   ` Yosry Ahmed [this message]
2026-05-21  2:36     ` Yosry Ahmed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ag4ZwD53B7a0ivgT@google.com \
    --to=yosry@kernel.org \
    --cc=bp@alien8.de \
    --cc=corbet@lwn.net \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=skhan@linuxfoundation.org \
    --cc=tglx@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox