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: <1321564014.3533.13.camel@frodo>
Date:	Thu, 17 Nov 2011 16:06:54 -0500
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Cc:	Eric Dumazet <eric.dumazet@...il.com>,
	Peter Zijlstra <peterz@...radead.org>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	Ingo Molnar <mingo@...e.hu>,
	Christoph Lameter <cl@...ux-foundation.org>
Subject: Re: [RFC PATCH] Tracepoint: introduce tracepoint() API

On Thu, 2011-11-17 at 15:50 -0500, Mathieu Desnoyers wrote:
> Introduce:
> 
>   tracepoint(event_name, arg1, arg2, ...)
> 
> while keeping the old tracepoint API in place, e.g.:
> 
>   trace_event_name(arg1, arg2, ...)
> 
> This allows skipping parameter side-effects (pointer dereference,
> function calls, ...) when the tracepoint is not dynamically activated.
> 
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
> ---
> diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
> index d530a44..c9c73f7 100644
> --- a/include/linux/tracepoint.h
> +++ b/include/linux/tracepoint.h
> @@ -107,6 +107,12 @@ void tracepoint_update_probe_range(struct tracepoint * const *begin,
>  
>  #ifdef CONFIG_TRACEPOINTS
>  
> +#define tracepoint(name, args...)					\
> +	do {								\
> +		if (static_branch(&__tracepoint_##name.key))		\
> +			__trace_##name(args);				\
> +	} while (0)
> +
>  /*
>   * it_func[0] is never NULL because there is at least one element in the array
>   * when the array itself is non NULL.
> @@ -144,13 +150,17 @@ void tracepoint_update_probe_range(struct tracepoint * const *begin,
>   */
>  #define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args)	\
>  	extern struct tracepoint __tracepoint_##name;			\
> +	static inline void __trace_##name(proto)			\
> +	{								\
> +		__DO_TRACE(&__tracepoint_##name,			\
> +			TP_PROTO(data_proto),				\
> +			TP_ARGS(data_args),				\
> +			TP_CONDITION(cond));				\
> +	}								\

I wrote a patch earlier today that does almost the exact same thing, but
I had more in macro part, which I would have cleaned up after the RFC. I
didn't add another static inline, but I think this approach is a little
cleaner (with the second static inline).

I didn't post mine because I was still analyzing the assembly to make
sure it did what I expected. But I got side tracked on other things (RT
related) and didn't quite finish the analysis.

Did you do a compare of kmem_cache_alloc() to see if this fixes the
reported problem?

-- Steve

>  	static inline void trace_##name(proto)				\
>  	{								\
>  		if (static_branch(&__tracepoint_##name.key))		\
> -			__DO_TRACE(&__tracepoint_##name,		\
> -				TP_PROTO(data_proto),			\
> -				TP_ARGS(data_args),			\
> -				TP_CONDITION(cond));			\
> +			__trace_##name(args);				\
>  	}								\
>  	static inline int						\
>  	register_trace_##name(void (*probe)(data_proto), void *data)	\
> @@ -193,7 +203,12 @@ void tracepoint_update_probe_range(struct tracepoint * const *begin,
>  	EXPORT_SYMBOL(__tracepoint_##name)
>  
>  #else /* !CONFIG_TRACEPOINTS */
> +
> +#define tracepoint(name, args...)	__trace_##name(args)
> +
>  #define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args)	\
> +	static inline void __trace_##name(proto)			\
> +	{ }								\
>  	static inline void trace_##name(proto)				\
>  	{ }								\
>  	static inline int						\
> 


--
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