From: "Nikunj A. Dadhania" <nikunj@amd.com>
To: <sashiko-reviews@lists.linux.dev>, <kvm@vger.kernel.org>
Subject: Re: [RFC PATCH 4/5] KVM: selftests: nVMX: Add nested PML coverage to nested_dirty_log_test
Date: Mon, 19 Oct 2026 08:42:19 +0530 [thread overview]
Message-ID: <2669477e-20ef-430c-9224-cfcb4ca42acc@amd.com> (raw)
In-Reply-To: <sashiko-outbox-172712@kernel.org>
On 10/15/2026 4:34 PM, sashiko-bot@kernel.org wrote:
> [You don't often get email from sashiko-bot@kernel.org. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> 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?
It does not, and the test works as intended on both vendors. KVM does not
check guest_pml_index at VM-entry; it is only consumed in
nested_vmx_write_pml_buffer().
The seed is deliberate: on AMD the APM defines an index outside the valid
range as the trigger for a PML Full exit, and the test uses the same setup
for both vendors to get one deterministic PML_FULL.
Regards,
Nikunj
next prev parent reply other threads:[~2026-10-19 3:12 UTC|newest]
Thread overview: 18+ 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-16 10:38 ` Nikunj A. Dadhania
2026-10-15 15:21 ` Yosry Ahmed
2026-10-16 9:34 ` Nikunj A. Dadhania
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-19 3:02 ` Nikunj A. Dadhania
2026-10-15 15:19 ` Yosry Ahmed
2026-10-16 11:57 ` Nikunj A. Dadhania
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
2026-10-19 3:12 ` Nikunj A. Dadhania [this message]
2026-10-15 10:39 ` [RFC PATCH 5/5] KVM: selftests: nSVM: " Nikunj A Dadhania
2026-10-15 11:04 ` sashiko-bot
2026-10-19 3:38 ` Nikunj A. Dadhania
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=2669477e-20ef-430c-9224-cfcb4ca42acc@amd.com \
--to=nikunj@amd.com \
--cc=kvm@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.