From mboxrd@z Thu Jan 1 00:00:00 1970 From: paulmck@linux.vnet.ibm.com (Paul E. McKenney) Date: Wed, 21 Sep 2011 16:42:42 -0700 Subject: [ltt-dev] [URCU PATCH] cmm: provide lightweight rmb/wmb on PPC In-Reply-To: <4E78C1C5.2080001@redhat.com> References: <1316502769-576-1-git-send-email-pbonzini@redhat.com> <20110920163125.GA31802@Krystal> <4E78C1C5.2080001@redhat.com> Message-ID: <20110921234242.GG2394@linux.vnet.ibm.com> On Tue, Sep 20, 2011 at 06:39:33PM +0200, Paolo Bonzini wrote: > On 09/20/2011 06:31 PM, Mathieu Desnoyers wrote: > >I don't think lwsync orders non-cacheable memory operations. Therefore, > >is it the right choice for cmm_rmb/cmm_wmb ? > > I think you're right. "eieio;lwsync" is good for rmb, lwsync is good > for wmb/smp_rmb/smp_wmb. But eieio;lwsync won't order non-cacheable memory operations against cacheable memory operations. This means that your MMIO accesses can slip out of your lock-based critical section, which is a very bad thing indeed. For general-purpose use, I strongly recommend full "sync" for mb(), rmb(), and wmb(). For memory-only use, the developer should not be using these, but smp_mb(), smp_rmb(), and smp_wmb() instead. Thanx, Paul