[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ffph6d2gjnw3mboy5tm2ulkyhyq7zz5y66zrtdcuutqba75oh5@b7kktjtve2fs>
Date: Tue, 21 Oct 2025 22:56:06 +0000
From: Yosry Ahmed <yosry.ahmed@...ux.dev>
To: Jim Mattson <jmattson@...gle.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>, Shuah Khan <shuah@...nel.org>,
Sean Christopherson <seanjc@...gle.com>, Bibo Mao <maobibo@...ngson.cn>,
Huacai Chen <chenhuacai@...nel.org>, Andrew Jones <ajones@...tanamicro.com>,
Claudio Imbrenda <imbrenda@...ux.ibm.com>, "Pratik R. Sampat" <prsampat@....com>,
Kai Huang <kai.huang@...el.com>, Eric Auger <eric.auger@...hat.com>, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org, linux-kselftest@...r.kernel.org
Subject: Re: [PATCH 3/4] KVM: selftests: Add VM_MODE_PXXV57_4K VM mode
On Tue, Oct 21, 2025 at 03:34:22PM -0700, Jim Mattson wrote:
> On Wed, Oct 15, 2025 at 2:23 PM Yosry Ahmed <yosry.ahmed@...ux.dev> wrote:
> >
> > On Wed, Sep 17, 2025 at 02:48:39PM -0700, Jim Mattson wrote:
> > > Add a new VM mode, VM_MODE_PXXV57_4K, to support tests that require
> > > 5-level paging on x86. This mode sets up a 57-bit virtual address
> > > space and sets CR4.LA57 in the guest.
> > >
> > > Signed-off-by: Jim Mattson <jmattson@...gle.com>
> > > ---
> > > .../testing/selftests/kvm/include/kvm_util.h | 1 +
> > > tools/testing/selftests/kvm/lib/kvm_util.c | 21 +++++++++++++++++
> > > .../testing/selftests/kvm/lib/x86/processor.c | 23 ++++++++++++-------
> > > tools/testing/selftests/kvm/lib/x86/vmx.c | 7 +++---
> > > 4 files changed, 41 insertions(+), 11 deletions(-)
> > >
> > > ...
> > > diff --git a/tools/testing/selftests/kvm/lib/x86/vmx.c b/tools/testing/selftests/kvm/lib/x86/vmx.c
> > > index d4d1208dd023..1b6d4a007798 100644
> > > --- a/tools/testing/selftests/kvm/lib/x86/vmx.c
> > > +++ b/tools/testing/selftests/kvm/lib/x86/vmx.c
> > > @@ -401,11 +401,12 @@ void __nested_pg_map(struct vmx_pages *vmx, struct kvm_vm *vm,
> > > struct eptPageTableEntry *pt = vmx->eptp_hva, *pte;
> > > uint16_t index;
> > >
> > > - TEST_ASSERT(vm->mode == VM_MODE_PXXV48_4K, "Attempt to use "
> > > - "unknown or unsupported guest mode, mode: 0x%x", vm->mode);
> > > + TEST_ASSERT(vm->mode == VM_MODE_PXXV48_4K ||
> > > + vm->mode == VM_MODE_PXXV57_4K,
> > > + "Unknown or unsupported guest mode: 0x%x", vm->mode);
> > >
> > > TEST_ASSERT((nested_paddr >> 48) == 0,
> > > - "Nested physical address 0x%lx requires 5-level paging",
> > > + "Nested physical address 0x%lx is > 48-bits and requires 5-level EPT",
> >
> > Shouldn't this assertion be updated now? We technically support 5-level
> > EPT so it should only fire if the mode is VM_MODE_PXXV48_4K. Maybe we
> > should use vm->va_bits?
>
> I did update the assertion! :)
>
> init_vmcs_control_fields() hardcodes a page-walk-length of 4 in the
> EPTP, and the loop in __nested_pg_map() counts down from
> PG_LEVEL_512G. There is no support for 5-level EPT here.
__nested_pg_map() will be gone with the series [1] moving nested
mappings to use __virt_pg_map(), and with your series the latter does
support 5-level EPTs. init_vmcs_control_fields() still hardcodes a
page-walk-length of 4 tho.
I actually just realized, my series will already drop these assertions
and rely on the ones in __virt_pg_map(), which do use vm->page_shift, so
the assertion won't fire if init_vmcs_control_fields() starts using
5-level EPTs.
TL;DR nothing to do here.
[1]https://lore.kernel.org/kvm/20251021074736.1324328-1-yosry.ahmed@linux.dev/
>
> >
> > > nested_paddr);
> > > TEST_ASSERT((nested_paddr % page_size) == 0,
> > > "Nested physical address not on page boundary,\n"
> > > --
> > > 2.51.0.470.ga7dc726c21-goog
> > >
> >
Powered by blists - more mailing lists