diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-02-09 04:35:12 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-02-09 04:35:12 -0500 |
commit | 44b0635481437140b0e29d6023f05e805d5e7620 (patch) | |
tree | ff31986115075410d0479df307a6b9841976026c /arch | |
parent | 4ad476e11f94fd3724c6e272d8220e99cd222b27 (diff) | |
parent | 57794a9d48b63e34acbe63282628c9f029603308 (diff) |
Merge branch 'tip/tracing/core/devel' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into tracing/ftrace
Conflicts:
kernel/trace/trace_hw_branches.c
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/Kconfig | 1 | ||||
-rw-r--r-- | arch/x86/kernel/ftrace.c | 35 |
2 files changed, 9 insertions, 27 deletions
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 73f7fe8fd4d1..2cf7bbcaed4e 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -34,6 +34,7 @@ config X86 | |||
34 | select HAVE_FUNCTION_TRACER | 34 | select HAVE_FUNCTION_TRACER |
35 | select HAVE_FUNCTION_GRAPH_TRACER | 35 | select HAVE_FUNCTION_GRAPH_TRACER |
36 | select HAVE_FUNCTION_TRACE_MCOUNT_TEST | 36 | select HAVE_FUNCTION_TRACE_MCOUNT_TEST |
37 | select HAVE_FTRACE_NMI_ENTER if DYNAMIC_FTRACE | ||
37 | select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64) | 38 | select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64) |
38 | select HAVE_ARCH_KGDB if !X86_VOYAGER | 39 | select HAVE_ARCH_KGDB if !X86_VOYAGER |
39 | select HAVE_ARCH_TRACEHOOK | 40 | select HAVE_ARCH_TRACEHOOK |
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c index 4d33224c055f..d74d75e0952d 100644 --- a/arch/x86/kernel/ftrace.c +++ b/arch/x86/kernel/ftrace.c | |||
@@ -82,7 +82,7 @@ static unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr) | |||
82 | * are the same as what exists. | 82 | * are the same as what exists. |
83 | */ | 83 | */ |
84 | 84 | ||
85 | static atomic_t in_nmi = ATOMIC_INIT(0); | 85 | static atomic_t nmi_running = ATOMIC_INIT(0); |
86 | static int mod_code_status; /* holds return value of text write */ | 86 | static int mod_code_status; /* holds return value of text write */ |
87 | static int mod_code_write; /* set when NMI should do the write */ | 87 | static int mod_code_write; /* set when NMI should do the write */ |
88 | static void *mod_code_ip; /* holds the IP to write to */ | 88 | static void *mod_code_ip; /* holds the IP to write to */ |
@@ -115,8 +115,8 @@ static void ftrace_mod_code(void) | |||
115 | 115 | ||
116 | void ftrace_nmi_enter(void) | 116 | void ftrace_nmi_enter(void) |
117 | { | 117 | { |
118 | atomic_inc(&in_nmi); | 118 | atomic_inc(&nmi_running); |
119 | /* Must have in_nmi seen before reading write flag */ | 119 | /* Must have nmi_running seen before reading write flag */ |
120 | smp_mb(); | 120 | smp_mb(); |
121 | if (mod_code_write) { | 121 | if (mod_code_write) { |
122 | ftrace_mod_code(); | 122 | ftrace_mod_code(); |
@@ -126,19 +126,19 @@ void ftrace_nmi_enter(void) | |||
126 | 126 | ||
127 | void ftrace_nmi_exit(void) | 127 | void ftrace_nmi_exit(void) |
128 | { | 128 | { |
129 | /* Finish all executions before clearing in_nmi */ | 129 | /* Finish all executions before clearing nmi_running */ |
130 | smp_wmb(); | 130 | smp_wmb(); |
131 | atomic_dec(&in_nmi); | 131 | atomic_dec(&nmi_running); |
132 | } | 132 | } |
133 | 133 | ||
134 | static void wait_for_nmi(void) | 134 | static void wait_for_nmi(void) |
135 | { | 135 | { |
136 | if (!atomic_read(&in_nmi)) | 136 | if (!atomic_read(&nmi_running)) |
137 | return; | 137 | return; |
138 | 138 | ||
139 | do { | 139 | do { |
140 | cpu_relax(); | 140 | cpu_relax(); |
141 | } while(atomic_read(&in_nmi)); | 141 | } while (atomic_read(&nmi_running)); |
142 | 142 | ||
143 | nmi_wait_count++; | 143 | nmi_wait_count++; |
144 | } | 144 | } |
@@ -367,25 +367,6 @@ int ftrace_disable_ftrace_graph_caller(void) | |||
367 | return ftrace_mod_jmp(ip, old_offset, new_offset); | 367 | return ftrace_mod_jmp(ip, old_offset, new_offset); |
368 | } | 368 | } |
369 | 369 | ||
370 | #else /* CONFIG_DYNAMIC_FTRACE */ | ||
371 | |||
372 | /* | ||
373 | * These functions are picked from those used on | ||
374 | * this page for dynamic ftrace. They have been | ||
375 | * simplified to ignore all traces in NMI context. | ||
376 | */ | ||
377 | static atomic_t in_nmi; | ||
378 | |||
379 | void ftrace_nmi_enter(void) | ||
380 | { | ||
381 | atomic_inc(&in_nmi); | ||
382 | } | ||
383 | |||
384 | void ftrace_nmi_exit(void) | ||
385 | { | ||
386 | atomic_dec(&in_nmi); | ||
387 | } | ||
388 | |||
389 | #endif /* !CONFIG_DYNAMIC_FTRACE */ | 370 | #endif /* !CONFIG_DYNAMIC_FTRACE */ |
390 | 371 | ||
391 | /* Add a function return address to the trace stack on thread info.*/ | 372 | /* Add a function return address to the trace stack on thread info.*/ |
@@ -475,7 +456,7 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr) | |||
475 | &return_to_handler; | 456 | &return_to_handler; |
476 | 457 | ||
477 | /* Nmi's are currently unsupported */ | 458 | /* Nmi's are currently unsupported */ |
478 | if (unlikely(atomic_read(&in_nmi))) | 459 | if (unlikely(in_nmi())) |
479 | return; | 460 | return; |
480 | 461 | ||
481 | if (unlikely(atomic_read(¤t->tracing_graph_pause))) | 462 | if (unlikely(atomic_read(¤t->tracing_graph_pause))) |