Re: [PATCH 10/12] KVM: selftests: Move EPT-specific init outside nested_create_pte()
From: Jim Mattson
Date: Mon Oct 13 2025 - 14:52:51 EST
On Wed, Oct 1, 2025 at 8:06 AM Yosry Ahmed <yosry.ahmed@xxxxxxxxx> wrote:
>
> From: Yosry Ahmed <yosryahmed@xxxxxxxxxx>
>
> Refactor the EPT specific initialization into nested_ept_create_pte(),
> in preparation for making nested_create_pte() NPT-friendly.
>
> Signed-off-by: Yosry Ahmed <yosry.ahmed@xxxxxxxxx>
> ---
> tools/testing/selftests/kvm/lib/x86/vmx.c | 71 ++++++++++++++---------
> 1 file changed, 43 insertions(+), 28 deletions(-)
>
> ...
> +
> + /*
> + * For now mark these as accessed and dirty because the only
> + * testcase we have needs that. Can be reconsidered later.
> + */
> + epte->accessed = *leaf;
> + epte->dirty = *leaf;
Not your change, but it seems strange to set the 'accessed' bit only
at the leaf. The CPU will set the 'accessed' bits from the PGD down as
it does the walk. So, to only have an accessed bit set on the leaf
requires the existence of some software agent to clear the higher
levels.
Reviewed-by: Jim Mattson <jmattson@xxxxxxxxxx>