From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Jones Subject: [PATCH kvm-unit-tests v2 8/8] x86/vmexit: apply on_cpus Date: Tue, 13 Jun 2017 11:21:57 +0200 Message-ID: <20170613092157.32049-9-drjones@redhat.com> References: <20170613092157.32049-1-drjones@redhat.com> Cc: rkrcmar@redhat.com, pbonzini@redhat.com To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:53994 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752860AbdFMJWL (ORCPT ); Tue, 13 Jun 2017 05:22:11 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 792BC7AE99 for ; Tue, 13 Jun 2017 09:22:11 +0000 (UTC) In-Reply-To: <20170613092157.32049-1-drjones@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Signed-off-by: Andrew Jones --- x86/vmexit.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/x86/vmexit.c b/x86/vmexit.c index 8d2bf1a31982..543c4772eb17 100644 --- a/x86/vmexit.c +++ b/x86/vmexit.c @@ -419,7 +419,6 @@ static struct test tests[] = { }; unsigned iterations; -static atomic_t nr_cpus_done; static void run_test(void *_func) { @@ -428,8 +427,6 @@ static void run_test(void *_func) for (i = 0; i < iterations; ++i) func(); - - atomic_inc(&nr_cpus_done); } static bool do_test(struct test *test) @@ -463,11 +460,7 @@ static bool do_test(struct test *test) for (i = 0; i < iterations; ++i) func(); } else { - atomic_set(&nr_cpus_done, 0); - for (i = cpu_count(); i > 0; i--) - on_cpu_async(i-1, run_test, func); - while (atomic_read(&nr_cpus_done) < cpu_count()) - ; + on_cpus(run_test, func); } t2 = rdtsc(); } while ((t2 - t1) < GOAL); @@ -509,8 +502,7 @@ int main(int ac, char **av) nr_cpus = cpu_count(); irq_enable(); - for (i = cpu_count(); i > 0; i--) - on_cpu(i-1, enable_nx, 0); + on_cpus(enable_nx, NULL); fadt = find_acpi_table_addr(FACP_SIGNATURE); pm_tmr_blk = fadt->pm_tmr_blk; -- 2.9.4