* [GIT PULL] KVM: selftests: Early pile of updates for 6.2
@ 2022-11-17 1:10 Sean Christopherson
2022-11-17 14:06 ` Marc Zyngier
2022-11-17 14:11 ` Paolo Bonzini
0 siblings, 2 replies; 6+ messages in thread
From: Sean Christopherson @ 2022-11-17 1:10 UTC (permalink / raw)
To: Paolo Bonzini
Cc: Marc Zyngier, Oliver Upton, Reiji Watanabe, kvm, Colin Ian King,
Colton Lewis, David Matlack, Vipin Sharma, Gautam Menghani,
Peter Gonda, Vishal Annapurve
Please pull a set of selftests updates for 6.2. Many of these changes are
prep work for future selftests, e.g. for SEV and TDX, and/or have myriad
conflicts, e.g. the former "perf util" code. I am hoping to get these
changes queued up for 6.2 sooner than later so that the chain of dependent
work doesn't get too long.
Except for the ARM single-step changes[*], everything has been posted for
quite some time and/or has gone through multiple rounds of review.
The ARM single-step changes are a last minute fix to resolve a hilarious
(IMO) collision between the pool-based ucall implementation and the
recently added single-step test. Turns out that GCC will generate older
flavors of atomics that rely on a monitor to detect conflicts, and that
monitor is cleared by eret. gdb is allegedly smart enough to skip over
atomic sequences, but our selftest... not so much.
Note, there's one KVM x86 patch hiding in here (cleanup for code that gets
copied into selftests), but its quite innocuous and shouldn't conflict
with anything.
Regarding the "perf util" conflicts, I'm mostly certain I got them right,
but it wouldn't be a bad idea for the folks involved (Cc'd) to double
check that the end result looks correct.
[*] https://lore.kernel.org/all/20221117002350.2178351-1-seanjc@google.com
The following changes since commit d663b8a285986072428a6a145e5994bc275df994:
KVM: replace direct irq.h inclusion (2022-11-09 12:31:37 -0500)
are available in the Git repository at:
https://github.com/kvm-x86/linux tags/kvm-selftests-6.2-1
for you to fetch changes up to 5c107f7085f45e071bbcf13006fffccd8e5de0e1:
KVM: selftests: Assert in prepare_eptp() that nEPT is supported (2022-11-16 16:59:07 -0800)
----------------------------------------------------------------
KVM selftests updates for 6.2
perf_util:
- Add support for pinning vCPUs in dirty_log_perf_test.
- Add a lightweight psuedo RNG for guest use, and use it to randomize
the access pattern and write vs. read percentage in the so called
"perf util" tests.
- Rename the so called "perf_util" framework to "memstress".
ucall:
- Add a common pool-based ucall implementation (code dedup and pre-work
for running SEV (and beyond) guests in selftests.
- Fix an issue in ARM's single-step test when using the new pool-based
implementation; atomics don't play nice with single-step exceptions.
init:
- Provide a common constructor and arch hook, which will eventually be
used by x86 to automatically select the right hypercall (AMD vs. Intel).
x86:
- Clean up x86's page tabe management.
- Clean up and enhance the "smaller maxphyaddr" test, and add a related
test to cover generic emulation failure.
- Clean up the nEPT support checks.
- Add X86_PROPERTY_* framework to retrieve multi-bit CPUID values.
----------------------------------------------------------------
Colin Ian King (1):
KVM: selftests: Fix spelling mistake "begining" -> "beginning"
Colton Lewis (4):
KVM: selftests: implement random number generator for guest code
KVM: selftests: create -r argument to specify random seed
KVM: selftests: randomize which pages are written vs read
KVM: selftests: randomize page access order
David Matlack (13):
KVM: selftests: Rename perf_test_util.[ch] to memstress.[ch]
KVM: selftests: Rename pta (short for perf_test_args) to args
KVM: selftests: Rename perf_test_util symbols to memstress
KVM: selftests: Rename emulator_error_test to smaller_maxphyaddr_emulation_test
KVM: selftests: Explicitly require instructions bytes
KVM: selftests: Delete dead ucall code
KVM: selftests: Move flds instruction emulation failure handling to header
KVM: x86/mmu: Use BIT{,_ULL}() for PFERR masks
KVM: selftests: Copy KVM PFERR masks into selftests
KVM: selftests: Expect #PF(RSVD) when TDP is disabled
KVM: selftests: Add a test for KVM_CAP_EXIT_ON_EMULATION_FAILURE
KVM: selftests: Check for KVM nEPT support using "feature" MSRs
KVM: selftests: Assert in prepare_eptp() that nEPT is supported
Gautam Menghani (1):
KVM: selftests: Don't assume vcpu->id is '0' in xAPIC state test
Peter Gonda (2):
tools: Add atomic_test_and_set_bit()
KVM: selftests: Add ucall pool based implementation
Sean Christopherson (28):
KVM: arm64: selftests: Disable single-step with correct KVM define
KVM: arm64: selftests: Disable single-step without relying on ucall()
KVM: selftests: Consolidate common code for populating ucall struct
KVM: selftests: Consolidate boilerplate code in get_ucall()
KVM: selftests: Automatically do init_ucall() for non-barebones VMs
KVM: selftests: Make arm64's MMIO ucall multi-VM friendly
KVM: selftests: Drop now-unnecessary ucall_uninit()
KVM: selftests: Drop helpers to read/write page table entries
KVM: selftests: Drop reserved bit checks from PTE accessor
KVM: selftests: Remove useless shifts when creating guest page tables
KVM: selftests: Verify parent PTE is PRESENT when getting child PTE
KVM: selftests: Use virt_get_pte() when getting PTE pointer
KVM: selftests: Use vm_get_page_table_entry() in addr_arch_gva2gpa()
KVM: selftests: Play nice with huge pages when getting PTEs/GPAs
KVM: selftests: Avoid JMP in non-faulting path of KVM_ASM_SAFE()
KVM: selftests: Provide error code as a KVM_ASM_SAFE() output
KVM: selftests: Add X86_FEATURE_PAE and use it calc "fallback" MAXPHYADDR
KVM: selftests: Refactor X86_FEATURE_* framework to prep for X86_PROPERTY_*
KVM: selftests: Add X86_PROPERTY_* framework to retrieve CPUID values
KVM: selftests: Use X86_PROPERTY_MAX_KVM_LEAF in CPUID test
KVM: selftests: Refactor kvm_cpuid_has() to prep for X86_PROPERTY_* support
KVM: selftests: Add kvm_cpu_*() support for X86_PROPERTY_*
KVM: selftests: Convert AMX test to use X86_PROPRETY_XXX
KVM: selftests: Convert vmx_pmu_caps_test to use X86_PROPERTY_*
KVM: selftests: Add PMU feature framework, use in PMU event filter test
KVM: selftests: Add dedicated helpers for getting x86 Family and Model
KVM: selftests: Add and use KVM helpers for x86 Family and Model
KVM: selftests: Drop helpers for getting specific KVM supported CPUID entry
Vipin Sharma (7):
KVM: selftests: Add missing break between -e and -g option in dirty_log_perf_test
KVM: selftests: Put command line options in alphabetical order in dirty_log_perf_test
KVM: selftests: Add atoi_paranoid() to catch errors missed by atoi()
KVM: selftests: Use SZ_* macros from sizes.h in max_guest_memory_test.c
KVM: selftests: Shorten the test args in memslot_modification_stress_test.c
KVM: selftests: Add atoi_positive() and atoi_non_negative() for input validation
KVM: selftests: Allowing running dirty_log_perf_test on specific CPUs
Vishal Annapurve (3):
KVM: selftests: move common startup logic to kvm_util.c
KVM: selftests: Add arch specific initialization
KVM: selftests: Add arch specific post vm creation hook
arch/x86/include/asm/kvm_host.h | 20 +++---
tools/arch/x86/include/asm/atomic.h | 7 ++
tools/include/asm-generic/atomic-gcc.h | 12 ++++
tools/testing/selftests/kvm/.gitignore | 3 +-
tools/testing/selftests/kvm/Makefile | 8 ++-
tools/testing/selftests/kvm/aarch64/aarch32_id_regs.c | 3 -
tools/testing/selftests/kvm/aarch64/arch_timer.c | 29 ++------
tools/testing/selftests/kvm/aarch64/debug-exceptions.c | 32 ++++-----
tools/testing/selftests/kvm/aarch64/hypercalls.c | 3 -
tools/testing/selftests/kvm/aarch64/psci_test.c | 1 -
tools/testing/selftests/kvm/aarch64/vgic_init.c | 2 -
tools/testing/selftests/kvm/aarch64/vgic_irq.c | 10 +--
tools/testing/selftests/kvm/access_tracking_perf_test.c | 22 +++---
tools/testing/selftests/kvm/demand_paging_test.c | 24 +++----
tools/testing/selftests/kvm/dirty_log_perf_test.c | 130 ++++++++++++++++++++++-----------
tools/testing/selftests/kvm/dirty_log_test.c | 3 -
tools/testing/selftests/kvm/include/kvm_util_base.h | 28 ++++++++
tools/testing/selftests/kvm/include/memstress.h | 72 +++++++++++++++++++
tools/testing/selftests/kvm/include/perf_test_util.h | 63 ----------------
tools/testing/selftests/kvm/include/test_util.h | 25 +++++++
tools/testing/selftests/kvm/include/ucall_common.h | 10 ++-
tools/testing/selftests/kvm/include/x86_64/processor.h | 364 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------
tools/testing/selftests/kvm/include/x86_64/vmx.h | 2 +-
tools/testing/selftests/kvm/kvm_page_table_test.c | 6 +-
tools/testing/selftests/kvm/lib/aarch64/processor.c | 18 ++---
tools/testing/selftests/kvm/lib/aarch64/ucall.c | 102 ++++----------------------
tools/testing/selftests/kvm/lib/elf.c | 2 +-
tools/testing/selftests/kvm/lib/kvm_util.c | 85 +++++++++++++++++++++-
tools/testing/selftests/kvm/lib/{perf_test_util.c => memstress.c} | 133 ++++++++++++++++++++--------------
tools/testing/selftests/kvm/lib/riscv/ucall.c | 42 ++---------
tools/testing/selftests/kvm/lib/s390x/ucall.c | 39 ++--------
tools/testing/selftests/kvm/lib/test_util.c | 36 ++++++++++
tools/testing/selftests/kvm/lib/ucall_common.c | 103 ++++++++++++++++++++++++++
tools/testing/selftests/kvm/lib/x86_64/{perf_test_util.c => memstress.c} | 37 +++++-----
tools/testing/selftests/kvm/lib/x86_64/processor.c | 225 +++++++++++++++++++++++----------------------------------
tools/testing/selftests/kvm/lib/x86_64/ucall.c | 39 ++--------
tools/testing/selftests/kvm/lib/x86_64/vmx.c | 12 ++--
tools/testing/selftests/kvm/max_guest_memory_test.c | 21 +++---
tools/testing/selftests/kvm/memslot_modification_stress_test.c | 38 +++++-----
tools/testing/selftests/kvm/memslot_perf_test.c | 28 ++------
tools/testing/selftests/kvm/rseq_test.c | 4 --
tools/testing/selftests/kvm/s390x/memop.c | 2 -
tools/testing/selftests/kvm/s390x/resets.c | 2 -
tools/testing/selftests/kvm/s390x/sync_regs_test.c | 3 -
tools/testing/selftests/kvm/set_memory_region_test.c | 5 +-
tools/testing/selftests/kvm/steal_time.c | 1 -
tools/testing/selftests/kvm/system_counter_offset_test.c | 1 -
tools/testing/selftests/kvm/x86_64/amx_test.c | 105 +++++++--------------------
tools/testing/selftests/kvm/x86_64/cpuid_test.c | 11 +--
tools/testing/selftests/kvm/x86_64/cr4_cpuid_sync_test.c | 3 -
tools/testing/selftests/kvm/x86_64/emulator_error_test.c | 193 -------------------------------------------------
tools/testing/selftests/kvm/x86_64/exit_on_emulation_failure_test.c | 45 ++++++++++++
tools/testing/selftests/kvm/x86_64/flds_emulation.h | 55 ++++++++++++++
tools/testing/selftests/kvm/x86_64/hyperv_cpuid.c | 3 -
tools/testing/selftests/kvm/x86_64/hyperv_features.c | 3 +-
tools/testing/selftests/kvm/x86_64/nx_huge_pages_test.c | 5 +-
tools/testing/selftests/kvm/x86_64/platform_info_test.c | 3 -
tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c | 77 +++++---------------
tools/testing/selftests/kvm/x86_64/set_sregs_test.c | 3 -
tools/testing/selftests/kvm/x86_64/smaller_maxphyaddr_emulation_test.c | 111 ++++++++++++++++++++++++++++
tools/testing/selftests/kvm/x86_64/svm_nested_soft_inject_test.c | 3 -
tools/testing/selftests/kvm/x86_64/sync_regs_test.c | 3 -
tools/testing/selftests/kvm/x86_64/userspace_io_test.c | 3 -
tools/testing/selftests/kvm/x86_64/userspace_msr_exit_test.c | 3 -
tools/testing/selftests/kvm/x86_64/vmx_dirty_log_test.c | 1 +
tools/testing/selftests/kvm/x86_64/vmx_pmu_caps_test.c | 19 +----
tools/testing/selftests/kvm/x86_64/xapic_state_test.c | 4 +-
67 files changed, 1353 insertions(+), 1157 deletions(-)
create mode 100644 tools/testing/selftests/kvm/include/memstress.h
delete mode 100644 tools/testing/selftests/kvm/include/perf_test_util.h
rename tools/testing/selftests/kvm/lib/{perf_test_util.c => memstress.c} (63%)
create mode 100644 tools/testing/selftests/kvm/lib/ucall_common.c
rename tools/testing/selftests/kvm/lib/x86_64/{perf_test_util.c => memstress.c} (68%)
delete mode 100644 tools/testing/selftests/kvm/x86_64/emulator_error_test.c
create mode 100644 tools/testing/selftests/kvm/x86_64/exit_on_emulation_failure_test.c
create mode 100644 tools/testing/selftests/kvm/x86_64/flds_emulation.h
create mode 100644 tools/testing/selftests/kvm/x86_64/smaller_maxphyaddr_emulation_test.c
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [GIT PULL] KVM: selftests: Early pile of updates for 6.2
2022-11-17 1:10 [GIT PULL] KVM: selftests: Early pile of updates for 6.2 Sean Christopherson
@ 2022-11-17 14:06 ` Marc Zyngier
2022-11-17 14:09 ` Paolo Bonzini
2022-11-17 23:49 ` Sean Christopherson
2022-11-17 14:11 ` Paolo Bonzini
1 sibling, 2 replies; 6+ messages in thread
From: Marc Zyngier @ 2022-11-17 14:06 UTC (permalink / raw)
To: Sean Christopherson
Cc: Paolo Bonzini, Oliver Upton, Reiji Watanabe, kvm, Colin Ian King,
Colton Lewis, David Matlack, Vipin Sharma, Gautam Menghani,
Peter Gonda, Vishal Annapurve
On Thu, 17 Nov 2022 01:10:33 +0000,
Sean Christopherson <seanjc@google.com> wrote:
>
> Please pull a set of selftests updates for 6.2. Many of these changes are
> prep work for future selftests, e.g. for SEV and TDX, and/or have myriad
> conflicts, e.g. the former "perf util" code. I am hoping to get these
> changes queued up for 6.2 sooner than later so that the chain of dependent
> work doesn't get too long.
>
> Except for the ARM single-step changes[*], everything has been posted for
> quite some time and/or has gone through multiple rounds of review.
>
> The ARM single-step changes are a last minute fix to resolve a hilarious
> (IMO) collision between the pool-based ucall implementation and the
> recently added single-step test. Turns out that GCC will generate older
> flavors of atomics that rely on a monitor to detect conflicts, and that
A quick nit, and to make things clear: there is no "older flavours of
atomics". These are exclusive accesses, and atomics are, well,
atomics. The tests seem to use the former, which cannot guarantee
forward progress. Yes, this is utter crap.
> monitor is cleared by eret. gdb is allegedly smart enough to skip over
> atomic sequences, but our selftest... not so much.
I'm not sure how GDB performs this feat without completely messing
things up in some cases...
But it brings another question. Shouldn't these tests actively use
atomics when on 8.1+ HW?
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [GIT PULL] KVM: selftests: Early pile of updates for 6.2
2022-11-17 14:06 ` Marc Zyngier
@ 2022-11-17 14:09 ` Paolo Bonzini
2022-11-17 23:49 ` Sean Christopherson
1 sibling, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2022-11-17 14:09 UTC (permalink / raw)
To: Marc Zyngier, Sean Christopherson
Cc: Oliver Upton, Reiji Watanabe, kvm, Colin Ian King, Colton Lewis,
David Matlack, Vipin Sharma, Gautam Menghani, Peter Gonda,
Vishal Annapurve
On 11/17/22 15:06, Marc Zyngier wrote:
>> monitor is cleared by eret. gdb is allegedly smart enough to skip over
>> atomic sequences, but our selftest... not so much.
> I'm not sure how GDB performs this feat without completely messing
> things up in some cases...
As far as I know what happens is simply that "step" sets a breakpoint to
the next line of *source* code. "stepi" instead works on an instruction
bases and will not make any progress over LL/SC sequences.
Paolo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [GIT PULL] KVM: selftests: Early pile of updates for 6.2
2022-11-17 14:06 ` Marc Zyngier
2022-11-17 14:09 ` Paolo Bonzini
@ 2022-11-17 23:49 ` Sean Christopherson
2022-11-18 0:05 ` Marc Zyngier
1 sibling, 1 reply; 6+ messages in thread
From: Sean Christopherson @ 2022-11-17 23:49 UTC (permalink / raw)
To: Marc Zyngier
Cc: Paolo Bonzini, Oliver Upton, Reiji Watanabe, kvm, Colin Ian King,
Colton Lewis, David Matlack, Vipin Sharma, Gautam Menghani,
Peter Gonda, Vishal Annapurve
On Thu, Nov 17, 2022, Marc Zyngier wrote:
> On Thu, 17 Nov 2022 01:10:33 +0000,
> Sean Christopherson <seanjc@google.com> wrote:
> >
> > Please pull a set of selftests updates for 6.2. Many of these changes are
> > prep work for future selftests, e.g. for SEV and TDX, and/or have myriad
> > conflicts, e.g. the former "perf util" code. I am hoping to get these
> > changes queued up for 6.2 sooner than later so that the chain of dependent
> > work doesn't get too long.
> >
> > Except for the ARM single-step changes[*], everything has been posted for
> > quite some time and/or has gone through multiple rounds of review.
> >
> > The ARM single-step changes are a last minute fix to resolve a hilarious
> > (IMO) collision between the pool-based ucall implementation and the
> > recently added single-step test. Turns out that GCC will generate older
> > flavors of atomics that rely on a monitor to detect conflicts, and that
>
> A quick nit, and to make things clear: there is no "older flavours of
> atomics". These are exclusive accesses, and atomics are, well,
> atomics.
Heh, good to know even ARM doesn't consider them atomics.
> The tests seem to use the former, which cannot guarantee forward progress.
> Yes, this is utter crap.
Ya, it's gcc-12's built-in "atomics" :-(
> > monitor is cleared by eret. gdb is allegedly smart enough to skip over
> > atomic sequences, but our selftest... not so much.
>
> I'm not sure how GDB performs this feat without completely messing
> things up in some cases...
>
> But it brings another question. Shouldn't these tests actively use
> atomics when on 8.1+ HW?
tools/ doesn't exactly have robust arch-specific support, e.g. the x86 versus the
world stuff is a big hack:
#if defined(__i386__) || defined(__x86_64__)
#include "../../arch/x86/include/asm/atomic.h"
#else
#include <asm-generic/atomic-gcc.h>
#endif
Patching in modern alternatives, especially in the guest code, would be quite
rough.
Oliver suggested trying "-march=armv8.1-a" to get gcc to use actual atomics, but
that obviously requires knowing the target hardware.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [GIT PULL] KVM: selftests: Early pile of updates for 6.2
2022-11-17 23:49 ` Sean Christopherson
@ 2022-11-18 0:05 ` Marc Zyngier
0 siblings, 0 replies; 6+ messages in thread
From: Marc Zyngier @ 2022-11-18 0:05 UTC (permalink / raw)
To: Sean Christopherson
Cc: Paolo Bonzini, Oliver Upton, Reiji Watanabe, kvm, Colin Ian King,
Colton Lewis, David Matlack, Vipin Sharma, Gautam Menghani,
Peter Gonda, Vishal Annapurve
On Thu, 17 Nov 2022 23:49:40 +0000,
Sean Christopherson <seanjc@google.com> wrote:
>
> On Thu, Nov 17, 2022, Marc Zyngier wrote:
> > On Thu, 17 Nov 2022 01:10:33 +0000,
> > Sean Christopherson <seanjc@google.com> wrote:
> > >
> > > Please pull a set of selftests updates for 6.2. Many of these changes are
> > > prep work for future selftests, e.g. for SEV and TDX, and/or have myriad
> > > conflicts, e.g. the former "perf util" code. I am hoping to get these
> > > changes queued up for 6.2 sooner than later so that the chain of dependent
> > > work doesn't get too long.
> > >
> > > Except for the ARM single-step changes[*], everything has been posted for
> > > quite some time and/or has gone through multiple rounds of review.
> > >
> > > The ARM single-step changes are a last minute fix to resolve a hilarious
> > > (IMO) collision between the pool-based ucall implementation and the
> > > recently added single-step test. Turns out that GCC will generate older
> > > flavors of atomics that rely on a monitor to detect conflicts, and that
> >
> > A quick nit, and to make things clear: there is no "older flavours of
> > atomics". These are exclusive accesses, and atomics are, well,
> > atomics.
>
> Heh, good to know even ARM doesn't consider them atomics.
They are primitives to build atomic accessors, and the number of
things you can do between the LL and the SC is pretty limited (see
B2.9.5 in the I.a ARM ARM for the gory details).
>
> > The tests seem to use the former, which cannot guarantee forward progress.
> > Yes, this is utter crap.
>
> Ya, it's gcc-12's built-in "atomics" :-(
>
> > > monitor is cleared by eret. gdb is allegedly smart enough to skip over
> > > atomic sequences, but our selftest... not so much.
> >
> > I'm not sure how GDB performs this feat without completely messing
> > things up in some cases...
> >
> > But it brings another question. Shouldn't these tests actively use
> > atomics when on 8.1+ HW?
>
> tools/ doesn't exactly have robust arch-specific support, e.g. the x86 versus the
> world stuff is a big hack:
>
> #if defined(__i386__) || defined(__x86_64__)
> #include "../../arch/x86/include/asm/atomic.h"
> #else
> #include <asm-generic/atomic-gcc.h>
> #endif
>
> Patching in modern alternatives, especially in the guest code, would be quite
> rough.
>
> Oliver suggested trying "-march=armv8.1-a" to get gcc to use actual atomics, but
> that obviously requires knowing the target hardware.
Given that we really don't need any sort of performance here, simply
having a check (or an indirection) to discriminate between the two
implementations would be enough.
And we can then drop the GCC built-in stuff.
M.
--
Without deviation from the norm, progress is not possible.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [GIT PULL] KVM: selftests: Early pile of updates for 6.2
2022-11-17 1:10 [GIT PULL] KVM: selftests: Early pile of updates for 6.2 Sean Christopherson
2022-11-17 14:06 ` Marc Zyngier
@ 2022-11-17 14:11 ` Paolo Bonzini
1 sibling, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2022-11-17 14:11 UTC (permalink / raw)
To: Sean Christopherson
Cc: Marc Zyngier, Oliver Upton, Reiji Watanabe, kvm, Colin Ian King,
Colton Lewis, David Matlack, Vipin Sharma, Gautam Menghani,
Peter Gonda, Vishal Annapurve
On 11/17/22 02:10, Sean Christopherson wrote:
> Please pull a set of selftests updates for 6.2. Many of these changes are
> prep work for future selftests, e.g. for SEV and TDX, and/or have myriad
> conflicts, e.g. the former "perf util" code. I am hoping to get these
> changes queued up for 6.2 sooner than later so that the chain of dependent
> work doesn't get too long.
>
> Except for the ARM single-step changes[*], everything has been posted for
> quite some time and/or has gone through multiple rounds of review.
>
> The ARM single-step changes are a last minute fix to resolve a hilarious
> (IMO) collision between the pool-based ucall implementation and the
> recently added single-step test. Turns out that GCC will generate older
> flavors of atomics that rely on a monitor to detect conflicts, and that
> monitor is cleared by eret. gdb is allegedly smart enough to skip over
> atomic sequences, but our selftest... not so much.
>
> Note, there's one KVM x86 patch hiding in here (cleanup for code that gets
> copied into selftests), but its quite innocuous and shouldn't conflict
> with anything.
>
> Regarding the "perf util" conflicts, I'm mostly certain I got them right,
> but it wouldn't be a bad idea for the folks involved (Cc'd) to double
> check that the end result looks correct.
Pulled, thanks. I have adjusted the merge log to mention LDREX/STREX
instead of atomics.
Paolo
> [*] https://lore.kernel.org/all/20221117002350.2178351-1-seanjc@google.com
>
>
> The following changes since commit d663b8a285986072428a6a145e5994bc275df994:
>
> KVM: replace direct irq.h inclusion (2022-11-09 12:31:37 -0500)
>
> are available in the Git repository at:
>
> https://github.com/kvm-x86/linux tags/kvm-selftests-6.2-1
>
> for you to fetch changes up to 5c107f7085f45e071bbcf13006fffccd8e5de0e1:
>
> KVM: selftests: Assert in prepare_eptp() that nEPT is supported (2022-11-16 16:59:07 -0800)
>
> ----------------------------------------------------------------
> KVM selftests updates for 6.2
>
> perf_util:
> - Add support for pinning vCPUs in dirty_log_perf_test.
> - Add a lightweight psuedo RNG for guest use, and use it to randomize
> the access pattern and write vs. read percentage in the so called
> "perf util" tests.
> - Rename the so called "perf_util" framework to "memstress".
>
> ucall:
> - Add a common pool-based ucall implementation (code dedup and pre-work
> for running SEV (and beyond) guests in selftests.
> - Fix an issue in ARM's single-step test when using the new pool-based
> implementation; atomics don't play nice with single-step exceptions.
>
> init:
> - Provide a common constructor and arch hook, which will eventually be
> used by x86 to automatically select the right hypercall (AMD vs. Intel).
>
> x86:
> - Clean up x86's page tabe management.
> - Clean up and enhance the "smaller maxphyaddr" test, and add a related
> test to cover generic emulation failure.
> - Clean up the nEPT support checks.
> - Add X86_PROPERTY_* framework to retrieve multi-bit CPUID values.
>
> ----------------------------------------------------------------
> Colin Ian King (1):
> KVM: selftests: Fix spelling mistake "begining" -> "beginning"
>
> Colton Lewis (4):
> KVM: selftests: implement random number generator for guest code
> KVM: selftests: create -r argument to specify random seed
> KVM: selftests: randomize which pages are written vs read
> KVM: selftests: randomize page access order
>
> David Matlack (13):
> KVM: selftests: Rename perf_test_util.[ch] to memstress.[ch]
> KVM: selftests: Rename pta (short for perf_test_args) to args
> KVM: selftests: Rename perf_test_util symbols to memstress
> KVM: selftests: Rename emulator_error_test to smaller_maxphyaddr_emulation_test
> KVM: selftests: Explicitly require instructions bytes
> KVM: selftests: Delete dead ucall code
> KVM: selftests: Move flds instruction emulation failure handling to header
> KVM: x86/mmu: Use BIT{,_ULL}() for PFERR masks
> KVM: selftests: Copy KVM PFERR masks into selftests
> KVM: selftests: Expect #PF(RSVD) when TDP is disabled
> KVM: selftests: Add a test for KVM_CAP_EXIT_ON_EMULATION_FAILURE
> KVM: selftests: Check for KVM nEPT support using "feature" MSRs
> KVM: selftests: Assert in prepare_eptp() that nEPT is supported
>
> Gautam Menghani (1):
> KVM: selftests: Don't assume vcpu->id is '0' in xAPIC state test
>
> Peter Gonda (2):
> tools: Add atomic_test_and_set_bit()
> KVM: selftests: Add ucall pool based implementation
>
> Sean Christopherson (28):
> KVM: arm64: selftests: Disable single-step with correct KVM define
> KVM: arm64: selftests: Disable single-step without relying on ucall()
> KVM: selftests: Consolidate common code for populating ucall struct
> KVM: selftests: Consolidate boilerplate code in get_ucall()
> KVM: selftests: Automatically do init_ucall() for non-barebones VMs
> KVM: selftests: Make arm64's MMIO ucall multi-VM friendly
> KVM: selftests: Drop now-unnecessary ucall_uninit()
> KVM: selftests: Drop helpers to read/write page table entries
> KVM: selftests: Drop reserved bit checks from PTE accessor
> KVM: selftests: Remove useless shifts when creating guest page tables
> KVM: selftests: Verify parent PTE is PRESENT when getting child PTE
> KVM: selftests: Use virt_get_pte() when getting PTE pointer
> KVM: selftests: Use vm_get_page_table_entry() in addr_arch_gva2gpa()
> KVM: selftests: Play nice with huge pages when getting PTEs/GPAs
> KVM: selftests: Avoid JMP in non-faulting path of KVM_ASM_SAFE()
> KVM: selftests: Provide error code as a KVM_ASM_SAFE() output
> KVM: selftests: Add X86_FEATURE_PAE and use it calc "fallback" MAXPHYADDR
> KVM: selftests: Refactor X86_FEATURE_* framework to prep for X86_PROPERTY_*
> KVM: selftests: Add X86_PROPERTY_* framework to retrieve CPUID values
> KVM: selftests: Use X86_PROPERTY_MAX_KVM_LEAF in CPUID test
> KVM: selftests: Refactor kvm_cpuid_has() to prep for X86_PROPERTY_* support
> KVM: selftests: Add kvm_cpu_*() support for X86_PROPERTY_*
> KVM: selftests: Convert AMX test to use X86_PROPRETY_XXX
> KVM: selftests: Convert vmx_pmu_caps_test to use X86_PROPERTY_*
> KVM: selftests: Add PMU feature framework, use in PMU event filter test
> KVM: selftests: Add dedicated helpers for getting x86 Family and Model
> KVM: selftests: Add and use KVM helpers for x86 Family and Model
> KVM: selftests: Drop helpers for getting specific KVM supported CPUID entry
>
> Vipin Sharma (7):
> KVM: selftests: Add missing break between -e and -g option in dirty_log_perf_test
> KVM: selftests: Put command line options in alphabetical order in dirty_log_perf_test
> KVM: selftests: Add atoi_paranoid() to catch errors missed by atoi()
> KVM: selftests: Use SZ_* macros from sizes.h in max_guest_memory_test.c
> KVM: selftests: Shorten the test args in memslot_modification_stress_test.c
> KVM: selftests: Add atoi_positive() and atoi_non_negative() for input validation
> KVM: selftests: Allowing running dirty_log_perf_test on specific CPUs
>
> Vishal Annapurve (3):
> KVM: selftests: move common startup logic to kvm_util.c
> KVM: selftests: Add arch specific initialization
> KVM: selftests: Add arch specific post vm creation hook
>
> arch/x86/include/asm/kvm_host.h | 20 +++---
> tools/arch/x86/include/asm/atomic.h | 7 ++
> tools/include/asm-generic/atomic-gcc.h | 12 ++++
> tools/testing/selftests/kvm/.gitignore | 3 +-
> tools/testing/selftests/kvm/Makefile | 8 ++-
> tools/testing/selftests/kvm/aarch64/aarch32_id_regs.c | 3 -
> tools/testing/selftests/kvm/aarch64/arch_timer.c | 29 ++------
> tools/testing/selftests/kvm/aarch64/debug-exceptions.c | 32 ++++-----
> tools/testing/selftests/kvm/aarch64/hypercalls.c | 3 -
> tools/testing/selftests/kvm/aarch64/psci_test.c | 1 -
> tools/testing/selftests/kvm/aarch64/vgic_init.c | 2 -
> tools/testing/selftests/kvm/aarch64/vgic_irq.c | 10 +--
> tools/testing/selftests/kvm/access_tracking_perf_test.c | 22 +++---
> tools/testing/selftests/kvm/demand_paging_test.c | 24 +++----
> tools/testing/selftests/kvm/dirty_log_perf_test.c | 130 ++++++++++++++++++++++-----------
> tools/testing/selftests/kvm/dirty_log_test.c | 3 -
> tools/testing/selftests/kvm/include/kvm_util_base.h | 28 ++++++++
> tools/testing/selftests/kvm/include/memstress.h | 72 +++++++++++++++++++
> tools/testing/selftests/kvm/include/perf_test_util.h | 63 ----------------
> tools/testing/selftests/kvm/include/test_util.h | 25 +++++++
> tools/testing/selftests/kvm/include/ucall_common.h | 10 ++-
> tools/testing/selftests/kvm/include/x86_64/processor.h | 364 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------
> tools/testing/selftests/kvm/include/x86_64/vmx.h | 2 +-
> tools/testing/selftests/kvm/kvm_page_table_test.c | 6 +-
> tools/testing/selftests/kvm/lib/aarch64/processor.c | 18 ++---
> tools/testing/selftests/kvm/lib/aarch64/ucall.c | 102 ++++----------------------
> tools/testing/selftests/kvm/lib/elf.c | 2 +-
> tools/testing/selftests/kvm/lib/kvm_util.c | 85 +++++++++++++++++++++-
> tools/testing/selftests/kvm/lib/{perf_test_util.c => memstress.c} | 133 ++++++++++++++++++++--------------
> tools/testing/selftests/kvm/lib/riscv/ucall.c | 42 ++---------
> tools/testing/selftests/kvm/lib/s390x/ucall.c | 39 ++--------
> tools/testing/selftests/kvm/lib/test_util.c | 36 ++++++++++
> tools/testing/selftests/kvm/lib/ucall_common.c | 103 ++++++++++++++++++++++++++
> tools/testing/selftests/kvm/lib/x86_64/{perf_test_util.c => memstress.c} | 37 +++++-----
> tools/testing/selftests/kvm/lib/x86_64/processor.c | 225 +++++++++++++++++++++++----------------------------------
> tools/testing/selftests/kvm/lib/x86_64/ucall.c | 39 ++--------
> tools/testing/selftests/kvm/lib/x86_64/vmx.c | 12 ++--
> tools/testing/selftests/kvm/max_guest_memory_test.c | 21 +++---
> tools/testing/selftests/kvm/memslot_modification_stress_test.c | 38 +++++-----
> tools/testing/selftests/kvm/memslot_perf_test.c | 28 ++------
> tools/testing/selftests/kvm/rseq_test.c | 4 --
> tools/testing/selftests/kvm/s390x/memop.c | 2 -
> tools/testing/selftests/kvm/s390x/resets.c | 2 -
> tools/testing/selftests/kvm/s390x/sync_regs_test.c | 3 -
> tools/testing/selftests/kvm/set_memory_region_test.c | 5 +-
> tools/testing/selftests/kvm/steal_time.c | 1 -
> tools/testing/selftests/kvm/system_counter_offset_test.c | 1 -
> tools/testing/selftests/kvm/x86_64/amx_test.c | 105 +++++++--------------------
> tools/testing/selftests/kvm/x86_64/cpuid_test.c | 11 +--
> tools/testing/selftests/kvm/x86_64/cr4_cpuid_sync_test.c | 3 -
> tools/testing/selftests/kvm/x86_64/emulator_error_test.c | 193 -------------------------------------------------
> tools/testing/selftests/kvm/x86_64/exit_on_emulation_failure_test.c | 45 ++++++++++++
> tools/testing/selftests/kvm/x86_64/flds_emulation.h | 55 ++++++++++++++
> tools/testing/selftests/kvm/x86_64/hyperv_cpuid.c | 3 -
> tools/testing/selftests/kvm/x86_64/hyperv_features.c | 3 +-
> tools/testing/selftests/kvm/x86_64/nx_huge_pages_test.c | 5 +-
> tools/testing/selftests/kvm/x86_64/platform_info_test.c | 3 -
> tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c | 77 +++++---------------
> tools/testing/selftests/kvm/x86_64/set_sregs_test.c | 3 -
> tools/testing/selftests/kvm/x86_64/smaller_maxphyaddr_emulation_test.c | 111 ++++++++++++++++++++++++++++
> tools/testing/selftests/kvm/x86_64/svm_nested_soft_inject_test.c | 3 -
> tools/testing/selftests/kvm/x86_64/sync_regs_test.c | 3 -
> tools/testing/selftests/kvm/x86_64/userspace_io_test.c | 3 -
> tools/testing/selftests/kvm/x86_64/userspace_msr_exit_test.c | 3 -
> tools/testing/selftests/kvm/x86_64/vmx_dirty_log_test.c | 1 +
> tools/testing/selftests/kvm/x86_64/vmx_pmu_caps_test.c | 19 +----
> tools/testing/selftests/kvm/x86_64/xapic_state_test.c | 4 +-
> 67 files changed, 1353 insertions(+), 1157 deletions(-)
> create mode 100644 tools/testing/selftests/kvm/include/memstress.h
> delete mode 100644 tools/testing/selftests/kvm/include/perf_test_util.h
> rename tools/testing/selftests/kvm/lib/{perf_test_util.c => memstress.c} (63%)
> create mode 100644 tools/testing/selftests/kvm/lib/ucall_common.c
> rename tools/testing/selftests/kvm/lib/x86_64/{perf_test_util.c => memstress.c} (68%)
> delete mode 100644 tools/testing/selftests/kvm/x86_64/emulator_error_test.c
> create mode 100644 tools/testing/selftests/kvm/x86_64/exit_on_emulation_failure_test.c
> create mode 100644 tools/testing/selftests/kvm/x86_64/flds_emulation.h
> create mode 100644 tools/testing/selftests/kvm/x86_64/smaller_maxphyaddr_emulation_test.c
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-11-18 0:05 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-17 1:10 [GIT PULL] KVM: selftests: Early pile of updates for 6.2 Sean Christopherson
2022-11-17 14:06 ` Marc Zyngier
2022-11-17 14:09 ` Paolo Bonzini
2022-11-17 23:49 ` Sean Christopherson
2022-11-18 0:05 ` Marc Zyngier
2022-11-17 14:11 ` Paolo Bonzini
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.