linux-xiaomi-chiron/tools/testing/selftests/kvm
Sean Christopherson 7b0035eaa7 KVM: selftests: Ensure all migrations are performed when test is affined
Rework the CPU selection in the migration worker to ensure the specified
number of migrations are performed when the test iteslf is affined to a
subset of CPUs.  The existing logic skips iterations if the target CPU is
not in the original set of possible CPUs, which causes the test to fail
if too many iterations are skipped.

  ==== Test Assertion Failure ====
  rseq_test.c:228: i > (NR_TASK_MIGRATIONS / 2)
  pid=10127 tid=10127 errno=4 - Interrupted system call
     1  0x00000000004018e5: main at rseq_test.c:227
     2  0x00007fcc8fc66bf6: ?? ??:0
     3  0x0000000000401959: _start at ??:?
  Only performed 4 KVM_RUNs, task stalled too much?

Calculate the min/max possible CPUs as a cheap "best effort" to avoid
high runtimes when the test is affined to a small percentage of CPUs.
Alternatively, a list or xarray of the possible CPUs could be used, but
even in a horrendously inefficient setup, such optimizations are not
needed because the runtime is completely dominated by the cost of
migrating the task, and the absolute runtime is well under a minute in
even truly absurd setups, e.g. running on a subset of vCPUs in a VM that
is heavily overcommited (16 vCPUs per pCPU).

Fixes: 61e52f1630 ("KVM: selftests: Add a test for KVM_RUN+rseq to detect task migration bugs")
Reported-by: Dongli Zhang <dongli.zhang@oracle.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210929234112.1862848-1-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-09-30 04:25:57 -04:00
..
aarch64 selftests: KVM: Introduce psci_cpu_on_test 2021-08-19 09:08:57 +01:00
include selftests: KVM: Don't clobber XMM register when read 2021-09-28 11:31:29 -04:00
lib KVM: selftests: Refactor help message for -s backing_src 2021-09-22 10:33:14 -04:00
s390x KVM: selftests: sync_regs test for diag318 2020-12-10 13:36:05 +01:00
x86_64 KVM: x86: selftests: test simultaneous uses of V_IRQ from L1 and L0 2021-09-23 10:05:07 -04:00
.gitignore KVM: x86: selftests: test simultaneous uses of V_IRQ from L1 and L0 2021-09-23 10:05:07 -04:00
access_tracking_perf_test.c KVM: selftests: Refactor help message for -s backing_src 2021-09-22 10:33:14 -04:00
config selftests: kvm: Adding config fragments 2019-08-09 16:52:38 +02:00
demand_paging_test.c KVM: selftests: Refactor help message for -s backing_src 2021-09-22 10:33:14 -04:00
dirty_log_perf_test.c KVM: selftests: Create a separate dirty bitmap per slot 2021-09-22 10:33:14 -04:00
dirty_log_test.c tools: rename bitmap_alloc() to bitmap_zalloc() 2021-09-08 11:50:27 -07:00
hardware_disable_test.c KVM: selftests: Unconditionally use memslot 0 when loading elf binary 2021-06-24 04:31:17 -04:00
kvm_binary_stats_test.c KVM: selftests: Add checks for histogram stats bucket_size field 2021-08-20 16:06:32 -04:00
kvm_create_max_vcpus.c KVM: selftests: Convert some printf's to pr_info's 2020-03-16 17:57:07 +01:00
kvm_page_table_test.c KVM: selftests: Refactor help message for -s backing_src 2021-09-22 10:33:14 -04:00
Makefile KVM: x86: selftests: test simultaneous uses of V_IRQ from L1 and L0 2021-09-23 10:05:07 -04:00
memslot_modification_stress_test.c KVM: selftests: Move vcpu_args_set into perf_test_util 2021-08-06 10:01:40 -04:00
memslot_perf_test.c KVM: selftests: Unconditionally use memslot '0' for page table allocations 2021-06-24 11:47:48 -04:00
rseq_test.c KVM: selftests: Ensure all migrations are performed when test is affined 2021-09-30 04:25:57 -04:00
set_memory_region_test.c Merge tag 'kvm-s390-master-5.14-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux into HEAD 2021-07-14 12:14:27 -04:00
settings selftests: kvm: Raise the default timeout to 120 seconds 2021-02-09 08:17:08 -05:00
steal_time.c selftests: KVM: Align SMCCC call with the spec in steal_time 2021-09-22 10:33:08 -04:00