]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
tracing/ftrace: don't trace on early stage of a secondary cpu boot, v3
authorFrederic Weisbecker <fweisbec@gmail.com>
Wed, 24 Dec 2008 22:30:02 +0000 (23:30 +0100)
committerIngo Molnar <mingo@elte.hu>
Thu, 25 Dec 2008 08:39:22 +0000 (09:39 +0100)
Impact: fix a crash/hard-reboot on certain configs while enabling cpu runtime

On some archs, the boot of a secondary cpu can have an early fragile state.
On x86-64, the pda is not initialized on the first stage of a cpu boot but
it is needed to get the cpu number and the current task pointer. This data
is needed during tracing. As they were dereferenced at this stage, we got a
crash while tracing a cpu being enabled at runtime.

Some other archs like ia64 can have such kind of issue too.

Changes on v2:

We dropped the previous solution of a per-arch called function to guess the
current state of a cpu. That could slow down the tracing.

This patch removes the -pg flag on arch/x86/kernel/cpu/common.c where
the low level cpu boot functions exist, on start_secondary() and a helper
function used at this stage.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Acked-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/include/asm/msr.h
arch/x86/kernel/cpu/Makefile
arch/x86/kernel/smpboot.c

index c2a812ebde890e590794ea1e2d8a39d5cec49e9f..b8a1799ea871b391408665a3d6dc041491af7954 100644 (file)
@@ -85,7 +85,8 @@ static inline void native_write_msr(unsigned int msr,
        asm volatile("wrmsr" : : "c" (msr), "a"(low), "d" (high) : "memory");
 }
 
-static inline int native_write_msr_safe(unsigned int msr,
+/* Can be uninlined because referenced by paravirt */
+notrace static inline int native_write_msr_safe(unsigned int msr,
                                        unsigned low, unsigned high)
 {
        int err;
index 82ec6075c057b695cf6904a28a58fb8c60c37d7a..4ae495a313f3be6029179049706faa2653a9fec4 100644 (file)
@@ -2,6 +2,11 @@
 # Makefile for x86-compatible CPU details and quirks
 #
 
+# Don't trace early stages of a secondary CPU boot
+ifdef CONFIG_FUNCTION_TRACER
+CFLAGS_REMOVE_common.o = -pg
+endif
+
 obj-y                  := intel_cacheinfo.o addon_cpuid_features.o
 obj-y                  += proc.o capflags.o powerflags.o common.o
 
index f71f96fc9e62ea8e4f027a78cb3aafcd96fdbf99..f6174d229024874d7adc7d443cf4ec20279d55ab 100644 (file)
@@ -287,7 +287,7 @@ static int __cpuinitdata unsafe_smp;
 /*
  * Activate a secondary processor.
  */
-static void __cpuinit start_secondary(void *unused)
+notrace static void __cpuinit start_secondary(void *unused)
 {
        /*
         * Don't put *anything* before cpu_init(), SMP booting is too