All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: LKML <linux-kernel@vger.kernel.org>,
	David Miller <davem@davemloft.net>,
	Steven Rostedt <rostedt@goodmis.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@elte.hu>,
	Richard Mortimer <richm@oldelvet.org.uk>,
	ben@decadent.org.uk, sparclinux@vger.kernel.org
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Subject: [patch 3/3] tracepoints: use __u64_aligned/U64_ALIGN()
Date: Fri, 21 Jan 2011 15:36:33 -0500	[thread overview]
Message-ID: <20110121203643.046218322@efficios.com> (raw)
In-Reply-To: 20110121203630.725922272@efficios.com

[-- Attachment #1: tracepoints-use-u64-aligned-as-type-and-variable-attribute.patch --]
[-- Type: text/plain, Size: 3335 bytes --]

commit 7e066fb870fcd1025ec3ba7bbde5d541094f4ce1 added the aligned(32) type and
variable attribute to the tracepoint structures to deal with gcc happily
aligning statically defined structures on 32-byte multiples.

Working on issues within Ftrace, we came up with __64_aligned, which deals with
this issue more elegantly by forcing an 8-byte alignment to both the type
declaration and variable definition.

This therefore saves space, bringing down the size of struct tracepoint from 64
bytes to 38 on 64-bit architectures.

Updating:
- The type attribute (for iteration over the struct tracepoint array)
- Added the variable attribute to the extern definition (needed to force gcc to
  consider this alignment for the following definition)
- The definition variable attribute (to force gcc to this specific alignment for
  the static definitions)
- The linker script (8-byte alignment can now replace the previous 32-byte
  alignment for the custom tracepoint section)

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: David Miller <davem@davemloft.net>
CC: Steven Rostedt <rostedt@goodmis.org>
CC: Frederic Weisbecker <fweisbec@gmail.com>
CC: Ingo Molnar <mingo@elte.hu>
---
 include/asm-generic/vmlinux.lds.h |    2 +-
 include/linux/tracepoint.h        |   12 ++++--------
 2 files changed, 5 insertions(+), 9 deletions(-)

Index: linux-2.6-lttng/include/asm-generic/vmlinux.lds.h
===================================================================
--- linux-2.6-lttng.orig/include/asm-generic/vmlinux.lds.h
+++ linux-2.6-lttng/include/asm-generic/vmlinux.lds.h
@@ -168,7 +168,7 @@
 	CPU_KEEP(exit.data)						\
 	MEM_KEEP(init.data)						\
 	MEM_KEEP(exit.data)						\
-	. = ALIGN(32);							\
+	U64_ALIGN();							\
 	VMLINUX_SYMBOL(__start___tracepoints) = .;			\
 	*(__tracepoints)						\
 	VMLINUX_SYMBOL(__stop___tracepoints) = .;			\
Index: linux-2.6-lttng/include/linux/tracepoint.h
===================================================================
--- linux-2.6-lttng.orig/include/linux/tracepoint.h
+++ linux-2.6-lttng/include/linux/tracepoint.h
@@ -33,12 +33,7 @@ struct tracepoint {
 	void (*regfunc)(void);
 	void (*unregfunc)(void);
 	struct tracepoint_func *funcs;
-} __attribute__((aligned(32)));		/*
-					 * Aligned on 32 bytes because it is
-					 * globally visible and gcc happily
-					 * align these on the structure size.
-					 * Keep in sync with vmlinux.lds.h.
-					 */
+} __u64_aligned;
 
 /*
  * Connect a probe to a tracepoint.
@@ -143,7 +138,7 @@ static inline void tracepoint_update_pro
  * structure. Force alignment to the same alignment as the section start.
  */
 #define __DECLARE_TRACE(name, proto, args, data_proto, data_args)	\
-	extern struct tracepoint __tracepoint_##name;			\
+	extern struct tracepoint __u64_aligned __tracepoint_##name;	\
 	static inline void trace_##name(proto)				\
 	{								\
 		JUMP_LABEL(&__tracepoint_##name.state, do_trace);	\
@@ -174,7 +169,8 @@ do_trace:								\
 	static const char __tpstrtab_##name[]				\
 	__attribute__((section("__tracepoints_strings"))) = #name;	\
 	struct tracepoint __tracepoint_##name				\
-	__attribute__((section("__tracepoints"), aligned(32))) =	\
+	__u64_aligned							\
+	__attribute__((section("__tracepoints"))) =			\
 		{ __tpstrtab_##name, 0, reg, unreg, NULL }
 
 #define DEFINE_TRACE(name)						\


WARNING: multiple messages have this Message-ID (diff)
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: LKML <linux-kernel@vger.kernel.org>,
	David Miller <davem@davemloft.net>,
	Steven Rostedt <rostedt@goodmis.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@elte.hu>,
	Richard Mortimer <richm@oldelvet.org.uk>,
	ben@decadent.org.uk, sparclinux@vger.kernel.org
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Subject: [patch 3/3] tracepoints: use __u64_aligned/U64_ALIGN()
Date: Fri, 21 Jan 2011 20:36:33 +0000	[thread overview]
Message-ID: <20110121203643.046218322@efficios.com> (raw)
In-Reply-To: 20110121203630.725922272@efficios.com

commit 7e066fb870fcd1025ec3ba7bbde5d541094f4ce1 added the aligned(32) type and
variable attribute to the tracepoint structures to deal with gcc happily
aligning statically defined structures on 32-byte multiples.

Working on issues within Ftrace, we came up with __64_aligned, which deals with
this issue more elegantly by forcing an 8-byte alignment to both the type
declaration and variable definition.

This therefore saves space, bringing down the size of struct tracepoint from 64
bytes to 38 on 64-bit architectures.

Updating:
- The type attribute (for iteration over the struct tracepoint array)
- Added the variable attribute to the extern definition (needed to force gcc to
  consider this alignment for the following definition)
- The definition variable attribute (to force gcc to this specific alignment for
  the static definitions)
- The linker script (8-byte alignment can now replace the previous 32-byte
  alignment for the custom tracepoint section)

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: David Miller <davem@davemloft.net>
CC: Steven Rostedt <rostedt@goodmis.org>
CC: Frederic Weisbecker <fweisbec@gmail.com>
CC: Ingo Molnar <mingo@elte.hu>
---
 include/asm-generic/vmlinux.lds.h |    2 +-
 include/linux/tracepoint.h        |   12 ++++--------
 2 files changed, 5 insertions(+), 9 deletions(-)

Index: linux-2.6-lttng/include/asm-generic/vmlinux.lds.h
=================================--- linux-2.6-lttng.orig/include/asm-generic/vmlinux.lds.h
+++ linux-2.6-lttng/include/asm-generic/vmlinux.lds.h
@@ -168,7 +168,7 @@
 	CPU_KEEP(exit.data)						\
 	MEM_KEEP(init.data)						\
 	MEM_KEEP(exit.data)						\
-	. = ALIGN(32);							\
+	U64_ALIGN();							\
 	VMLINUX_SYMBOL(__start___tracepoints) = .;			\
 	*(__tracepoints)						\
 	VMLINUX_SYMBOL(__stop___tracepoints) = .;			\
Index: linux-2.6-lttng/include/linux/tracepoint.h
=================================--- linux-2.6-lttng.orig/include/linux/tracepoint.h
+++ linux-2.6-lttng/include/linux/tracepoint.h
@@ -33,12 +33,7 @@ struct tracepoint {
 	void (*regfunc)(void);
 	void (*unregfunc)(void);
 	struct tracepoint_func *funcs;
-} __attribute__((aligned(32)));		/*
-					 * Aligned on 32 bytes because it is
-					 * globally visible and gcc happily
-					 * align these on the structure size.
-					 * Keep in sync with vmlinux.lds.h.
-					 */
+} __u64_aligned;
 
 /*
  * Connect a probe to a tracepoint.
@@ -143,7 +138,7 @@ static inline void tracepoint_update_pro
  * structure. Force alignment to the same alignment as the section start.
  */
 #define __DECLARE_TRACE(name, proto, args, data_proto, data_args)	\
-	extern struct tracepoint __tracepoint_##name;			\
+	extern struct tracepoint __u64_aligned __tracepoint_##name;	\
 	static inline void trace_##name(proto)				\
 	{								\
 		JUMP_LABEL(&__tracepoint_##name.state, do_trace);	\
@@ -174,7 +169,8 @@ do_trace:								\
 	static const char __tpstrtab_##name[]				\
 	__attribute__((section("__tracepoints_strings"))) = #name;	\
 	struct tracepoint __tracepoint_##name				\
-	__attribute__((section("__tracepoints"), aligned(32))) =	\
+	__u64_aligned							\
+	__attribute__((section("__tracepoints"))) =			\
 		{ __tpstrtab_##name, 0, reg, unreg, NULL }
 
 #define DEFINE_TRACE(name)						\


  parent reply	other threads:[~2011-01-21 20:37 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-21 20:36 [patch 0/3] Fix alignment of custom sections made from structures (v3) Mathieu Desnoyers
2011-01-21 20:36 ` Mathieu Desnoyers
2011-01-21 20:36 ` [patch 1/3] introduce __u64_aligned and U64_ALIGN() for structure alignment in custom sections (v3) Mathieu Desnoyers
2011-01-21 20:36   ` Mathieu Desnoyers
2011-01-22  0:05   ` David Miller
2011-01-22  0:05     ` [patch 1/3] introduce __u64_aligned and U64_ALIGN() for David Miller
2011-01-22 17:11     ` [patch 1/3] introduce __u64_aligned and U64_ALIGN() for structure alignment in custom sections (v3) Mathieu Desnoyers
2011-01-22 17:11       ` [patch 1/3] introduce __u64_aligned and U64_ALIGN() for Mathieu Desnoyers
2011-01-22 17:43       ` [patch 1/3] introduce __u64_aligned and U64_ALIGN() for structure alignment in custom sections (v3) Steven Rostedt
2011-01-22 17:43         ` [patch 1/3] introduce __u64_aligned and U64_ALIGN() for Steven Rostedt
2011-01-25 23:34         ` [patch 1/3] introduce __u64_aligned and U64_ALIGN() for structure alignment in custom sections (v3) Mathieu Desnoyers
2011-01-25 23:34           ` [patch 1/3] introduce __u64_aligned and U64_ALIGN() for Mathieu Desnoyers
2011-01-26  0:25           ` [patch 1/3] introduce __u64_aligned and U64_ALIGN() for structure alignment in custom sections (v3) Steven Rostedt
2011-01-26  0:25             ` [patch 1/3] introduce __u64_aligned and U64_ALIGN() for Steven Rostedt
2011-01-26  7:12   ` [tip:perf/core] Introduce __u64_aligned and U64_ALIGN() for structure alignment in custom sections tip-bot for Mathieu Desnoyers
2011-01-21 20:36 ` [patch 2/3] tracing: fix sparc64 alignment crash with __u64_aligned/U64_ALIGN() Mathieu Desnoyers
2011-01-21 20:36   ` Mathieu Desnoyers
2011-01-22  0:05   ` David Miller
2011-01-22  0:05     ` [patch 2/3] tracing: fix sparc64 alignment crash with David Miller
2011-01-22 17:15     ` [patch 2/3] tracing: fix sparc64 alignment crash with __u64_aligned/U64_ALIGN() Mathieu Desnoyers
2011-01-22 17:15       ` [patch 2/3] tracing: fix sparc64 alignment crash with Mathieu Desnoyers
2011-01-26  7:13   ` [tip:perf/core] tracing: Fix sparc64 alignment crash with __u64_aligned/U64_ALIGN() tip-bot for Mathieu Desnoyers
2011-01-21 20:36 ` Mathieu Desnoyers [this message]
2011-01-21 20:36   ` [patch 3/3] tracepoints: use __u64_aligned/U64_ALIGN() Mathieu Desnoyers
2011-01-22  0:05   ` David Miller
2011-01-22  0:05     ` David Miller
2011-01-26  7:13   ` [tip:perf/core] tracepoints: Use __u64_aligned/U64_ALIGN() tip-bot for Mathieu Desnoyers
2011-01-26  4:04 [PATCH 0/3] [GIT PULL][v2.6.38] tracing: fix unaligned event arrays Steven Rostedt
2011-01-26  4:05 ` [PATCH 3/3] tracepoints: Use __u64_aligned/U64_ALIGN() Steven Rostedt
2011-01-27 18:19   ` Jiri Olsa
2011-01-27 18:22     ` Steven Rostedt
2011-01-27 19:09       ` Ingo Molnar
2011-01-27 19:11         ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110121203643.046218322@efficios.com \
    --to=mathieu.desnoyers@efficios.com \
    --cc=ben@decadent.org.uk \
    --cc=davem@davemloft.net \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=richm@oldelvet.org.uk \
    --cc=rostedt@goodmis.org \
    --cc=sparclinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.