'nr_cpus_done' is not incremented atomically; this has been observed to cause tests to stall. Fix by using a proper atomic increment. Signed-off-by: Avi Kivity <avi@xxxxxxxxxx> --- x86/vmexit.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/x86/vmexit.c b/x86/vmexit.c index 875caa3..ad8ab55 100644 --- a/x86/vmexit.c +++ b/x86/vmexit.c @@ -2,6 +2,7 @@ #include "libcflat.h" #include "smp.h" #include "processor.h" +#include "atomic.h" static unsigned int inl(unsigned short port) { @@ -121,7 +122,7 @@ static struct test { }; unsigned iterations; -volatile int nr_cpus_done; +static atomic_t nr_cpus_done; static void run_test(void *_func) { @@ -131,7 +132,7 @@ static void run_test(void *_func) for (i = 0; i < iterations; ++i) func(); - nr_cpus_done++; + atomic_inc(&nr_cpus_done); } static void do_test(struct test *test) @@ -155,10 +156,10 @@ static void do_test(struct test *test) for (i = 0; i < iterations; ++i) func(); } else { - nr_cpus_done = 0; + atomic_set(&nr_cpus_done, 0); for (i = cpu_count(); i > 0; i--) on_cpu_async(i-1, run_test, func); - while (nr_cpus_done < cpu_count()) + while (atomic_read(&nr_cpus_done) < cpu_count()) ; } t2 = rdtsc(); -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html