From: David Matlack Add a '-v' flag to tools/testing/selftests/kvm/irq_test.c to allow users to configure the number of vCPUs to run in the test. 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 43338eb3ab41..6fd082d37f9a 100644 --- a/tools/testing/selftests/kvm/irq_test.c +++ b/tools/testing/selftests/kvm/irq_test.c @@ -139,7 +139,7 @@ static void kvm_clear_gsi_routes(struct kvm_vm *vm) static void help(const char *name) { - printf("Usage: %s [-a] [-b] [-c] [-d ] [-h] [-i nr_irqs] [-m] [-n]\n", name); + printf("Usage: %s [-a] [-b] [-c] [-d ] [-h] [-i nr_irqs] [-m] [-n] [-v nr_vcpus]\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"); @@ -149,6 +149,7 @@ static void help(const char *name) printf("-i The number of IRQs to generate during the test\n"); printf("-m Pin vCPU threads to random physical CPUs throughout the test\n"); printf("-n Deliver 50 percent of IRQs as non-maskable interrupts\n"); + printf("-v Number of vCPUS to run\n"); printf("\n"); exit(KSFT_FAIL); } @@ -182,7 +183,7 @@ int main(int argc, char **argv) struct iommu *iommu; struct kvm_vm *vm; - while ((c = getopt(argc, argv, "abcd:hi:mn")) != -1) { + while ((c = getopt(argc, argv, "abcd:hi:mnv:")) != -1) { switch (c) { case 'a': irq_affinity = true; @@ -205,6 +206,9 @@ int main(int argc, char **argv) case 'n': use_nmi = true; break; + case 'v': + nr_vcpus = atoi_positive("Number of vCPUS", optarg); + break; case 'h': default: help(argv[0]); -- 2.54.0.rc2.533.g4f5dca5207-goog