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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090415014548.GA7984@Krystal>
Date:	Tue, 14 Apr 2009 21:45:48 -0400
From:	Mathieu Desnoyers <compudj@...stal.dyndns.org>
To:	Jeremy Fitzhardinge <jeremy@...p.org>
Cc:	Steven Rostedt <rostedt@...dmis.org>, linux-kernel@...r.kernel.org,
	Ingo Molnar <mingo@...e.hu>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Peter Zijlstra <peterz@...radead.org>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Theodore Tso <tytso@....edu>,
	Arjan van de Ven <arjan@...radead.org>,
	Christoph Hellwig <hch@....de>,
	Lai Jiangshan <laijs@...fujitsu.com>,
	Zhaolei <zhaolei@...fujitsu.com>, Li Zefan <lizf@...fujitsu.com>,
	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
	Masami Hiramatsu <mhiramat@...hat.com>,
	"Frank Ch. Eigler" <fche@...stic.org>,
	Tom Zanussi <tzanussi@...il.com>,
	Jiaying Zhang <jiayingz@...gle.com>,
	Michael Rubin <mrubin@...gle.com>,
	Martin Bligh <mbligh@...gle.com>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Neil Horman <nhorman@...driver.com>,
	Eduard - Gabriel Munteanu <eduard.munteanu@...ux360.ro>,
	Pekka Enberg <penberg@...helsinki.fi>
Subject: Re: [PATCH 2/8] tracing: create automated trace defines

* Jeremy Fitzhardinge (jeremy@...p.org) wrote:
> How about something like this:
>
> From f7fa71c046bc383706bf58503c4b75e05e252152 Mon Sep 17 00:00:00 2001
> From: Jeremy Fitzhardinge <jeremy.fitzhardinge@...rix.com>
> Date: Tue, 14 Apr 2009 16:41:18 -0700
> Subject: [PATCH] tracing: move __DO_TRACE out of line
>
> Mainly simplify linux/tracepoint.h's include dependencies (removes
> rcupdate.h), but it can't help with icache locality, since it
> definitely moves the code out of line, rather than relying on gcc
> to do it.
>
> Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@...rix.com>
>
> diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
> index 4353f3f..1052e33 100644
> --- a/include/linux/tracepoint.h
> +++ b/include/linux/tracepoint.h
> @@ -15,7 +15,6 @@
>  */
>
> #include <linux/types.h>
> -#include <linux/rcupdate.h>
>
> struct module;
> struct tracepoint;
> @@ -42,19 +41,20 @@ struct tracepoint {
>  * it_func[0] is never NULL because there is at least one element in the array
>  * when the array itself is non NULL.
>  */
> -#define __DO_TRACE(tp, proto, args)					\
> -	do {								\
> +#define DEFINE_DO_TRACE(name, proto, args)				\
> +	void __do_trace_##name(struct tracepoint *tp, TP_PROTO(proto))	\

I fear that won't work with "void" prototype. If we need this kind of
flexibility, we will need to create a special case for empty prototype.

Mathieu

> +	{								\
> 		void **it_func;						\
> 									\
> 		rcu_read_lock_sched_notrace();				\
> -		it_func = rcu_dereference((tp)->funcs);			\
> +		it_func = rcu_dereference(tp->funcs);			\
> 		if (it_func) {						\
> 			do {						\
> 				((void(*)(proto))(*it_func))(args);	\
> 			} while (*(++it_func));				\
> 		}							\
> 		rcu_read_unlock_sched_notrace();			\
> -	} while (0)
> +	}
>
> /*
>  * Make sure the alignment of the structure in the __tracepoints section will
> @@ -63,11 +63,13 @@ struct tracepoint {
>  */
> #define DECLARE_TRACE(name, proto, args)				\
> 	extern struct tracepoint __tracepoint_##name;			\
> +	extern void __do_trace_##name(struct tracepoint *tp,		\
> +				      TP_PROTO(proto));			\
> 	static inline void trace_##name(proto)				\
> 	{								\
> 		if (unlikely(__tracepoint_##name.state))		\
> -			__DO_TRACE(&__tracepoint_##name,		\
> -				TP_PROTO(proto), TP_ARGS(args));	\
> +			__do_trace_##name(&__tracepoint_##name,		\
> +					  TP_ARGS(args));		\
> 	}								\
> 	static inline int register_trace_##name(void (*probe)(proto))	\
> 	{								\
> @@ -151,10 +153,7 @@ extern int tracepoint_get_iter_range(struct tracepoint **tracepoint,
>  * probe unregistration and the end of module exit to make sure there is no
>  * caller executing a probe when it is freed.
>  */
> -static inline void tracepoint_synchronize_unregister(void)
> -{
> -	synchronize_sched();
> -}
> +extern void tracepoint_synchronize_unregister(void);
>
> #define PARAMS(args...) args
>
> diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h
> index 980eb66..1a0502e 100644
> --- a/include/trace/define_trace.h
> +++ b/include/trace/define_trace.h
> @@ -24,14 +24,17 @@
>
> #undef TRACE_EVENT
> #define TRACE_EVENT(name, proto, args, tstruct, assign, print)	\
> +	DEFINE_DO_TRACE(name, TP_PROTO(proto), TP_ARGS(args))	\
> 	DEFINE_TRACE(name)
>
> #undef TRACE_FORMAT
> -#define TRACE_FORMAT(name, proto, args, print)	\
> +#define TRACE_FORMAT(name, proto, args, print)			\
> +	DEFINE_DO_TRACE(name, TP_PROTO(proto), TP_ARGS(args))	\
> 	DEFINE_TRACE(name)
>
> #undef DECLARE_TRACE
> -#define DECLARE_TRACE(name, proto, args)	\
> +#define DECLARE_TRACE(name, proto, args)			\
> +	DEFINE_DO_TRACE(name, TP_PROTO(proto), TP_ARGS(args))	\
> 	DEFINE_TRACE(name)
>
> #undef TRACE_INCLUDE
> diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
> index 1ef5d3a..6ac1f48 100644
> --- a/kernel/tracepoint.c
> +++ b/kernel/tracepoint.c
> @@ -545,6 +545,12 @@ void tracepoint_iter_reset(struct tracepoint_iter *iter)
> }
> EXPORT_SYMBOL_GPL(tracepoint_iter_reset);
>
> +void tracepoint_synchronize_unregister(void)
> +{
> +	synchronize_sched();
> +}
> +EXPORT_SYMBOL_GPL(tracepoint_synchronize_unregister);
> +
> #ifdef CONFIG_MODULES
>
> int tracepoint_module_notify(struct notifier_block *self,
>
>

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
--
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