lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20101209162210.GB6769@Krystal>
Date:	Thu, 9 Dec 2010 11:22:11 -0500
From:	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To:	Steven Rostedt <rostedt@...dmis.org>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org
Cc:	Li Zefan <lizf@...fujitsu.com>, William Cohen <wcohen@...hat.com>,
	Jun'ichi Nomura <j-nomura@...jp.nec.com>,
	Theodore Ts'o <tytso@....edu>, Jason Baron <jbaron@...hat.com>,
	Mel Gorman <mel@....ul.ie>,
	Eduard - Gabriel Munteanu <eduard.munteanu@...ux360.ro>,
	Marcelo Tosatti <mtosatti@...hat.com>,
	Avi Kivity <avi@...hat.com>, Gleb Natapov <gleb@...hat.com>,
	Hidetoshi Seto <seto.hidetoshi@...fujitsu.com>,
	Neil Horman <nhorman@...driver.com>,
	Arjan van de Ven <arjan@...ux.intel.com>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Kei Tokunaga <tokunaga.keiich@...fujitsu.com>,
	"Martin K. Petersen" <martin.petersen@...cle.com>,
	Oleg Nesterov <oleg@...hat.com>,
	Masami Hiramatsu <mhiramat@...hat.com>,
	Josh Stone <jistone@...hat.com>,
	Xiao Guangrong <xiaoguangrong@...fujitsu.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Zhaolei <zhaolei@...fujitsu.com>,
	Anton Blanchard <anton@...ba.org>
Subject: [RFC PATCH] ftrace trace event: introduce assignment macros

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 <mathieu.desnoyers@...icios.com>
CC: Steven Rostedt <rostedt@...dmis.org>
CC: Frederic Weisbecker <fweisbec@...il.com>
CC: Ingo Molnar <mingo@...hat.com>
CC: Li Zefan <lizf@...fujitsu.com>
CC: William Cohen <wcohen@...hat.com>
CC: Jun'ichi Nomura <j-nomura@...jp.nec.com>
CC: Theodore Ts'o <tytso@....edu>
CC: Jason Baron <jbaron@...hat.com>
CC: Mel Gorman <mel@....ul.ie>
CC: Eduard - Gabriel Munteanu <eduard.munteanu@...ux360.ro>
CC: Marcelo Tosatti <mtosatti@...hat.com>
CC: Avi Kivity <avi@...hat.com>
CC: Gleb Natapov <gleb@...hat.com>
CC: Hidetoshi Seto <seto.hidetoshi@...fujitsu.com>
CC: Neil Horman <nhorman@...driver.com>
CC: Arjan van de Ven <arjan@...ux.intel.com>
CC: Peter Zijlstra <a.p.zijlstra@...llo.nl>
CC: Kei Tokunaga <tokunaga.keiich@...fujitsu.com>
CC: Martin K. Petersen <martin.petersen@...cle.com>
CC: Oleg Nesterov <oleg@...hat.com>
CC: Masami Hiramatsu <mhiramat@...hat.com>
CC: Josh Stone <jistone@...hat.com>
CC: Xiao Guangrong <xiaoguangrong@...fujitsu.com>
CC: Thomas Gleixner <tglx@...utronix.de>
CC: Zhaolei <zhaolei@...fujitsu.com>
CC: Anton Blanchard <anton@...ba.org>
---
 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 <trace/trace_events.h> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ