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] [day] [month] [year] [list]
Date:	Tue, 29 Jan 2013 09:27:41 -0500
From:	Steven Rostedt <rostedt@...dmis.org>
To:	chenggang <chenggang.qin@...il.com>
Cc:	linux-kernel@...r.kernel.org,
	Frederic Weisbecker <fweisbec@...il.com>,
	Ingo Molnar <mingo@...hat.com>,
	David Ahern <dsahern@...il.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Paul Mackerras <paulus@...ba.org>,
	Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
	Arjan van de Ven <arjan@...ux.intel.com>,
	Namhyung Kim <namhyung@...il.com>,
	Yanmin Zhang <yanmin.zhang@...el.com>,
	Wu Fengguang <fengguang.wu@...el.com>,
	Mike Galbraith <efault@....de>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Chenggang Qin <chenggang.qcg@...baba-inc.com>
Subject: Re: [PATCH] Tracepoint Event: Add 4 tracepoint events for vfs
 subsystem.

On Tue, 2013-01-29 at 15:25 +0800, chenggang wrote:

> ---
>  include/trace/events/vfs.h |  110 ++++++++++++++++++++++++++++++++++++++++++++
>  mm/filemap.c               |   18 ++++++++
>  2 files changed, 128 insertions(+)
>  create mode 100644 include/trace/events/vfs.h
> 
> diff --git a/include/trace/events/vfs.h b/include/trace/events/vfs.h
> new file mode 100644
> index 0000000..33498e1
> --- /dev/null
> +++ b/include/trace/events/vfs.h
> @@ -0,0 +1,110 @@
> +#undef TRACE_SYSTEM
> +#define TRACE_SYSTEM vfs
> +#define TRACE_INCLUDE_FILE vfs
> +
> +#if !defined(_TRACE_EVENTS_VFS_H) || defined(TRACE_HEADER_MULTI_READ)
> +#define _TRACE_EVENTS_VFS_H
> +
> +#include <linux/tracepoint.h>
> +
> +#include <asm/ptrace.h>
> +
> +TRACE_EVENT(generic_file_aio_read,
> +
> +	TP_PROTO(long long pos, unsigned long bytes, unsigned char *fname),
> +
> +	TP_ARGS(pos, bytes, fname),
> +
> +	TP_STRUCT__entry(
> +		__field(	long long,	pos		)
> +		__field(	unsigned long,	bytes		)
> +		__array(	unsigned char,	fname,	100	)

100 bytes is a big waste of space in the ring buffer. Please use dynamic
string, unless fname is always a 100 bytes in length:

	__string(	fname,		fname		)


> +	),
> +
> +	TP_fast_assign(
> +		__entry->pos	= pos;
> +		__entry->bytes	= bytes;
> +		strncpy(__entry->fname, fname, 100);

Then here add:

	__assign_str(fname, fname);

> +	),
> +
> +	TP_printk("aio read(Filename: %s Pos: %lld Bytes: %lu)",
> +		  __entry->fname, __entry->pos, __entry->bytes)
> +);
> +
> +TRACE_EVENT_FLAGS(generic_file_aio_read, TRACE_EVENT_FL_CAP_ANY)
> +
> +TRACE_EVENT(generic_file_aio_write,
> +
> +	TP_PROTO(long long pos, unsigned long bytes, unsigned char *fname),
> +
> +	TP_ARGS(pos, bytes, fname),
> +
> +	TP_STRUCT__entry(
> +		__field(	long long,	pos		)
> +		__field(	unsigned long,	bytes		)
> +		__array(	unsigned char,	fname,	100	)
> +	),
> +
> +	TP_fast_assign(
> +		__entry->pos	= pos;
> +		__entry->bytes	= bytes;
> +		strncpy(__entry->fname, fname, 100);
> +	),
> +
> +	TP_printk("aio write(Filename: %s Pos: %lld Bytes: %lu)",
> +		  __entry->fname, __entry->pos, __entry->bytes)
> +);
> +
> +TRACE_EVENT_FLAGS(generic_file_aio_write, TRACE_EVENT_FL_CAP_ANY)
> +
> +TRACE_EVENT(direct_io_read,
> +	TP_PROTO(long long pos, unsigned long bytes, unsigned char *fname),
> +
> +	TP_ARGS(pos, bytes, fname),
> +
> +	TP_STRUCT__entry(
> +		__field(	long long,	pos		)
> +		__field(	unsigned long,  bytes		)
> +		__array(	unsigned char,	fname,  100	)
> +	),
> +
> +	TP_fast_assign(
> +		__entry->pos	= pos;
> +		__entry->bytes  = bytes;
> +		strncpy(__entry->fname, fname, 100);
> +	),
> +
> +	TP_printk("direct io read(Filename: %s Pos: %lld Bytes: %lu)",
> +		  __entry->fname, __entry->pos, __entry->bytes)
> +);
> +
> +TRACE_EVENT_FLAGS(direct_io_read, TRACE_EVENT_FL_CAP_ANY)
> +
> +TRACE_EVENT(direct_io_write,
> +	TP_PROTO(long long pos, unsigned long bytes, unsigned char *fname),
> +
> +	TP_ARGS(pos, bytes, fname),
> +
> +	TP_STRUCT__entry(
> +		__field(	long long,	pos		)
> +		__field(	unsigned long,  bytes		)
> +		__array(	unsigned char,	fname,	100	)
> +	),
> +
> +	TP_fast_assign(
> +		__entry->pos	= pos;
> +		__entry->bytes	= bytes;
> +		strncpy(__entry->fname, fname, 100);
> +	),
> +
> +	TP_printk("direct io write(Filename: %s Pos: %lld Bytes: %lu)",
> +		  __entry->fname, __entry->pos, __entry->bytes)

All of these are identical, except that you repeat the tracepoint name
in the TP_printk format, which in unnecessary, as the tracepoint name is
always printed in the trace. Please create a single
DECLACE_EVENT_CLASS() and create 4 DEFINE_EVENTS(). Every TRACE_EVENT
costs about 5k in code. A DECLARE_EVENT_CLASS() costs about 4.5k, and
each DEFINE_EVENT costs about 250 bytes.

-- Steve

> +);
> +
> +TRACE_EVENT_FLAGS(direct_io_write, TRACE_EVENT_FL_CAP_ANY)
> +
> +#endif /* _TRACE_EVENTS_SYSCALLS_H */
> +
> +/* This part must be outside protection */
> +#include <trace/define_trace.h>
> +
> diff --git a/mm/filemap.c b/mm/filemap.c
> index 83efee7..0310e7b 100644
> --- a/mm/filemap.c
> +++ b/mm/filemap.c
> @@ -42,6 +42,9 @@
>  
>  #include <asm/mman.h>
>  
> +#define CREATE_TRACE_POINTS
> +#include <trace/events/vfs.h>
> +
>  /*


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