From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from multi.imgtec.com ([194.200.65.239]:51591 "EHLO multi.imgtec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751997Ab2LEQJT (ORCPT ); Wed, 5 Dec 2012 11:09:19 -0500 From: James Hogan Subject: [PATCH v2 03/44] Add CONFIG_HAVE_64BIT_ALIGNED_STRUCT for taskstats Date: Wed, 5 Dec 2012 16:08:21 +0000 Message-ID: <1354723742-6195-4-git-send-email-james.hogan@imgtec.com> In-Reply-To: <1354723742-6195-1-git-send-email-james.hogan@imgtec.com> References: <1354723742-6195-1-git-send-email-james.hogan@imgtec.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-arch-owner@vger.kernel.org List-ID: To: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann , James Hogan , Balbir Singh , Ingo Molnar , Andrew Morton , Eric Paris , Will Drewry , James Morris Message-ID: <20121205160821.MVeqizFkfqJ-yTyej-mNbXOmcIzzjLlyxNoP0stb4ME@z> On 64 bit architectures with no efficient unaligned access, taskstats has to add some padding to a reply to prevent unaligned access warnings. However this also needs to apply to 32 bit architectures with 64 bit struct alignment such as metag (which has 64 bit memory accesses). This is solved by adding a new Kconfig symbol CONFIG_HAVE_64BIT_ALIGNED_STRUCT which defaults to CONFIG_64BIT, and can be explicitly selected by CONFIG_METAG. Taskstats then uses this symbol instead of CONFIG_64BIT to determine whether to add the padding. Signed-off-by: James Hogan Cc: Balbir Singh Cc: Ingo Molnar Cc: Andrew Morton Cc: Eric Paris Cc: Will Drewry Cc: James Morris --- arch/Kconfig | 16 ++++++++++++++++ kernel/taskstats.c | 3 ++- 2 files changed, 18 insertions(+), 1 deletions(-) diff --git a/arch/Kconfig b/arch/Kconfig index 366ec06..dc7ffb1 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -93,6 +93,22 @@ config UPROBES If in doubt, say "N". +config HAVE_64BIT_ALIGNED_STRUCT + bool + default 64BIT + help + Some architectures have 64bit struct alignment (64 bit + architectures and some 32 bit architectures which can do + 64 bit accesses). + + This symbol should be selected by an architecture if it has + a 64 bit struct alignment requirement even though it isn't + a 64 bit architecture (64 bit architectures have this on by + default). + + See Documentation/unaligned-memory-access.txt for more + information on the topic of unaligned memory accesses. + config HAVE_EFFICIENT_UNALIGNED_ACCESS bool help diff --git a/kernel/taskstats.c b/kernel/taskstats.c index 145bb4d..afaa4c2 100644 --- a/kernel/taskstats.c +++ b/kernel/taskstats.c @@ -364,7 +364,8 @@ static int parse(struct nlattr *na, struct cpumask *mask) return ret; } -#if defined(CONFIG_64BIT) && !defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) +#if defined(CONFIG_HAVE_64BIT_ALIGNED_STRUCT) && \ + !defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) #define TASKSTATS_NEEDS_PADDING 1 #endif -- 1.7.7.6