Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757457AbYAPBjU (ORCPT ); Tue, 15 Jan 2008 20:39:20 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755162AbYAPBjE (ORCPT ); Tue, 15 Jan 2008 20:39:04 -0500 Received: from ms-smtp-04.nyroc.rr.com ([24.24.2.58]:50217 "EHLO ms-smtp-04.nyroc.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754289AbYAPBjD (ORCPT ); Tue, 15 Jan 2008 20:39:03 -0500 Date: Tue, 15 Jan 2008 20:38:43 -0500 (EST) From: Steven Rostedt X-X-Sender: rostedt@gandalf.stny.rr.com To: Mathieu Desnoyers cc: LKML , Ingo Molnar , Linus Torvalds , Andrew Morton , Peter Zijlstra , Christoph Hellwig , Gregory Haskins , Arnaldo Carvalho de Melo , Thomas Gleixner , Tim Bird , Sam Ravnborg , "Frank Ch. Eigler" , Steven Rostedt Subject: Re: [RFC PATCH 16/22 -v2] add get_monotonic_cycles In-Reply-To: <20080115220824.GB22242@Krystal> Message-ID: References: <20080109232914.676624725@goodmis.org> <20080109233044.777564395@goodmis.org> <20080115214636.GD17439@Krystal> <20080115220824.GB22242@Krystal> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1825 Lines: 67 On Tue, 15 Jan 2008, Mathieu Desnoyers wrote: > > Ok, but what actually insures that the clock->cycle_* reads won't be > reordered across the clocksource_read() ? Hmm, interesting.I didn't notice that clocksource_read() is a static inline. I was thinking that since it was passing a pointer to a function, gcc could not assume that it could move that code across it. But now looking to see that clocksource_read is simply a static inline that does: cs->read(); But still, can gcc assume that it can push loads of unknown origin variables across function calls? So something like: static int *glob; void foo(void) { int x; x = *glob; bar(); if (x != *glob) /* ... */ } I can't see how any compiler could honestly move the loading of the first x after the calling of bar(). With glob pointing to some unknown variable, that may be perfectly fine for bar to modify. > > > > > > > + cycle_raw = clock->cycle_raw; > > > > + cycle_last = clock->cycle_last; > > > > + > > > > + /* read clocksource: */ > > > > + cycle_now = clocksource_read(clock); So the question here is,can cycle_raw and cycle_last be loaded from the unknown source that clock points to after the call to clocksource_read()? I'm thinking not. > > > > + > > > > + /* calculate the delta since the last update_wall_time: */ > > > > + cycle_delta = (cycle_now - cycle_last) & clock->mask; > > > > + > > > > + } while (cycle_raw != clock->cycle_raw || > > > > + cycle_last != clock->cycle_last); > > > > + > > > > + return cycle_raw + cycle_delta; > > > > +} -- Steve -- 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/