Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750978AbYKGTdO (ORCPT ); Fri, 7 Nov 2008 14:33:14 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751121AbYKGTc5 (ORCPT ); Fri, 7 Nov 2008 14:32:57 -0500 Received: from casper.infradead.org ([85.118.1.10]:45573 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750940AbYKGTc5 (ORCPT ); Fri, 7 Nov 2008 14:32:57 -0500 Subject: Re: [RFC patch 08/18] cnt32_to_63 should use smp_rmb() From: Peter Zijlstra To: Mathieu Desnoyers Cc: Steven Rostedt , David Howells , "Paul E. McKenney" , Linus Torvalds , akpm@linux-foundation.org, Ingo Molnar , linux-kernel@vger.kernel.org, Nicolas Pitre , Ralf Baechle , benh@kernel.crashing.org, paulus@samba.org, David Miller , Ingo Molnar , Thomas Gleixner , linux-arch@vger.kernel.org In-Reply-To: <20081107191833.GA31809@Krystal> References: <20081107053349.861709786@polymtl.ca> <20081107052336.652868737@polymtl.ca> <25257.1226055312@redhat.com> <20081107170902.GD22134@Krystal> <20081107191833.GA31809@Krystal> Content-Type: text/plain Date: Fri, 07 Nov 2008 20:32:02 +0100 Message-Id: <1226086322.31966.67.camel@lappy.programming.kicks-ass.net> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1459 Lines: 42 On Fri, 2008-11-07 at 14:18 -0500, Mathieu Desnoyers wrote: > * Steven Rostedt (rostedt@goodmis.org) wrote: > > > > On Fri, 7 Nov 2008, Mathieu Desnoyers wrote: > > > > > > __m_cnt_hi > > > is read before > > > mmio cnt_lo read > > > > > > for the detailed reasons explained in my previous discussion with > > > Nicolas here : > > > http://lkml.org/lkml/2008/10/21/1 > > > > > > I use smp_rmb() to do this on SMP systems (hrm, actually, a rmb() could > > > be required so it works also on UP systems safely wrt interrupts). > > > > smp_rmb turns into a compiler barrier on UP and should prevent the below > > description. > > > > Ah, right, preserving program order on UP should be enough. smp_rmb() > then. I'm not quite sure I'm following here. Is this a global hardware clock you're reading from multiple cpus, if so, are you sure smp_rmb() will indeed be enough to sync the read? (In which case the smp_wmb() is provided by the hardware increasing the clock?) If these are per-cpu clocks then even in the smp case we'd be good with a plain barrier() because you'd only ever want to read your own cpu's clock (and have a separate __m_cnt_hi per cpu). Or am I totally missing out on something? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/