x86/cpu changes for v2.6.34
Subsystems (3)
Linus,
Please pull the latest x86-cpu-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git x86-cpu-for-linus
out-of-topic modifications in x86-cpu-for-linus:
------------------------------------------------drivers/char/agp/intel-agp.c # 48a719c: intel-agp: Switch to wbinvd_on_al
Thanks,
Ingo
------------------>
Borislav Petkov (7):
x86, lib: Add wbinvd smp helpers
intel-agp: Switch to wbinvd_on_all_cpus
x86, cacheinfo: Fix disabling of L3 cache indices
x86, cacheinfo: Add cache index disable sysfs attrs only to L3 caches x86, cacheinfo: Calculate L3 indices
x86, cacheinfo: Remove NUMA dependency, fix for AMD Fam10h rev D1 x86, cacheinfo: Enable L3 CID only on AMD
Joerg Roedel (1):
x86, cpu: Print AMD virtualization features in /proc/cpuinfo
arch/x86/include/asm/cpufeature.h | 4 + arch/x86/include/asm/smp.h | 9 + arch/x86/kernel/cpu/addon_cpuid_features.c | 4 + arch/x86/kernel/cpu/intel_cacheinfo.c | 250 +++++++++++++++++----------- arch/x86/lib/Makefile | 2 +- arch/x86/lib/cache-smp.c | 19 ++ drivers/char/agp/intel-agp.c | 15 +-- 7 files changed, 197 insertions(+), 106 deletions(-) create mode 100644 arch/x86/lib/cache-smp.c
arch/x86/include/asm/cpufeature.h +4 -0
@@ -168,6 +168,10 @@#define X86_FEATURE_FLEXPRIORITY (8*32+ 2)/* Intel FlexPriority */ #define X86_FEATURE_EPT (8*32+ 3)/* Intel Extended Page Table */ #define X86_FEATURE_VPID (8*32+ 4)/* Intel Virtual Processor ID */ +#define X86_FEATURE_NPT (8*32+5)/* AMD Nested Page Table support */ +#define X86_FEATURE_LBRV (8*32+6)/* AMD LBR Virtualization support */ +#define X86_FEATURE_SVML (8*32+7)/* "svm_lock" AMD SVM locking MSR */ +#define X86_FEATURE_NRIPS (8*32+8)/* "nrip_save" AMD SVM next_rip save */ #if defined(__KERNEL__) && !defined(__ASSEMBLY__)
arch/x86/include/asm/smp.h +9 -0
@@ -135,6 +135,8 @@ int native_cpu_disable(void);void native_cpu_die (unsigned int cpu);void native_play_dead (void );void play_dead_common (void ); +void wbinvd_on_cpu (int cpu); +int wbinvd_on_all_cpus (void );void native_send_call_func_ipi (const struct cpumask *mask);void native_send_call_func_single_ipi (int cpu);
@@ -147,6 +149,13 @@ static inline int num_booting_cpus(void) {return cpumask_weight (cpu_callout_mask); } +#else /* !CONFIG_SMP */ +#define wbinvd_on_cpu (cpu) wbinvd() +static inline int wbinvd_on_all_cpus (void ) +{ +wbinvd (); +return 0 ; +}#endif /* CONFIG_SMP */ extern unsigned disabled_cpus__cpuinitdata ;
arch/x86/kernel/cpu/addon_cpuid_features.c +4 -0
@@ -32,6 +32,10 @@ void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c)static const struct cpuid_bit __cpuinitconst cpuid_bits[] = { {X86_FEATURE_IDA ,CR_EAX ,1 ,0x00000006 }, {X86_FEATURE_ARAT ,CR_EAX ,2 ,0x00000006 }, + {X86_FEATURE_NPT ,CR_EDX ,0 ,0x8000000a }, + {X86_FEATURE_LBRV ,CR_EDX ,1 ,0x8000000a }, + {X86_FEATURE_SVML ,CR_EDX ,2 ,0x8000000a }, + {X86_FEATURE_NRIPS ,CR_EDX ,3 ,0x8000000a }, {0 ,0 ,0 ,0 } };
arch/x86/kernel/cpu/intel_cacheinfo.c +156 -94
311 lines not on this page · raw message
arch/x86/lib/Makefile +1 -1
@@ -14,7 +14,7 @@ $(obj)/inat.o: $(obj)/inat-tables.c clean-files := inat-tables.c -obj-$(CONFIG_SMP) += msr-smp.o +obj-$(CONFIG_SMP) += msr-smp.o cache-smp.o lib-y := delay.o lib-y += thunk_$(BITS).o
arch/x86/lib/cache-smp.c new file +19 -0
@@ -0,0 +1,19 @@ +#include <linux/smp.h> +#include <linux/module.h> + +static void __wbinvd (void *dummy) +{ +wbinvd (); +} + +void wbinvd_on_cpu (int cpu) +{ +smp_call_function_single (cpu, __wbinvd,NULL ,1 ); +} +EXPORT_SYMBOL (wbinvd_on_cpu); + +int wbinvd_on_all_cpus (void ) +{ +return on_each_cpu (__wbinvd,NULL ,1 ); +} +EXPORT_SYMBOL (wbinvd_on_all_cpus);
drivers/char/agp/intel-agp.c +4 -11
@@ -8,6 +8,7 @@#include <linux/kernel.h> #include <linux/pagemap.h> #include <linux/agp_backend.h> +#include <asm/smp.h> #include "agp.h" /*
@@ -815,12 +816,6 @@ static void intel_i830_setup_flush(void)intel_i830_fini_flush (); } -static void -do_wbinvd (void *null) -{ -wbinvd (); -} -/* The chipset_flush interface needs to get data that has already been * flushed out of the CPU all the way out to main memory, because the GPU * doesn't snoop those buffers.
@@ -837,12 +832,10 @@ static void intel_i830_chipset_flush(struct agp_bridge_data *bridge)memset (pg,0 ,1024 ); -if (cpu_has_clflush) { +if (cpu_has_clflush)clflush_cache_range (pg,1024 ); - }else { -if (on_each_cpu (do_wbinvd,NULL ,1 ) !=0 ) -printk (KERN_ERR "Timed out waiting for cache flush.\n" ); - } +else if (wbinvd_on_all_cpus () !=0 ) +printk (KERN_ERR "Timed out waiting for cache flush.\n" ); }/* The intel i830 automatically initializes the agp aperture during POST.
arch/x86/lib/cache-smp.c line 18
Quoted 4 lines · On Sat, 27 Feb 2010 16:09:42 +0100 Ingo Molnar <[email protected]> wrote:
arch/x86/lib/cache-smp.c new file +4
-0+int wbinvd_on_all_cpus (void ) +{ +return on_each_cpu (__wbinvd,NULL ,1 ); +}
does this make sense at all?
doesn't cache coherency on x86 already guarantee this?
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
H. Peter Anvin
reviewerQuoted 12 lines · Arjan van de Ven
arch/x86/lib/cache-smp.c line 18
Quoted 4 lines · On Sat, 27 Feb 2010 16:09:42 +0100 Ingo Molnar <[email protected]> wrote:
arch/x86/lib/cache-smp.c new file +4
-0+int wbinvd_on_all_cpus (void ) +{ +return on_each_cpu (__wbinvd,NULL ,1 ); +}does this make sense at all?
doesn't cache coherency on x86 already guarantee this?
No, WBINVD (unlike CLFLUSH) is local to one CPU.
-hpa
Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.
I haven't bisected this, but something slowed down in bootup on my machine recently.
See the timestamps:
[ 0.000000] Linux version 2.6.33-01832-g30ff056 ... [ 0.010066] Enabled Interrupt-remapping [ 0.010120] Setting APIC routing to physical flat [ 0.010180] DRHD: handling fault status reg 2 [ 0.010582] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1 [ 0.049955] CPU0: Genuine Intel(R) CPU 000 @ 3.20GHz stepping 04 [ 0.157195] Booting Node 0, Processors #1 [ 0.245179] CPU 1 MCA banks CMCI:2 CMCI:3 CMCI:5 SHD:6 SHD:8 [ 0.265332] #2 [ 0.353185] CPU 2 MCA banks CMCI:2 CMCI:3 CMCI:5 SHD:6 SHD:8 [ 0.373328] #3 [ 2.193277] CPU 3 MCA banks CMCI:2 CMCI:3 CMCI:5 SHD:6 SHD:8 [ 2.213379] #4 [ 2.301283] CPU 4 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 2.321391] #5 [ 2.417287] CPU 5 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 2.437356] #6 [ 2.525293] CPU 6 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 2.545354] #7 [ 2.633298] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 2.653423] Brought up 8 CPUs [ 2.653571] Total of 8 processors activated (51201.44 BogoMIPS).
what happened there for almost 2 seconds in between CPU#3 and CPU#4?
It wasn't very fast before either, but it was way better:
[ 0.050298] CPU0: Genuine Intel(R) CPU 000 @ 3.20GHz stepping 04 [ 0.156725] Booting Node 0, Processors #1 [ 0.244410] CPU 1 MCA banks CMCI:2 CMCI:3 CMCI:5 SHD:6 SHD:8 [ 0.264458] #2 [ 0.352078] CPU 2 MCA banks CMCI:2 CMCI:3 CMCI:5 SHD:6 SHD:8 [ 0.372147] #3 [ 0.459746] CPU 3 MCA banks CMCI:2 CMCI:3 CMCI:5 SHD:6 SHD:8 [ 0.479838] #4 [ 0.567415] CPU 4 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.587446] #5 [ 0.683057] CPU 5 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.703081] #6 [ 0.790724] CPU 6 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.810748] #7 [ 0.898393] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.918412] Brought up 8 CPUs [ 0.918562] Total of 8 processors activated (51203.34 BogoMIPS).
what is it that takes so long to bring those CPU's up?
Linus
Quoted 3 lines · Linus Torvalds
I haven't bisected this, but something slowed down in bootup on my machine recently.
Hmm. I take that back. It's not consistent, and it's not recent after all.
It comes and goes:
[torvalds@nehalem linux]$ grep "CPU 7 MCA" /var/log/messages-* /var/log/messages | cut -d: -f5- [ 0.898396] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.898400] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 1.596240] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.898394] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 1.600229] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.898395] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.901211] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 2.633298] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.898393] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.901210] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.898395] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.898393] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.898393] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.898402] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.901213] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.898392] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.898395] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 1.601467] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.898401] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.898395] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.898397] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8
note how it's pretty consistently at about the 0.89s mark, but then there's a _couple_ of times when it's taken rather longer to boot. But the delay is always in that CPU bringup phase, because doing the same grep for "CPU 0 MCA" gives consistently low numbers (0.0005s).
Linus
Quoted 32 lines · Linus Torvalds
Quoted 3 lines · Linus Torvalds
I haven't bisected this, but something slowed down in bootup on my machine recently.
Hmm. I take that back. It's not consistent, and it's not recent after all.
It comes and goes:
[torvalds@nehalem linux]$ grep "CPU 7 MCA" /var/log/messages-* /var/log/messages | cut -d: -f5- [ 0.898396] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.898400] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 1.596240] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.898394] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 1.600229] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.898395] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.901211] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 2.633298] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.898393] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.901210] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.898395] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.898393] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.898393] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.898402] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.901213] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.898392] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.898395] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 1.601467] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.898401] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.898395] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8 [ 0.898397] CPU 7 MCA banks SHD:2 SHD:3 SHD:5 SHD:6 SHD:8
Quoted 4 lines
note how it's pretty consistently at about the 0.89s mark, but then there's a _couple_ of times when it's taken rather longer to boot. But the delay is always in that CPU bringup phase, because doing the same grep for "CPU 0 MCA" gives consistently low numbers (0.0005s).
Weird. It seems to be around multiples of .8: 0.8, 1.6, 2.4, with some extra overhead.
Almost as if some calibration routine or some other busy-loop misses the train occasionally.
The way i'd go about debugging this is to narrow down the approximate place the slowdown happens, then enable CONFIG_FUNCTION_TRACER (and disable CONFIG_DYNAMIC_FTRACE=y, to not have to deal with the dynamic patching aspects), and do a single-shot tracing session of only that section, on only one CPU:
if (smp_processor_id() == 7) ftrace_enabled = 1; ... bootup sequence ... if (smp_processor_id() == 7) ftrace_enabled = 0;
And recover the resulting trace from /debug/tracing/trace - it should have the reason in it plain and simple.
( Unfortunately i'm not 100% sure that setting ftrace_enabled to 1 is enough.
I asked for a simple ad-hoc enable/disable function tracing mechanism _ages_ ago - Steve, Frederic, what happened to that? ftrace_start()/stop() does not seem to allow that. )
Or you could sprinkle the code with printk's, and see where the overhead concentrates into. (But printks ca change timings - etc. So can the function tracer as well ...)
Ingo
Quoted 20 lines · Ingo Molnar
Weird. It seems to be around multiples of .8: 0.8, 1.6, 2.4, with some extra overhead.
Almost as if some calibration routine or some other busy-loop misses the train occasionally.
The way i'd go about debugging this is to narrow down the approximate place the slowdown happens, then enable
CONFIG_FUNCTION_TRACER(and disableCONFIG_DYNAMIC_FTRACE=y, to not have to deal with the dynamic patching aspects), and do a single-shot tracing session of only that section, on only one CPU:if (smp_processor_id() == 7) ftrace_enabled = 1; ... bootup sequence ... if (smp_processor_id() == 7) ftrace_enabled = 0;
Quoted 7 lines
And recover the resulting trace from /debug/tracing/trace - it should have the reason in it plain and simple.
( Unfortunately i'm not 100% sure that setting
ftrace_enabledto 1 is enough.
I asked for a simple ad-hoc enable/disable function tracing mechanism _ages_ ago - Steve, Frederic, what happened to that? ftrace_start()/stop() does not seem to allow that. )
I don't remember such request. But that would be useful indeed. We could simply pair the setting of an early tracer with tracing disabled and then manually delimit the places to trace with tracing_on/tracing_off().
Whatever.
For now what you can do is setting the function_graph tracer on bootup:
ftrace=function_graph
and call ftrace_graph_stop() in the place you want the trace to finish (you could use ftrace_graph_filter= to delimit the function tracing window, but that won't work without dynamic tracing, neither with __init functions).
So, after the boot you can look at /debug/tracing/per_cpu/cpu7/trace and the end of the trace should contain what you want.
Quoted 5 lines · Frederic Weisbecker
Quoted 4 lines · Ingo Molnar
if (smp_processor_id() == 7) ftrace_enabled = 1;
Quoted 7 lines
Quoted 4 lines
... bootup sequence ... if (smp_processor_id() == 7) ftrace_enabled = 0;So, after the boot you can look at /debug/tracing/per_cpu/cpu7/trace and the end of the trace should contain what you want.
Both of you seemed to miss the fact that it's not cpu7 that is particularly slow. See the original email from me in this thread: the jump was at some random point:
[ 0.245179] CPU 1 MCA banks CMCI:2 CMCI:3 CMCI:5 SHD:6 SHD:8
[ 0.265332] #2
[ 0.353185] CPU 2 MCA banks CMCI:2 CMCI:3 CMCI:5 SHD:6 SHD:8
[ 0.373328] #3
[ 2.193277] CPU 3 MCA banks CMCI:2 CMCI:3 CMCI:5 SHD:6 SHD:8
[ 2.213379] #4and the reason I grepped for "CPU 7" was that it's the _last_ CPU on this machine, so what I was grepping for was basically "how long did it take to bring up all CPU's".
So that particular really bad case apparently happened for CPU#3, but the two other slow cases happened for CPU#4.
Also, it seems to happen only about every fifth boot or so. Suggestions for something simple that can trace things like that?
Linus
Steven Rostedt
maintainerQuoted 21 lines · Frederic Weisbecker
Quoted 20 lines · Ingo Molnar
Weird. It seems to be around multiples of .8: 0.8, 1.6, 2.4, with some extra overhead.
Almost as if some calibration routine or some other busy-loop misses the train occasionally.
The way i'd go about debugging this is to narrow down the approximate place the slowdown happens, then enable
CONFIG_FUNCTION_TRACER(and disableCONFIG_DYNAMIC_FTRACE=y, to not have to deal with the dynamic patching aspects), and do a single-shot tracing session of only that section, on only one CPU:if (smp_processor_id() == 7) ftrace_enabled = 1; ... bootup sequence ... if (smp_processor_id() == 7) ftrace_enabled = 0;
Quoted 8 lines
Quoted 7 lines
And recover the resulting trace from /debug/tracing/trace - it should have the reason in it plain and simple.
( Unfortunately i'm not 100% sure that setting
ftrace_enabledto 1 is enough.
I asked for a simple ad-hoc enable/disable function tracing mechanism _ages_ ago - Steve, Frederic, what happened to that? ftrace_start()/stop() does not seem to allow that. )
Setting ftrace_enabled = 0 should stop the function tracer, but may not stop the function graph tracer.
Quoted 6 lines
I don't remember such request. But that would be useful indeed. We could simply pair the setting of an early tracer with tracing disabled and then manually delimit the places to trace with tracing_on/tracing_off().
It's best to use tracing_off() and tracing_on() for such things.
Quoted 9 lines
Whatever.
For now what you can do is setting the
function_graphtracer on bootup:ftrace=function_graph
and call
ftrace_graph_stop()in the place you want the trace
tracing_off() is the best API for this. Although you still have the overhead of the tracer. But you can just
echo nop > /debug/tracing/current_tracer
to remove the overhead after bootup.
-- Steve
Quoted 7 lines
to finish (you could use ftrace_graph_filter= to delimit the function tracing window, but that won't work without dynamic tracing, neither with
__initfunctions).So, after the boot you can look at /debug/tracing/per_cpu/cpu7/trace and the end of the trace should contain what you want.
Steven Rostedt
maintainerQuoted 15 lines · Linus Torvalds
Both of you seemed to miss the fact that it's not cpu7 that is particularly slow. See the original email from me in this thread: the jump was at some random point:
[ 0.245179] CPU 1 MCA banks CMCI:2 CMCI:3 CMCI:5 SHD:6 SHD:8 [ 0.265332] #2 [ 0.353185] CPU 2 MCA banks CMCI:2 CMCI:3 CMCI:5 SHD:6 SHD:8 [ 0.373328] #3 [ 2.193277] CPU 3 MCA banks CMCI:2 CMCI:3 CMCI:5 SHD:6 SHD:8 [ 2.213379] #4and the reason I grepped for "CPU 7" was that it's the _last_ CPU on this machine, so what I was grepping for was basically "how long did it take to bring up all CPU's".
Quoted 5 lines
So that particular really bad case apparently happened for CPU#3, but the two other slow cases happened for CPU#4.
Also, it seems to happen only about every fifth boot or so. Suggestions for something simple that can trace things like that?
As Frederic has said you can use 'ftrace=function_graph' on the kernel command line. It will be initialized in early_initcall (which I believe is before CPUs are set up. Then add a tracing_off() after the trouble code. You can make the trace buffers bigger with the kernel command line:
trace_buf_size=10000000
The above will make the trace buffer 10Meg per CPU. Unlike the "buffer_size_kb" file, this number is in bytes, even though it will round to the nearest page. (I probably should make this into kb, and rename it to trace_buf_size_kb, and deprecate trace_buf_size).
Then you can cat out /debug/tracing/trace, and search for large latencies in the timestamps.
-- Steve
Steven Rostedt
maintainerQuoted 8 lines · Steven Rostedt
As Frederic has said you can use 'ftrace=function_graph' on the kernel command line. It will be initialized in
early_initcall(which I believe is before CPUs are set up. Then add atracing_off()after the trouble code. You can make the trace buffers bigger with the kernel command line:trace_buf_size=10000000
Quoted 7 lines
The above will make the trace buffer 10Meg per CPU. Unlike the "
buffer_size_kb" file, this number is in bytes, even though it will round to the nearest page. (I probably should make this into kb, and rename it totrace_buf_size_kb, and deprecatetrace_buf_size).Then you can cat out /debug/tracing/trace, and search for large latencies in the timestamps.
I just tried the above and it doesn't work. The ring buffer gets allocated with the early_initcall(), so trace_printk()'s will work. But the function and function graph tracers don't get registered until the device_initcall().
If you are still interested, this patch will allow you to run the function graph tracer before smp_init(). You still need to add "ftrace=function_graph" on the kernel command line.
It's a hack, but I tried it out and it worked.
-- Steve
init/main.c +7 -0
@@ -868,8 +868,15 @@ static int __init kernel_init(void * unused)do_pre_smp_initcalls ();start_boot_trace (); + { +int init_graph_trace (void ); +init_graph_trace (); + } +trace_printk ("start\n" );smp_init ();sched_init_smp (); +trace_printk ("end\n" ); +tracing_off ();do_basic_setup ();
kernel/trace/trace_functions_graph.c +2 -2
@@ -1214,11 +1214,11 @@ static struct tracer graph_trace __read_mostly = {#endif }; -static __init int init_graph_trace (void ) +__init int init_graph_trace (void ) { max_bytes_for_cpu =snprintf (NULL ,0 ,"%d" , nr_cpu_ids -1 );return register_tracer (&graph_trace); } -device_initcall (init_graph_trace); +//device_initcall(init_graph_trace);
H. Peter Anvin
reviewerQuoted 7 lines · Steven Rostedt
As Frederic has said you can use 'ftrace=function_graph' on the kernel command line. It will be initialized in
early_initcall(which I believe is before CPUs are set up. Then add atracing_off()after the trouble code. You can make the trace buffers bigger with the kernel command line:
Quoted 7 lines
trace_buf_size=10000000The above will make the trace buffer 10Meg per CPU. Unlike the "
buffer_size_kb" file, this number is in bytes, even though it will round to the nearest page. (I probably should make this into kb, and rename it totrace_buf_size_kb, and deprecatetrace_buf_size).
Memory sizes specified on the kernel command line should generally be in units of bytes, but accepting suffixes.
-hpa