From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
To: Ingo Molnar <mingo@elte.hu>, linux-kernel@vger.kernel.org
Cc: Sam Ravnborg <sam@ravnborg.org>, "H. Peter Anvin" <hpa@zytor.com>,
Jeremy Fitzhardinge <jeremy@goop.org>,
David Miller <davem@davemloft.net>,
Paul Mackerras <paulus@samba.org>
Subject: Re: [patch 10.2/12] Fix Immediate Values x86_64 support old gcc
Date: Thu, 24 Sep 2009 11:35:36 -0400 [thread overview]
Message-ID: <20090924153536.GB29580@Krystal> (raw)
In-Reply-To: <20090924133400.512675657@polymtl.ca>
GCC < 4, on x86_64, does not accept symbol+offset operands for "i" constraints
asm statements. Fallback on a memory read in lieue of immediate value if this
compiler is detected.
Changelog :
- USE_IMMEDIATE must now be used in lieue of CONFIG_IMMEDIATE in Makefiles and
in C code.
- Every architecture implementing immediate values must declare USE_IMMEDIATE
in their Makefile.
- Tab -> spaces in Makefiles.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
CC: "H. Peter Anvin" <hpa@zytor.com>
CC: Jeremy Fitzhardinge <jeremy@goop.org>
CC: Ingo Molnar <mingo@elte.hu>
CC: David Miller <davem@davemloft.net>
CC: Paul Mackerras <paulus@samba.org>
---
Makefile | 5 +++++
arch/powerpc/Makefile | 2 ++
arch/x86/Makefile | 5 +++++
include/linux/immediate.h | 2 +-
include/linux/module.h | 2 +-
kernel/Makefile | 2 +-
kernel/module.c | 6 +++---
7 files changed, 18 insertions(+), 6 deletions(-)
Index: linux.trees.git/arch/x86/Makefile
===================================================================
--- linux.trees.git.orig/arch/x86/Makefile 2009-09-24 08:52:41.000000000 -0400
+++ linux.trees.git/arch/x86/Makefile 2009-09-24 10:53:59.000000000 -0400
@@ -41,6 +41,7 @@ ifeq ($(CONFIG_X86_32),y)
# temporary until string.h is fixed
KBUILD_CFLAGS += -ffreestanding
+ export USE_IMMEDIATE := $(CONFIG_IMMEDIATE)
else
BITS := 64
UTS_MACHINE := x86_64
@@ -70,6 +71,10 @@ else
# this works around some issues with generating unwind tables in older gccs
# newer gccs do it by default
KBUILD_CFLAGS += -maccumulate-outgoing-args
+
+ # x86_64 gcc 3.x has problems with passing symbol+offset in
+ # asm "i" constraint.
+ export USE_IMMEDIATE := $(call cc-ifversion, -ge, 0400, $(CONFIG_IMMEDIATE))
endif
ifdef CONFIG_CC_STACKPROTECTOR
Index: linux.trees.git/include/linux/immediate.h
===================================================================
--- linux.trees.git.orig/include/linux/immediate.h 2009-09-24 10:53:51.000000000 -0400
+++ linux.trees.git/include/linux/immediate.h 2009-09-24 10:53:59.000000000 -0400
@@ -10,7 +10,7 @@
* See the file COPYING for more details.
*/
-#ifdef CONFIG_IMMEDIATE
+#ifdef USE_IMMEDIATE
struct __imv {
unsigned long var; /* Pointer to the identifier variable of the
Index: linux.trees.git/kernel/Makefile
===================================================================
--- linux.trees.git.orig/kernel/Makefile 2009-09-24 09:20:19.000000000 -0400
+++ linux.trees.git/kernel/Makefile 2009-09-24 10:55:09.000000000 -0400
@@ -88,7 +88,7 @@ obj-$(CONFIG_SYSCTL) += utsname_sysctl.o
obj-$(CONFIG_TASK_DELAY_ACCT) += delayacct.o
obj-$(CONFIG_TASKSTATS) += taskstats.o tsacct.o
obj-$(CONFIG_TRACEPOINTS) += tracepoint.o
-obj-$(CONFIG_IMMEDIATE) += immediate.o
+obj-$(USE_IMMEDIATE) += immediate.o
obj-$(CONFIG_LATENCYTOP) += latencytop.o
obj-$(CONFIG_FUNCTION_TRACER) += trace/
obj-$(CONFIG_TRACING) += trace/
Index: linux.trees.git/arch/powerpc/Makefile
===================================================================
--- linux.trees.git.orig/arch/powerpc/Makefile 2009-09-24 08:52:40.000000000 -0400
+++ linux.trees.git/arch/powerpc/Makefile 2009-09-24 10:53:59.000000000 -0400
@@ -96,6 +96,8 @@ else
LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
endif
+export USE_IMMEDIATE := $(CONFIG_IMMEDIATE)
+
ifeq ($(CONFIG_TUNE_CELL),y)
KBUILD_CFLAGS += $(call cc-option,-mtune=cell)
endif
Index: linux.trees.git/Makefile
===================================================================
--- linux.trees.git.orig/Makefile 2009-09-24 08:52:38.000000000 -0400
+++ linux.trees.git/Makefile 2009-09-24 10:53:59.000000000 -0400
@@ -550,6 +550,11 @@ ifdef CONFIG_FUNCTION_TRACER
KBUILD_CFLAGS += -pg
endif
+# arch Makefile detects if the compiler permits use of immediate values
+ifdef USE_IMMEDIATE
+KBUILD_CFLAGS += -DUSE_IMMEDIATE
+endif
+
# We trigger additional mismatches with less inlining
ifdef CONFIG_DEBUG_SECTION_MISMATCH
KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once)
Index: linux.trees.git/kernel/module.c
===================================================================
--- linux.trees.git.orig/kernel/module.c 2009-09-24 09:20:37.000000000 -0400
+++ linux.trees.git/kernel/module.c 2009-09-24 10:53:59.000000000 -0400
@@ -2237,7 +2237,7 @@ static noinline struct module *load_modu
mod->ctors = section_objs(hdr, sechdrs, secstrings, ".ctors",
sizeof(*mod->ctors), &mod->num_ctors);
#endif
-#ifdef CONFIG_IMMEDIATE
+#ifdef USE_IMMEDIATE
mod->immediate = section_objs(hdr, sechdrs, secstrings, "__imv",
sizeof(*mod->immediate),
&mod->num_immediate);
@@ -2491,7 +2491,7 @@ SYSCALL_DEFINE3(init_module, void __user
mutex_lock(&module_mutex);
/* Drop initial reference. */
module_put(mod);
-#ifdef CONFIG_IMMEDIATE
+#ifdef USE_IMMEDIATE
imv_unref(mod->immediate, mod->immediate + mod->num_immediate,
mod->module_init, mod->init_size);
#endif
@@ -3011,7 +3011,7 @@ int module_get_iter_tracepoints(struct t
}
#endif
-#ifdef CONFIG_IMMEDIATE
+#ifdef USE_IMMEDIATE
/**
* _module_imv_update - update all immediate values in the kernel
*
Index: linux.trees.git/include/linux/module.h
===================================================================
--- linux.trees.git.orig/include/linux/module.h 2009-09-24 10:53:51.000000000 -0400
+++ linux.trees.git/include/linux/module.h 2009-09-24 10:53:59.000000000 -0400
@@ -660,7 +660,7 @@ static inline int module_get_iter_tracep
#endif /* CONFIG_MODULES */
-#if defined(CONFIG_MODULES) && defined(CONFIG_IMMEDIATE)
+#if defined(CONFIG_MODULES) && defined(USE_IMMEDIATE)
extern void _module_imv_update(void);
extern void module_imv_update(void);
#else
next prev parent reply other threads:[~2009-09-24 15:35 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-24 13:26 [patch 00/12] Immediate Values Mathieu Desnoyers
2009-09-24 13:26 ` [patch 01/12] x86: text_poke_early non static Mathieu Desnoyers
2009-09-24 13:26 ` [patch 02/12] Immediate Values - Architecture Independent Code Mathieu Desnoyers
2009-09-25 4:20 ` Andrew Morton
2009-09-27 23:23 ` Mathieu Desnoyers
2009-09-28 1:23 ` Andi Kleen
2009-09-28 17:46 ` Andrew Morton
2009-09-28 18:03 ` Arjan van de Ven
2009-09-28 18:40 ` Mathieu Desnoyers
2009-09-28 19:54 ` Andi Kleen
2009-09-28 20:37 ` Arjan van de Ven
2009-09-28 21:32 ` H. Peter Anvin
2009-09-28 22:05 ` Mathieu Desnoyers
2009-09-28 20:11 ` Andi Kleen
2009-09-28 21:16 ` Andrew Morton
2009-09-28 22:01 ` Mathieu Desnoyers
2009-09-24 13:26 ` [patch 03/12] Immediate Values - Kconfig menu in EMBEDDED Mathieu Desnoyers
2009-09-24 13:26 ` [patch 04/12] Immediate Values - x86 Optimization Mathieu Desnoyers
2009-09-24 13:26 ` [patch 05/12] Add text_poke and sync_core to powerpc Mathieu Desnoyers
2009-09-24 13:26 ` [patch 06/12] Immediate Values - Powerpc Optimization Mathieu Desnoyers
2009-09-24 13:26 ` [patch 07/12] Sparc create asm.h Mathieu Desnoyers
2009-09-24 21:10 ` David Miller
2009-09-24 13:26 ` [patch 08/12] sparc64: Optimized immediate value implementation Mathieu Desnoyers
2009-09-24 13:26 ` [patch 09/12] Immediate Values - Documentation Mathieu Desnoyers
2009-09-24 13:26 ` [patch 10/12] Immediate Values Support init Mathieu Desnoyers
2009-09-24 15:33 ` [patch 10.1/12] Immediate values fixes for modules Mathieu Desnoyers
2009-09-24 15:35 ` Mathieu Desnoyers [this message]
2009-09-24 13:26 ` [patch 11/12] Scheduler Profiling - Use Immediate Values Mathieu Desnoyers
2009-09-24 13:26 ` [patch 12/12] Tracepoints - " Mathieu Desnoyers
2009-09-24 14:51 ` Peter Zijlstra
2009-09-24 15:03 ` Mathieu Desnoyers
2009-09-24 15:06 ` Peter Zijlstra
2009-09-24 16:01 ` [RFC patch] Immediate Values - x86 Optimization NMI and MCE support Mathieu Desnoyers
2009-09-24 21:59 ` Masami Hiramatsu
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=20090924153536.GB29580@Krystal \
--to=mathieu.desnoyers@polymtl.ca \
--cc=davem@davemloft.net \
--cc=hpa@zytor.com \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
--cc=sam@ravnborg.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