From: Tejun Heo <tj@kernel.org>
To: linux-kernel@vger.kernel.org, x86@kernel.org,
linux-arch@vger.kernel.org, mingo@elte.hu, kyle@mcmartin.ca,
cl@linux-foundation.org, Jesper.Nilsson@axis.com,
benh@kernel.crashing.org, paulmck@linux.vnet.ibm.com,
rusty@rustcorp.com.au, torvalds@linux-foundation.org,
akpm@linux-foundation.org
Cc: Tejun Heo <tj@kernel.org>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
Heiko Carstens <heiko.carstens@de.ibm.com>
Subject: [PATCH 10/10] s390: switch to dynamic percpu allocator
Date: Wed, 24 Jun 2009 15:45:24 +0900 [thread overview]
Message-ID: <1245825924-30412-11-git-send-email-tj@kernel.org> (raw)
In-Reply-To: <1245825924-30412-1-git-send-email-tj@kernel.org>
64bit s390 shares the same problem with alpha regarding percpu symbol
addressing from modules. It needs assembly magic to force GOTENT
reference when building module as the percpu address will be outside
the usual 4G range from the module text. This can be solved by using
weak percpu variable definitions.
This patch makes s390 use weak definitions and switch to dynamic
percpu allocator. Please note that weak attribute is not added if
!SMP as percpu variables behave exactly the same as normal variables
on UP.
Compile tested. Generation of GOTENT reference verified.
This patch is based on Ivan Kokshaysky's alpha percpu patch.
[ Impact: use dynamic percpu allocator ]
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
---
arch/s390/Kconfig | 3 ---
arch/s390/include/asm/percpu.h | 32 ++++++++------------------------
2 files changed, 8 insertions(+), 27 deletions(-)
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index f4a3cc6..a14dba0 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -75,9 +75,6 @@ config VIRT_CPU_ACCOUNTING
config ARCH_SUPPORTS_DEBUG_PAGEALLOC
def_bool y
-config HAVE_LEGACY_PER_CPU_AREA
- def_bool y
-
mainmenu "Linux Kernel Configuration"
config S390
diff --git a/arch/s390/include/asm/percpu.h b/arch/s390/include/asm/percpu.h
index 408d60b..f7ad871 100644
--- a/arch/s390/include/asm/percpu.h
+++ b/arch/s390/include/asm/percpu.h
@@ -1,37 +1,21 @@
#ifndef __ARCH_S390_PERCPU__
#define __ARCH_S390_PERCPU__
-#include <linux/compiler.h>
-#include <asm/lowcore.h>
-
/*
* s390 uses its own implementation for per cpu data, the offset of
* the cpu local data area is cached in the cpu's lowcore memory.
- * For 64 bit module code s390 forces the use of a GOT slot for the
- * address of the per cpu variable. This is needed because the module
- * may be more than 4G above the per cpu area.
*/
-#if defined(__s390x__) && defined(MODULE)
-
-#define SHIFT_PERCPU_PTR(ptr,offset) (({ \
- extern int simple_identifier_##var(void); \
- unsigned long *__ptr; \
- asm ( "larl %0, %1@GOTENT" \
- : "=a" (__ptr) : "X" (ptr) ); \
- (typeof(ptr))((*__ptr) + (offset)); }))
-
-#else
-
-#define SHIFT_PERCPU_PTR(ptr, offset) (({ \
- extern int simple_identifier_##var(void); \
- unsigned long __ptr; \
- asm ( "" : "=a" (__ptr) : "0" (ptr) ); \
- (typeof(ptr)) (__ptr + (offset)); }))
+#define __my_cpu_offset S390_lowcore.percpu_offset
+/*
+ * For 64 bit module code, the module may be more than 4G above the
+ * per cpu area, use weak definitions to force the compiler to
+ * generate external references.
+ */
+#if defined(CONFIG_SMP) && defined(__s390x__) && defined(MODULE)
+#define ARCH_NEEDS_WEAK_PER_CPU
#endif
-#define __my_cpu_offset S390_lowcore.percpu_offset
-
#include <asm-generic/percpu.h>
#endif /* __ARCH_S390_PERCPU__ */
--
1.6.0.2
next prev parent reply other threads:[~2009-06-24 6:47 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-24 6:45 [PATCHSET core/percpu] percpu: convert most archs to dynamic percpu, take#4 Tejun Heo
2009-06-24 6:45 ` [PATCH 01/10] percpu: use dynamic percpu allocator as the default percpu allocator Tejun Heo
2009-06-24 23:47 ` James Bottomley
2009-06-25 2:55 ` Tejun Heo
2009-06-26 15:13 ` James Bottomley
2009-06-27 3:21 ` Tejun Heo
2009-06-25 4:44 ` Paul Mundt
2009-06-24 6:45 ` [PATCH 02/10] linker script: throw away .discard section Tejun Heo
2009-06-24 17:20 ` Luck, Tony
2009-06-24 6:45 ` [PATCH 03/10] CRIS: Change DEFINE_PER_CPU of current_pgd to be non volatile Tejun Heo
2009-06-24 6:45 ` [PATCH 04/10] percpu: cleanup percpu array definitions Tejun Heo
2009-06-24 6:45 ` [PATCH 05/10] percpu: use DEFINE_PER_CPU_SHARED_ALIGNED() Tejun Heo
2009-06-29 23:25 ` Christoph Lameter
2009-06-24 6:45 ` [PATCH 06/10] percpu: clean up percpu variable definitions Tejun Heo
2009-06-24 6:45 ` [PATCH 07/10] percpu: implement optional weak percpu definitions Tejun Heo
2009-06-24 6:45 ` [PATCH 08/10] alpha: kill unnecessary __used attribute in PER_CPU_ATTRIBUTES Tejun Heo
2009-06-24 6:45 ` [PATCH 09/10] alpha: switch to dynamic percpu allocator Tejun Heo
2009-06-24 6:45 ` Tejun Heo [this message]
2009-06-24 8:03 ` [PATCH 11/10] sparc64: fix build breakage introduced by percpu-convert-most patchset Tejun Heo
2009-06-24 9:00 ` David Miller
2009-06-24 9:07 ` Tejun Heo
2009-06-27 3:22 ` [PATCHSET core/percpu] percpu: convert most archs to dynamic percpu, take#4 Tejun Heo
2009-06-27 3:25 ` Tejun Heo
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=1245825924-30412-11-git-send-email-tj@kernel.org \
--to=tj@kernel.org \
--cc=Jesper.Nilsson@axis.com \
--cc=akpm@linux-foundation.org \
--cc=benh@kernel.crashing.org \
--cc=cl@linux-foundation.org \
--cc=heiko.carstens@de.ibm.com \
--cc=kyle@mcmartin.ca \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulmck@linux.vnet.ibm.com \
--cc=rusty@rustcorp.com.au \
--cc=schwidefsky@de.ibm.com \
--cc=torvalds@linux-foundation.org \
--cc=x86@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox