From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753025Ab0LIQWO (ORCPT ); Thu, 9 Dec 2010 11:22:14 -0500 Received: from mail.openrapids.net ([64.15.138.104]:55342 "EHLO blackscsi.openrapids.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750972Ab0LIQWN (ORCPT ); Thu, 9 Dec 2010 11:22:13 -0500 Date: Thu, 9 Dec 2010 11:22:11 -0500 From: Mathieu Desnoyers To: Steven Rostedt , Frederic Weisbecker , Ingo Molnar , linux-kernel@vger.kernel.org Cc: 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: [RFC PATCH] ftrace trace event: introduce assignment macros Message-ID: <20101209162210.GB6769@Krystal> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Editor: vi X-Info: http://www.efficios.com X-Operating-System: Linux/2.6.26-2-686 (i686) X-Uptime: 11:16:43 up 15 days, 21:19, 5 users, load average: 0.02, 0.01, 0.00 User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) + +/* * 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