mbox series

[v3,0/3] KVM: selftests: Fix nx_huge_pages_test when TDP is disabled

Message ID 20220929181207.2281449-1-dmatlack@google.com (mailing list archive)
Headers show
Series KVM: selftests: Fix nx_huge_pages_test when TDP is disabled | expand

Message

David Matlack Sept. 29, 2022, 6:12 p.m. UTC
Fix nx_huge_pages_test when run on TDP-disabled hosts by mapping the
test region with huge pages in the VM so that KVM can shadow it with
huge pages.

Patches 1 and 2 are precursor patches to add the necessary
infrastructure to check if TDP is enabled or not.

v3:
 - Skip the selftest if a module param file cannot be opened [Sean]
 - Add wrappers for reading kvm_intel and kvm_amd params [Sean]
 - Small renames and error reporting cleanups [Sean]
 - Decrease sysfs path array from 1024 to 128 bytes [me]

v2: https://lore.kernel.org/kvm/20220928184853.1681781-1-dmatlack@google.com/
 - Still use 4K mappins on TDP-enabled hosts [Sean]
 - Generalize virt_map_2m() to virt_map_level() [me]
 - Pass nr_bytes instead of nr_pages to virt_map_level() [Sean]

v1: https://lore.kernel.org/kvm/20220926175219.605113-1-dmatlack@google.com/

David Matlack (3):
  KVM: selftests: Tell the compiler that code after TEST_FAIL() is
    unreachable
  KVM: selftests: Add helpers to read kvm_{intel,amd} boolean module
    parameters
  KVM: selftests: Fix nx_huge_pages_test on TDP-disabled hosts

 .../selftests/kvm/include/kvm_util_base.h     |  4 ++
 .../testing/selftests/kvm/include/test_util.h |  6 ++-
 .../selftests/kvm/include/x86_64/processor.h  |  4 ++
 tools/testing/selftests/kvm/lib/kvm_util.c    | 39 ++++++++++++++++++
 .../selftests/kvm/lib/x86_64/processor.c      | 40 +++++++++++++------
 .../selftests/kvm/x86_64/nx_huge_pages_test.c | 19 ++++++++-
 6 files changed, 96 insertions(+), 16 deletions(-)


base-commit: 372d07084593dc7a399bf9bee815711b1fb1bcf2
prerequisite-patch-id: 2e3661ba8856c29b769499bac525b6943d9284b8

Comments

Paolo Bonzini Sept. 29, 2022, 6:25 p.m. UTC | #1
On 9/29/22 20:12, David Matlack wrote:
> Fix nx_huge_pages_test when run on TDP-disabled hosts by mapping the
> test region with huge pages in the VM so that KVM can shadow it with
> huge pages.
> 
> Patches 1 and 2 are precursor patches to add the necessary
> infrastructure to check if TDP is enabled or not.

Queued, thanks.  For now I placed them in kvm/master, but I think they 
will not be in 6.0.

Paolo

> v3:
>   - Skip the selftest if a module param file cannot be opened [Sean]
>   - Add wrappers for reading kvm_intel and kvm_amd params [Sean]
>   - Small renames and error reporting cleanups [Sean]
>   - Decrease sysfs path array from 1024 to 128 bytes [me]
> 
> v2: https://lore.kernel.org/kvm/20220928184853.1681781-1-dmatlack@google.com/
>   - Still use 4K mappins on TDP-enabled hosts [Sean]
>   - Generalize virt_map_2m() to virt_map_level() [me]
>   - Pass nr_bytes instead of nr_pages to virt_map_level() [Sean]
> 
> v1: https://lore.kernel.org/kvm/20220926175219.605113-1-dmatlack@google.com/
> 
> David Matlack (3):
>    KVM: selftests: Tell the compiler that code after TEST_FAIL() is
>      unreachable
>    KVM: selftests: Add helpers to read kvm_{intel,amd} boolean module
>      parameters
>    KVM: selftests: Fix nx_huge_pages_test on TDP-disabled hosts
> 
>   .../selftests/kvm/include/kvm_util_base.h     |  4 ++
>   .../testing/selftests/kvm/include/test_util.h |  6 ++-
>   .../selftests/kvm/include/x86_64/processor.h  |  4 ++
>   tools/testing/selftests/kvm/lib/kvm_util.c    | 39 ++++++++++++++++++
>   .../selftests/kvm/lib/x86_64/processor.c      | 40 +++++++++++++------
>   .../selftests/kvm/x86_64/nx_huge_pages_test.c | 19 ++++++++-
>   6 files changed, 96 insertions(+), 16 deletions(-)
> 
> 
> base-commit: 372d07084593dc7a399bf9bee815711b1fb1bcf2
> prerequisite-patch-id: 2e3661ba8856c29b769499bac525b6943d9284b8