rcutorture: make goflag volatile
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 8 Jun 2011 22:09:19 +0000 (18:09 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 8 Jun 2011 22:09:19 +0000 (18:09 -0400)
Even cmm_barrier may not be enough as a compiler barrier in the presence
of static variables, and cmm_mb would not be either!  The compiler
assumes that calling a function does not clobber static variables if it
can prove that they do not escape (which also implies the correct phase
of the moon).

Rather than sprinkling the code with compiler barriers, I am taking the
easy way out and declaring the variable volatile.  Without this patch,
rcutorture_qsbr never finishes for me (GCC 4.5.0).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
tests/rcutorture.h

index c5253d9cfead570db75313d237cd28b12b42e704..5ba3d2b0e85312318a3e849a1d98c6050faedbf4 100644 (file)
@@ -79,7 +79,8 @@ char argsbuf[64];
 #define GOFLAG_RUN  1
 #define GOFLAG_STOP 2
 
-int goflag __attribute__((__aligned__(CAA_CACHE_LINE_SIZE))) = GOFLAG_INIT;
+volatile int goflag __attribute__((__aligned__(CAA_CACHE_LINE_SIZE)))
+        = GOFLAG_INIT;
 
 #define RCU_READ_RUN 1000
 
This page took 0.02535 seconds and 4 git commands to generate.