From: "Huang, Kai" <kai.huang@intel.com>
To: "pbonzini@redhat.com" <pbonzini@redhat.com>,
"seanjc@google.com" <seanjc@google.com>,
"nikunj@amd.com" <nikunj@amd.com>
Cc: "thomas.lendacky@amd.com" <thomas.lendacky@amd.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"joao.m.martins@oracle.com" <joao.m.martins@oracle.com>,
"santosh.shukla@amd.com" <santosh.shukla@amd.com>,
"bp@alien8.de" <bp@alien8.de>
Subject: Re: [PATCH v5 7/8] KVM: SVM: Add Page modification logging support
Date: Mon, 12 Jan 2026 10:24:10 +0000 [thread overview]
Message-ID: <3d89f9d545d5d8b4558b591201cae19ad4cfb285.camel@intel.com> (raw)
In-Reply-To: <20260105063622.894410-8-nikunj@amd.com>
On Mon, 2026-01-05 at 06:36 +0000, Nikunj A Dadhania wrote:
> Currently, dirty logging relies on write protecting guest memory and
> marking dirty GFNs during subsequent write faults. This method works but
> incurs overhead due to additional write faults for each dirty GFN.
>
> Implement support for the Page Modification Logging (PML) feature, a
> hardware-assisted method for efficient dirty logging. PML automatically
> logs dirty GPA[51:12] to a 4K buffer when the CPU sets NPT D-bits. Two new
> VMCB fields are utilized: PML_ADDR and PML_INDEX. The PML_INDEX is
> initialized to 511 (8 bytes per GPA entry), and the CPU decreases the
> PML_INDEX after logging each GPA. When the PML buffer is full, a
> VMEXIT(PML_FULL) with exit code 0x407 is generated.
>
> Disable PML for nested guests.
>
> PML is enabled by default when supported and can be disabled via the 'pml'
> module parameter.
Nit:
If a new version is needed, use imperative mode:
Add a new module parameter to enable/disable PML, and enable it by
default when supported.
>
> Signed-off-by: Nikunj A Dadhania <nikunj@amd.com>
It's a bit weird for me to review, but I did anyway and it seems fine to
me, so:
Acked-by: Kai Huang <kai.huang@intel.com>
One minor thing below ...
[...]
> @@ -748,12 +748,19 @@ static void nested_vmcb02_prepare_control(struct vcpu_svm *svm,
> V_NMI_BLOCKING_MASK);
> }
>
> - /* Copied from vmcb01. msrpm_base can be overwritten later. */
> + /* Copied from vmcb01. msrpm_base/nested_ctl can be overwritten later. */
> vmcb02->control.nested_ctl = vmcb01->control.nested_ctl;
> vmcb02->control.iopm_base_pa = vmcb01->control.iopm_base_pa;
> vmcb02->control.msrpm_base_pa = vmcb01->control.msrpm_base_pa;
> vmcb_mark_dirty(vmcb02, VMCB_PERM_MAP);
>
> + /* Disable PML for nested guest as the A/D update is emulated by MMU */
This comment isn't accurate to me. I think the key reason is, for L2 if
PML enabled the recorded GPA will be L2's GPA, but not L1's.
Please update the comment if a new version is needed?
> + if (pml) {
> + vmcb02->control.nested_ctl &= ~SVM_NESTED_CTL_PML_ENABLE;
> + vmcb02->control.pml_addr = 0;
> + vmcb02->control.pml_index = -1;
> + }
> +
>
next prev parent reply other threads:[~2026-01-12 10:24 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-05 6:36 [PATCH v5 0/8] KVM: SVM: Add Page Modification Logging (PML) support Nikunj A Dadhania
2026-01-05 6:36 ` [PATCH v5 1/8] KVM: x86: Carve out PML flush routine Nikunj A Dadhania
2026-01-12 10:02 ` Huang, Kai
2026-01-14 13:57 ` Nikunj A. Dadhania
2026-01-05 6:36 ` [PATCH v5 2/8] KVM: x86: Move PML page to common vcpu arch structure Nikunj A Dadhania
2026-01-12 10:07 ` Huang, Kai
2026-01-05 6:36 ` [PATCH v5 3/8] KVM: VMX: Use cpu_dirty_log_size instead of enable_pml for PML checks Nikunj A Dadhania
2026-01-05 6:49 ` Gupta, Pankaj
2026-01-05 6:36 ` [PATCH v5 4/8] KVM: x86: Move nested CPU dirty logging logic to common code Nikunj A Dadhania
2026-01-12 10:08 ` Huang, Kai
2026-01-05 6:36 ` [PATCH v5 5/8] x86/cpufeatures: Add Page modification logging Nikunj A Dadhania
2026-01-05 6:36 ` [PATCH v5 6/8] KVM: SVM: Use BIT_ULL for 64-bit nested_ctl bit definitions Nikunj A Dadhania
2026-01-05 6:36 ` [PATCH v5 7/8] KVM: SVM: Add Page modification logging support Nikunj A Dadhania
2026-01-12 10:24 ` Huang, Kai [this message]
2026-01-14 14:03 ` Nikunj A. Dadhania
2026-01-14 23:10 ` Huang, Kai
2026-01-14 22:48 ` Huang, Kai
2026-01-16 4:12 ` Nikunj A. Dadhania
2026-01-05 6:36 ` [PATCH v5 8/8] selftests: KVM: x86: Add SEV PML dirty logging test Nikunj A Dadhania
2026-01-14 11:36 ` Huang, Kai
2026-01-14 14:27 ` Nikunj A. Dadhania
2026-01-14 22:44 ` Huang, Kai
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=3d89f9d545d5d8b4558b591201cae19ad4cfb285.camel@intel.com \
--to=kai.huang@intel.com \
--cc=bp@alien8.de \
--cc=joao.m.martins@oracle.com \
--cc=kvm@vger.kernel.org \
--cc=nikunj@amd.com \
--cc=pbonzini@redhat.com \
--cc=santosh.shukla@amd.com \
--cc=seanjc@google.com \
--cc=thomas.lendacky@amd.com \
/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