From mboxrd@z Thu Jan 1 00:00:00 1970 From: compudj@krystal.dyndns.org (Mathieu Desnoyers) Date: Wed, 8 Jun 2011 18:09:03 -0400 Subject: [ltt-dev] [PATCH 02/10] rcutorture: make goflag volatile In-Reply-To: <1307523558-16960-3-git-send-email-pbonzini@redhat.com> References: <1307523558-16960-1-git-send-email-pbonzini@redhat.com> <1307523558-16960-3-git-send-email-pbonzini@redhat.com> Message-ID: * Paolo Bonzini (pbonzini at redhat.com) wrote: > 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). merged, thanks! Mathieu > > Signed-off-by: Paolo Bonzini > --- > tests/rcutorture.h | 3 ++- > 1 files changed, 2 insertions(+), 1 deletions(-) > > diff --git a/tests/rcutorture.h b/tests/rcutorture.h > index c5253d9..5ba3d2b 100644 > --- a/tests/rcutorture.h > +++ b/tests/rcutorture.h > @@ -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 > > -- > 1.7.4.4 > > > > _______________________________________________ > ltt-dev mailing list > ltt-dev at lists.casi.polymtl.ca > http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev > -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com