diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-31 14:52:01 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-31 14:52:01 -0500 |
commit | b21c07040304b8716e38a4a0e4ab60f386357e61 (patch) | |
tree | eb2cf03ec35b9a5090c0adaab659a766e02c3b10 /kernel/hw_breakpoint.c | |
parent | 4e58fb7305449cf8c5a86dd97dfc1812221be77c (diff) | |
parent | fb7ae981cb9fe8665b9da97e8734745e030c151d (diff) |
Merge branch 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
tracing: Fix sign fields in ftrace_define_fields_##call()
tracing/syscalls: Fix typo in SYSCALL_DEFINE0
tracing/kprobe: Show sign of fields in trace_kprobe format files
ksym_tracer: Remove trace_stat
ksym_tracer: Fix race when incrementing count
ksym_tracer: Fix to allow writing newline to ksym_trace_filter
ksym_tracer: Fix to make the tracer work
tracing: Kconfig spelling fixes and cleanups
tracing: Fix setting tracer specific options
Documentation: Update ftrace-design.txt
Documentation: Update tracepoint-analysis.txt
Documentation: Update mmiotrace.txt
Diffstat (limited to 'kernel/hw_breakpoint.c')
-rw-r--r-- | kernel/hw_breakpoint.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/kernel/hw_breakpoint.c b/kernel/hw_breakpoint.c index dbcbf6a33a08..50dbd5999588 100644 --- a/kernel/hw_breakpoint.c +++ b/kernel/hw_breakpoint.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/percpu.h> | 40 | #include <linux/percpu.h> |
41 | #include <linux/sched.h> | 41 | #include <linux/sched.h> |
42 | #include <linux/init.h> | 42 | #include <linux/init.h> |
43 | #include <linux/cpu.h> | ||
43 | #include <linux/smp.h> | 44 | #include <linux/smp.h> |
44 | 45 | ||
45 | #include <linux/hw_breakpoint.h> | 46 | #include <linux/hw_breakpoint.h> |
@@ -388,7 +389,8 @@ register_wide_hw_breakpoint(struct perf_event_attr *attr, | |||
388 | if (!cpu_events) | 389 | if (!cpu_events) |
389 | return ERR_PTR(-ENOMEM); | 390 | return ERR_PTR(-ENOMEM); |
390 | 391 | ||
391 | for_each_possible_cpu(cpu) { | 392 | get_online_cpus(); |
393 | for_each_online_cpu(cpu) { | ||
392 | pevent = per_cpu_ptr(cpu_events, cpu); | 394 | pevent = per_cpu_ptr(cpu_events, cpu); |
393 | bp = perf_event_create_kernel_counter(attr, cpu, -1, triggered); | 395 | bp = perf_event_create_kernel_counter(attr, cpu, -1, triggered); |
394 | 396 | ||
@@ -399,18 +401,20 @@ register_wide_hw_breakpoint(struct perf_event_attr *attr, | |||
399 | goto fail; | 401 | goto fail; |
400 | } | 402 | } |
401 | } | 403 | } |
404 | put_online_cpus(); | ||
402 | 405 | ||
403 | return cpu_events; | 406 | return cpu_events; |
404 | 407 | ||
405 | fail: | 408 | fail: |
406 | for_each_possible_cpu(cpu) { | 409 | for_each_online_cpu(cpu) { |
407 | pevent = per_cpu_ptr(cpu_events, cpu); | 410 | pevent = per_cpu_ptr(cpu_events, cpu); |
408 | if (IS_ERR(*pevent)) | 411 | if (IS_ERR(*pevent)) |
409 | break; | 412 | break; |
410 | unregister_hw_breakpoint(*pevent); | 413 | unregister_hw_breakpoint(*pevent); |
411 | } | 414 | } |
415 | put_online_cpus(); | ||
416 | |||
412 | free_percpu(cpu_events); | 417 | free_percpu(cpu_events); |
413 | /* return the error if any */ | ||
414 | return ERR_PTR(err); | 418 | return ERR_PTR(err); |
415 | } | 419 | } |
416 | EXPORT_SYMBOL_GPL(register_wide_hw_breakpoint); | 420 | EXPORT_SYMBOL_GPL(register_wide_hw_breakpoint); |