From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754731Ab0LIRAm (ORCPT ); Thu, 9 Dec 2010 12:00:42 -0500 Received: from mail-fx0-f43.google.com ([209.85.161.43]:37285 "EHLO mail-fx0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754219Ab0LIRAl (ORCPT ); Thu, 9 Dec 2010 12:00:41 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=hbP/DYtoWmA+jU1LdQZ+eplIkk372Zyckb4jKTfv1ylzdTPxFS8uOU6WOMCV8iUmci tjKcbV4/OjqGcjF8BfTKwJ0vY6GuqiJkKxhj6HoEbSUS8bmHFtCbGixVxSLGZOGU2Ayh EzSKpUX99kOpl95KuX2fz9ySkPAMhkdkyNYr0= Date: Thu, 9 Dec 2010 18:00:32 +0100 From: Frederic Weisbecker To: Mathieu Desnoyers Cc: Steven Rostedt , Ingo Molnar , linux-kernel@vger.kernel.org, Li Zefan , William Cohen , "Jun'ichi Nomura" , "Theodore Ts'o" , Jason Baron , Mel Gorman , Eduard - Gabriel Munteanu , Marcelo Tosatti , Avi Kivity , Gleb Natapov , Hidetoshi Seto , Neil Horman , Arjan van de Ven , Peter Zijlstra , Kei Tokunaga , "Martin K. Petersen" , Oleg Nesterov , Masami Hiramatsu , Josh Stone , Xiao Guangrong , Thomas Gleixner , Zhaolei , Anton Blanchard Subject: Re: [RFC PATCH] ftrace trace event: introduce assignment macros Message-ID: <20101209170027.GF1712@nowhere> References: <20101209162210.GB6769@Krystal> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20101209162210.GB6769@Krystal> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 09, 2010 at 11:22:11AM -0500, Mathieu Desnoyers wrote: > This patch proposes encapsulation of the raw assignments within TP_fast_assign() > by introducing tp_assign() and tp_memcpy() macros. This will allow us to: > > - generically filter from input fields, > - redefine the field write primitives. > > The current macros map directly to the old code. I changed the documentation in > tracepoint.txt to reflect these new primitives, but all TRACE_EVENT() users > should gradually update their code to use these macro wrappers rather than raw > "=" assignments or mempcy() calls. > > Signed-off-by: Mathieu Desnoyers > CC: Steven Rostedt > CC: Frederic Weisbecker > CC: Ingo Molnar > CC: Li Zefan > CC: William Cohen > CC: Jun'ichi Nomura > CC: Theodore Ts'o > CC: Jason Baron > CC: Mel Gorman > CC: Eduard - Gabriel Munteanu > CC: Marcelo Tosatti > CC: Avi Kivity > CC: Gleb Natapov > CC: Hidetoshi Seto > CC: Neil Horman > CC: Arjan van de Ven > CC: Peter Zijlstra > CC: Kei Tokunaga > CC: Martin K. Petersen > CC: Oleg Nesterov > CC: Masami Hiramatsu > CC: Josh Stone > CC: Xiao Guangrong > CC: Thomas Gleixner > CC: Zhaolei > CC: Anton Blanchard > --- > include/linux/tracepoint.h | 12 ++++++------ > include/trace/ftrace.h | 6 ++++++ > 2 files changed, 12 insertions(+), 6 deletions(-) > > Index: linux-2.6-lttng.git/include/trace/ftrace.h > =================================================================== > --- linux-2.6-lttng.git.orig/include/trace/ftrace.h > +++ linux-2.6-lttng.git/include/trace/ftrace.h > @@ -1,4 +1,10 @@ > /* > + * Macros mapping tp_assign() and tp_memcpy() to "=" and memcpy. > + */ > +#define tp_assign(dest, src) __entry->dest = src > +#define tp_memcpy(dest, src, len) memcpy(__entry->dest, src, len) Looks good. > + > +/* > * Stage 1 of the trace events. > * > * Override the macros in to include the following: > Index: linux-2.6-lttng.git/include/linux/tracepoint.h > =================================================================== > --- linux-2.6-lttng.git.orig/include/linux/tracepoint.h > +++ linux-2.6-lttng.git/include/linux/tracepoint.h > @@ -306,12 +306,12 @@ static inline void tracepoint_update_pro > * * > * > * TP_fast_assign( > - * memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN); > - * __entry->prev_pid = prev->pid; > - * __entry->prev_prio = prev->prio; > - * memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN); > - * __entry->next_pid = next->pid; > - * __entry->next_prio = next->prio; > + * tp_memcpy(next_comm, next->comm, TASK_COMM_LEN); > + * tp_assign(prev_pid, prev->pid); > + * tp_assign(prev_prio, prev->prio); > + * tp_memcpy(prev_comm, prev->comm, TASK_COMM_LEN); > + * tp_assign(next_pid, next->pid); > + * tp_assign(next_prio, next->prio); > * ) > * > * * > > -- > Mathieu Desnoyers > Operating System Efficiency R&D Consultant > EfficiOS Inc. > http://www.efficios.com