From patchwork Fri Jan 21 20:36:33 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 79930 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id EFFC5B6EE8 for ; Sat, 22 Jan 2011 08:06:54 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753405Ab1AUVGx (ORCPT ); Fri, 21 Jan 2011 16:06:53 -0500 Received: from smtp.polymtl.ca ([132.207.4.11]:50351 "EHLO smtp.polymtl.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752174Ab1AUVGx (ORCPT ); Fri, 21 Jan 2011 16:06:53 -0500 X-Greylist: delayed 1788 seconds by postgrey-1.27 at vger.kernel.org; Fri, 21 Jan 2011 16:06:52 EST Received: from ok.casi.polymtl.ca (test.dorsal.polymtl.ca [132.207.72.60]) by smtp.polymtl.ca (8.14.3/8.14.3) with ESMTP id p0LKahX8012933 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Fri, 21 Jan 2011 15:36:44 -0500 Received: from compudj by ok.casi.polymtl.ca with local (Exim 4.71) (envelope-from ) id 1PgNit-0001Rf-4n; Fri, 21 Jan 2011 15:36:43 -0500 Message-Id: <20110121203643.046218322@efficios.com> User-Agent: quilt/0.48-1 Date: Fri, 21 Jan 2011 15:36:33 -0500 From: Mathieu Desnoyers To: LKML , David Miller , Steven Rostedt , Frederic Weisbecker , Ingo Molnar , Richard Mortimer , ben@decadent.org.uk, sparclinux@vger.kernel.org Cc: Mathieu Desnoyers Subject: [patch 3/3] tracepoints: use __u64_aligned/U64_ALIGN() References: <20110121203630.725922272@efficios.com> Content-Disposition: inline; filename=tracepoints-use-u64-aligned-as-type-and-variable-attribute.patch X-Poly-FromMTA: (test.dorsal.polymtl.ca [132.207.72.60]) at Fri, 21 Jan 2011 20:36:43 +0000 Sender: sparclinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org 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 CC: David Miller CC: Steven Rostedt CC: Frederic Weisbecker CC: Ingo Molnar Acked-by: David S. Miller --- include/asm-generic/vmlinux.lds.h | 2 +- include/linux/tracepoint.h | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe sparclinux" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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) \