From: David Matlack Add a '-i' flag to tools/testing/selftests/kvm/irq_test.c to allow users to specify the number of IRQs generated during a test run. Co-developed-by: Josh Hilke Signed-off-by: Josh Hilke Signed-off-by: David Matlack --- tools/testing/selftests/kvm/irq_test.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/kvm/irq_test.c b/tools/testing/selftests/kvm/irq_test.c index b0c4547a7f14..de8c29baa2b0 100644 --- a/tools/testing/selftests/kvm/irq_test.c +++ b/tools/testing/selftests/kvm/irq_test.c @@ -123,13 +123,14 @@ static void kvm_clear_gsi_routes(struct kvm_vm *vm) static void help(const char *name) { - printf("Usage: %s [-a] [-b] [-c] [-d ] [-h]\n", name); + printf("Usage: %s [-a] [-b] [-c] [-d ] [-h] [-i nr_irqs]\n", name); printf("\n"); printf("Tests KVM IRQ injection via irqfd using an emulated eventfd.\n"); printf("-a Randomly affinitize the device's host IRQ to different physical CPUs throughout the test\n"); printf("-b Block vCPUs (e.g. HLT) instead of spinning in guest-mode\n"); printf("-c Destroy and recreate KVM's GSI routing table in between some interrupts\n"); printf("-d Use a VFIO device to send MSI-X interrupts instead of using an emulated eventfd\n"); + printf("-i The number of IRQs to generate during the test\n"); printf("\n"); exit(KSFT_FAIL); } @@ -164,7 +165,7 @@ int main(int argc, char **argv) unsigned int irq; int irq_cpu; - while ((c = getopt(argc, argv, "abcd:h")) != -1) { + while ((c = getopt(argc, argv, "abcd:hi:")) != -1) { switch (c) { case 'a': irq_affinity = true; @@ -178,6 +179,9 @@ int main(int argc, char **argv) case 'c': clear_routes = true; break; + case 'i': + nr_irqs = atoi_positive("Number of IRQs", optarg); + break; case 'h': default: help(argv[0]); -- 2.54.0.1032.g2f8565e1d1-goog