KVM: arm64: selftests: Enable tuning of error margin in arch_timer test
authorHaibo Xu <haibo1.xu@intel.com>
Mon, 22 Jan 2024 09:58:33 +0000 (17:58 +0800)
committerAnup Patel <anup@brainfault.org>
Mon, 26 Feb 2024 04:43:56 +0000 (10:13 +0530)
commitd1dafd065a23e47a559f30573bffa600e527ff2a
tree2768c005b04ce7f22208d862a45c85c3a48fe2a5
parentf0617e4ac2b2fb69369486e09d0ce7653cd94985
KVM: arm64: selftests: Enable tuning of error margin in arch_timer test

There are intermittent failures occurred when stressing the
arch-timer test in a Qemu VM:

 Guest assert failed,  vcpu 0; stage; 4; iter: 3
 ==== Test Assertion Failure ====
   aarch64/arch_timer.c:196: config_iter + 1 == irq_iter
   pid=4048 tid=4049 errno=4 - Interrupted system call
      1  0x000000000040253b: test_vcpu_run at arch_timer.c:248
      2  0x0000ffffb60dd5c7: ?? ??:0
      3  0x0000ffffb6145d1b: ?? ??:0
   0x3 != 0x2 (config_iter + 1 != irq_iter)e

Further test and debug show that the timeout for an interrupt
to arrive do have random high fluctuation, espectially when
testing in an virtual environment.

To alleviate this issue, just expose the timeout value as user
configurable and print some hint message to increase the value
when hitting the failure..

Signed-off-by: Haibo Xu <haibo1.xu@intel.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Anup Patel <anup@brainfault.org>
tools/testing/selftests/kvm/aarch64/arch_timer.c