From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Zijlstra Subject: Re: [Bug #11989] Suspend failure on NForce4-based boards due to chanes in stop_machine Date: Tue, 11 Nov 2008 14:49:01 +0100 Message-ID: <1226411341.7685.1779.camel@twins> References: <20081110120401.GA15518@osiris.boeblingen.de.ibm.com> <200811101547.21325.rjw@sisk.pl> <200811102355.42389.rjw@sisk.pl> <20081111105214.GA15645@elte.hu> <19f34abd0811110536i71994436q4aa78a99d201c478@mail.gmail.com> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <19f34abd0811110536i71994436q4aa78a99d201c478-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> Sender: kernel-testers-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: Content-Type: text/plain; charset="us-ascii" To: Vegard Nossum Cc: Ingo Molnar , "Rafael J. Wysocki" , Heiko Carstens , Linux Kernel Mailing List , Kernel Testers List , Rusty Russell , Oleg Nesterov , Dmitry Adamushko , Andrew Morton On Tue, 2008-11-11 at 14:36 +0100, Vegard Nossum wrote: > On Tue, Nov 11, 2008 at 11:52 AM, Ingo Molnar wrote: > > [ Cc:-ed workqueue/locking/suspend-race-condition experts. ] > > Heh. I am not expert, but I looked at the code. The obvious suspicious > thing to see is the use of unpaired barriers? Maybe like this: > > 47 static void set_state(enum stopmachine_state newstate) > 48 { > 49 /* Reset ack counter. */ > 50 atomic_set(&thread_ack, num_threads); > 51 smp_wmb(); > > + /* force ordering between thread_ack/state */ > > 52 state = newstate; > 53 } > 54 > 55 /* Last one to ack a state moves to the next state. */ > 56 static void ack_state(void) > 57 { > 58 if (atomic_dec_and_test(&thread_ack)) > > Maybe > + /* force ordering between thread_ack/state */ > + smp_rmb(); > here? all atomic ops that have return values imply a full barrier, iirc > 59 set_state(state + 1); > 60 } > 61 > > Or maybe I am wrong. But Documentation/memory-barriers.txt is rather > explicit on this point. > > > Vegard >