Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759142AbYA3NIj (ORCPT ); Wed, 30 Jan 2008 08:08:39 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754195AbYA3NIb (ORCPT ); Wed, 30 Jan 2008 08:08:31 -0500 Received: from ms-smtp-01.nyroc.rr.com ([24.24.2.55]:60916 "EHLO ms-smtp-01.nyroc.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752413AbYA3NIa (ORCPT ); Wed, 30 Jan 2008 08:08:30 -0500 Date: Wed, 30 Jan 2008 08:08:16 -0500 (EST) From: Steven Rostedt X-X-Sender: rostedt@gandalf.stny.rr.com To: Peter Zijlstra cc: LKML , Ingo Molnar , Linus Torvalds , Andrew Morton , Christoph Hellwig , Mathieu Desnoyers , Gregory Haskins , Arnaldo Carvalho de Melo , Thomas Gleixner , Tim Bird , Sam Ravnborg , "Frank Ch. Eigler" , Jan Kiszka , John Stultz , Arjan van de Ven , Steven Rostedt Subject: Re: [PATCH 02/22 -v7] Add basic support for gcc profiler instrumentation In-Reply-To: <1201682801.28547.162.camel@lappy> Message-ID: References: <20080130031521.258552785@goodmis.org> <20080130031840.337019504@goodmis.org> <1201682801.28547.162.camel@lappy> 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: 1423 Lines: 54 On Wed, 30 Jan 2008, Peter Zijlstra wrote: > > On Tue, 2008-01-29 at 22:15 -0500, Steven Rostedt wrote: > > > +int register_mcount_function(struct mcount_ops *ops) > > +{ > > + unsigned long flags; > > + > > + spin_lock_irqsave(&mcount_func_lock, flags); > > + ops->next = mcount_list; > > + /* must have next seen before we update the list pointer */ > > + smp_wmb(); > > That comment does not explain which race it closes; this is esp > important as there is no paired barrier to give hints. OK, fair enough. I'll explain it a bit more. How's this: /* * We are entering ops into the mcount_list but another * CPU might be walking that list. We need to make sure * the ops->next pointer is valid before another CPU sees * the ops pointer included into the mcount_list. */ -- Steve > > > + mcount_list = ops; > > + /* > > + * For one func, simply call it directly. > > + * For more than one func, call the chain. > > + */ > > + if (ops->next == &mcount_list_end) > > + mcount_trace_function = ops->func; > > + else > > + mcount_trace_function = mcount_list_func; > > + spin_unlock_irqrestore(&mcount_func_lock, flags); > > + > > + return 0; > > +} > > > -- 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/