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]
Date:	Mon, 10 Aug 2009 16:13:05 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Frederic Weisbecker <fweisbec@...il.com>
Cc:	Ingo Molnar <mingo@...e.hu>, LKML <linux-kernel@...r.kernel.org>,
	Arnaldo Carvalho de Melo <acme@...hat.com>,
	Mike Galbraith <efault@....de>,
	Paul Mackerras <paulus@...ba.org>
Subject: Re: [PATCH 6/3] perfcounter: Substract the buffer size field from
 the event record size

On Mon, 2009-08-10 at 16:11 +0200, Frederic Weisbecker wrote:

> From: Frederic Weisbecker <fweisbec@...il.com>
> Date: Mon, 10 Aug 2009 15:56:46 +0200
> Subject: [PATCH 6/3] perfcounter: Substract the buffer size field from the event record size
> 
> We compute the perf raw sample size by aligning the raw ftrace event
> size plus the buffer size field itself. We do that instead of aligning
> only the perf raw sample size, so that we might economize some in some
> cases.
> 
> But this buffer size field is not stored in the perf raw sample, we
> must then substract its size from the buffer once we computed the
> alignment unless we may get a useless u32 field in the buffer.
> 
> Signed-off-by: Frederic Weisbecker <fweisbec@...il.com>

Acked-by: Peter Zijlstra <a.p.zijlstra@...llo.nl>

Thanks!

> ---
>  include/trace/ftrace.h      |    8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
> index 4dc1a60..f98ff56 100644
> --- a/include/trace/ftrace.h
> +++ b/include/trace/ftrace.h
> @@ -639,7 +639,12 @@ __attribute__((section("_ftrace_events"))) event_##call = {		\
>   *	pc = preempt_count();
>   *
>   *	__data_size = ftrace_get_offsets_<call>(&__data_offsets, args);
> - *	__entry_size = __data_size + sizeof(*entry);
> + *
> + *	// Below we want to get the aligned size by taking into account
> + *	// the u32 field that will later store the buffer size
> + *	__entry_size = ALIGN(__data_size + sizeof(*entry) + sizeof(u32),
> + *			     sizeof(u64));
> + *	__entry_size -= sizeof(u32);
>   *
>   *	do {
>   *		char raw_data[__entry_size]; <- allocate our sample in the stack
> @@ -689,6 +694,7 @@ static void ftrace_profile_##call(proto)				\
>  	__data_size = ftrace_get_offsets_##call(&__data_offsets, args); \
>  	__entry_size = ALIGN(__data_size + sizeof(*entry) + sizeof(u32),\
>  			     sizeof(u64));				\
> +	__entry_size -= sizeof(u32);					\
>  									\
>  	do {								\
>  		char raw_data[__entry_size];				\
--
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