From: sashiko-bot@kernel.org
To: "Nikunj A Dadhania" <nikunj@amd.com>, kvm@vger.kernel.org
Subject: Re: [RFC PATCH 4/5] KVM: selftests: nVMX: Add nested PML coverage to nested_dirty_log_test
Date: Thu, 15 Oct 2026 11:04:27 +0000 [thread overview]
Message-ID: <sashiko-outbox-172712@kernel.org> (raw)
In-Reply-To: <20261015103933.2088307-5-nikunj@amd.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] selftests: kvm: nVMX test asserts on invalid guest PML index
--
commit 88c8168ec493a327cfe182178b11f281733406e7
Author: Nikunj A Dadhania <nikunj@amd.com>
KVM: selftests: nVMX: Add nested PML coverage to nested_dirty_log_test
This patch adds coverage for nested PML to nested_dirty_log_test. It
verifies that L1 takes a PML_FULL exit when the buffer fills, can drain it,
and can resume L2 without losing entries.
> diff --git a/tools/testing/selftests/kvm/x86/nested_dirty_log_test.c b/tools/testing/selftests/kvm/x86/nested_dirty_log_test.c
> index 7e5f9ae1cb00a..b1008724f46dc 100644
> --- a/tools/testing/selftests/kvm/x86/nested_dirty_log_test.c
> +++ b/tools/testing/selftests/kvm/x86/nested_dirty_log_test.c
[ ... ]
> @@ -192,6 +192,149 @@ static void test_handle_ucall_sync(struct kvm_vm *vm, u64 arg,
> }
> }
>
> +#define PML_LOG_NR_ENTRIES 512
> +#define PML_HEAD_INDEX (PML_LOG_NR_ENTRIES - 1)
> +
> +#define PML_FULL_MAX_EXITS 64
[ ... ]
> +static void l1_pml_vmx_code(struct vmx_pages *vmx)
> +{
> + int nr_pml_full = 0;
> +
> + GUEST_ASSERT(vmx->vmcs_gpa);
> + prepare_for_vmx_operation(vmx);
> + load_vmcs(vmx);
> +
> + /* PML requires EPT. */
> + GUEST_ASSERT(vmx->eptp_gpa);
> +
> + prepare_vmcs(vmx, l2_pml_guest_code);
> +
> + vmwrite(PML_ADDRESS, vmx->pml_gpa);
> + vmwrite(GUEST_PML_INDEX, PML_LOG_NR_ENTRIES);
> + vmwrite(SECONDARY_VM_EXEC_CONTROL,
> + vmread(SECONDARY_VM_EXEC_CONTROL) | SECONDARY_EXEC_ENABLE_PML);
> +
> + vmlaunch();
> +
> + for (;;) {
> + u64 reason = vmread(VM_EXIT_REASON);
> +
> + if (reason == EXIT_REASON_VMCALL)
> + break;
> +
> + GUEST_ASSERT_EQ(reason, EXIT_REASON_PML_FULL);
[Severity: Medium]
Since the test intentionally sets GUEST_PML_INDEX to 512, shouldn't this
result in a VM-entry failure instead of a successful entry followed by a
PML_FULL exit?
According to the Intel SDM (Volume 3C, Section 26.3.1.5 "Checks on Guest
Non-Register State"), the guest PML index must be less than 512 when PML
is enabled.
Does this assertion rely on KVM improperly omitting the guest state check?
If KVM is updated in the future to correctly emulate the architecturally
mandated check and fail the VM-entry, will this assertion break the test
suite?
> + GUEST_ASSERT(++nr_pml_full < PML_FULL_MAX_EXITS);
> +
> + vmwrite(GUEST_PML_INDEX, PML_HEAD_INDEX);
> + vmresume();
> + }
> +
> + GUEST_SYNC_ARGS(vmread(GUEST_PML_INDEX), nr_pml_full, 0, 0, 0);
> + GUEST_DONE();
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261015103933.2088307-1-nikunj@amd.com?part=4
next prev parent reply other threads:[~2026-10-15 11:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 10:39 [RFC PATCH 0/5] KVM: nSVM: Emulate Page Modification Logging Nikunj A Dadhania
2026-10-15 10:39 ` [RFC PATCH 1/5] KVM: x86/mmu: Log dirty GPAs only for the nested GPA walk Nikunj A Dadhania
2026-10-15 10:55 ` sashiko-bot
2026-10-15 10:39 ` [RFC PATCH 2/5] KVM: nSVM: Add nested PML emulation Nikunj A Dadhania
2026-10-15 11:03 ` sashiko-bot
2026-10-15 10:39 ` [RFC PATCH 3/5] KVM: nSVM: Advertise PML to L1 Nikunj A Dadhania
2026-10-15 10:39 ` [RFC PATCH 4/5] KVM: selftests: nVMX: Add nested PML coverage to nested_dirty_log_test Nikunj A Dadhania
2026-10-15 11:04 ` sashiko-bot [this message]
2026-10-15 10:39 ` [RFC PATCH 5/5] KVM: selftests: nSVM: " Nikunj A Dadhania
2026-10-15 11:04 ` sashiko-bot
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=sashiko-outbox-172712@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=nikunj@amd.com \
--cc=sashiko-reviews@lists.linux.dev \
/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