[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1354723742-6195-4-git-send-email-james.hogan@imgtec.com>
Date: Wed, 5 Dec 2012 16:08:21 +0000
From: James Hogan <james.hogan@...tec.com>
To: <linux-arch@...r.kernel.org>, <linux-kernel@...r.kernel.org>
CC: Arnd Bergmann <arnd@...db.de>,
James Hogan <james.hogan@...tec.com>,
Balbir Singh <bsingharora@...il.com>,
Ingo Molnar <mingo@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Eric Paris <eparis@...hat.com>, Will Drewry <wad@...omium.org>,
James Morris <james.l.morris@...cle.com>
Subject: [PATCH v2 03/44] Add CONFIG_HAVE_64BIT_ALIGNED_STRUCT for taskstats
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 <james.hogan@...tec.com>
Cc: Balbir Singh <bsingharora@...il.com>
Cc: Ingo Molnar <mingo@...nel.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Eric Paris <eparis@...hat.com>
Cc: Will Drewry <wad@...omium.org>
Cc: James Morris <james.l.morris@...cle.com>
---
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
--
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