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: <20100507180628.GB5401@nowhere>
Date:	Fri, 7 May 2010 20:06:30 +0200
From:	Frederic Weisbecker <fweisbec@...il.com>
To:	Steven Rostedt <rostedt@...dmis.org>
Cc:	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>,
	Arnaldo Carvalho de Melo <acme@...hat.com>,
	Mathieu Desnoyers <compudj@...stal.dyndns.org>,
	Lai Jiangshan <laijs@...fujitsu.com>,
	Li Zefan <lizf@...fujitsu.com>,
	Masami Hiramatsu <mhiramat@...hat.com>,
	Christoph Hellwig <hch@....de>,
	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Subject: Re: [PATCH 2/9 - v2][RFC] tracing: Let tracepoints have data
	passed to tracepoint callbacks

On Fri, May 07, 2010 at 10:09:31AM -0400, Steven Rostedt wrote:
> > > +#define DECLARE_TRACE(name, proto, args)				\
> > > +		__DECLARE_TRACE(name, PARAMS(proto), PARAMS(args),	\
> > > +				PARAMS(proto, void *__data),		\
> > > +				PARAMS(args, __data))
> > >  
> > >  #define DEFINE_TRACE_FN(name, reg, unreg)				\
> > >  	static const char __tpstrtab_##name[]				\
> > > @@ -100,19 +133,37 @@ extern void tracepoint_update_probe_range(struct tracepoint *begin,
> > >  	struct tracepoint *end);
> > >  
> > >  #else /* !CONFIG_TRACEPOINTS */
> > > -#define DECLARE_TRACE(name, proto, args)				\
> > > -	static inline void _do_trace_##name(struct tracepoint *tp, proto) \
> > > -	{ }								\
> > > +#define __DECLARE_TRACE(name, proto, args, data_proto, data_args)	\
> > >  	static inline void trace_##name(proto)				\
> > > -	{ }								\
> > > +	{								\
> > > +	}								\
> > >  	static inline int register_trace_##name(void (*probe)(proto))	\
> > >  	{								\
> > >  		return -ENOSYS;						\
> > >  	}								\
> > > -	static inline int unregister_trace_##name(void (*probe)(proto))	\
> > > +	static inline int unregister_trace_##name(void (*probe)(proto)) \
> > > +	{								\
> > > +		return -ENOSYS;						\
> > > +	}								\
> > > +	static inline int						\
> > > +	register_trace_##name##_data(void (*probe)(data_proto),		\
> > > +				     void *data)			\
> > > +	{								\
> > > +		return -ENOSYS;						\
> > > +	}								\
> > > +	static inline int						\
> > > +	unregister_trace_##name##_data(void (*probe)(data_proto),	\
> > > +				       void *data)			\
> > >  	{								\
> > >  		return -ENOSYS;						\
> > >  	}
> > > +#define DECLARE_TRACE_NOARGS(name)					\
> > > +		__DECLARE_TRACE(name, void, , void *__data, __data)
> > > +
> > > +#define DECLARE_TRACE(name, proto, args)				\
> > > +		__DECLARE_TRACE(name, PARAMS(proto), PARAMS(args),	\
> > > +				PARAMS(proto, void *__data),		\
> > > +				PARAMS(args, __data))
> > 
> > 
> > 
> > 
> > It seems that the on and off cases are exactly the same for DECLARE_TRACE*(),
> > you could provide a single version and let the __DECLARE_TRACE() do
> > the on/off trick.
> 
> 
> I don't know what you mean here. How would __DECLARE_TRACE() do what
> both DECLARE_TRACE() and DECLARE_TRACE_NOARGS() do? It will fail the
> compile if proto is "void".



No, what I meant is that you have:

#ifdef CONFIG_TRACEPOINTS
[...]
+#define DECLARE_TRACE_NOARGS(name)                                       \
      __DECLARE_TRACE(name, void, , void *__data, __data)

#define DECLARE_TRACE(name, proto, args)                         \
      __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args),      \
                      PARAMS(proto, void *__data),            \
                      PARAMS(args, __data))
[...]
#else
[...]
+#define DECLARE_TRACE_NOARGS(name)                                       \
      __DECLARE_TRACE(name, void, , void *__data, __data)

#define DECLARE_TRACE(name, proto, args)                         \
      __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args),      \
                      PARAMS(proto, void *__data),            \
                      PARAMS(args, __data)
[...]
#endif


See? They seem to be the exact same version, so this could be only
one version outside the ifdef.
And the CONFIG_TRACEPOINTS on/off case is dealt from __DECLARE_TRACE().

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