diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-08-13 04:13:22 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-08-13 04:13:22 -0400 |
commit | 28402971d869e26271b25301011f667d3a5640c3 (patch) | |
tree | 39fe9451f609c3ad47382595c61db855ee5dc49d | |
parent | 8f7a0dc51674ad0dd06155291b0aed60d655943c (diff) |
perf_counter: Provide hw_perf_counter_setup_online() APIs
Provide weak aliases for hw_perf_counter_setup_online(). This is
used by the BTS patches (for v2.6.32), but it interacts with
fixes so propagate this upstream. (it has no effect as of yet)
Also export perf_counter_output() to architecture code.
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | include/linux/perf_counter.h | 2 | ||||
-rw-r--r-- | kernel/perf_counter.c | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h index a9d823a93fe8..2b36afe6ae0f 100644 --- a/include/linux/perf_counter.h +++ b/include/linux/perf_counter.h | |||
@@ -694,6 +694,8 @@ struct perf_sample_data { | |||
694 | 694 | ||
695 | extern int perf_counter_overflow(struct perf_counter *counter, int nmi, | 695 | extern int perf_counter_overflow(struct perf_counter *counter, int nmi, |
696 | struct perf_sample_data *data); | 696 | struct perf_sample_data *data); |
697 | extern void perf_counter_output(struct perf_counter *counter, int nmi, | ||
698 | struct perf_sample_data *data); | ||
697 | 699 | ||
698 | /* | 700 | /* |
699 | * Return 1 for a software counter, 0 for a hardware counter | 701 | * Return 1 for a software counter, 0 for a hardware counter |
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c index b0b20a07f394..e26d2fcfa320 100644 --- a/kernel/perf_counter.c +++ b/kernel/perf_counter.c | |||
@@ -88,6 +88,7 @@ void __weak hw_perf_disable(void) { barrier(); } | |||
88 | void __weak hw_perf_enable(void) { barrier(); } | 88 | void __weak hw_perf_enable(void) { barrier(); } |
89 | 89 | ||
90 | void __weak hw_perf_counter_setup(int cpu) { barrier(); } | 90 | void __weak hw_perf_counter_setup(int cpu) { barrier(); } |
91 | void __weak hw_perf_counter_setup_online(int cpu) { barrier(); } | ||
91 | 92 | ||
92 | int __weak | 93 | int __weak |
93 | hw_perf_group_sched_in(struct perf_counter *group_leader, | 94 | hw_perf_group_sched_in(struct perf_counter *group_leader, |
@@ -2630,7 +2631,7 @@ static u32 perf_counter_tid(struct perf_counter *counter, struct task_struct *p) | |||
2630 | return task_pid_nr_ns(p, counter->ns); | 2631 | return task_pid_nr_ns(p, counter->ns); |
2631 | } | 2632 | } |
2632 | 2633 | ||
2633 | static void perf_counter_output(struct perf_counter *counter, int nmi, | 2634 | void perf_counter_output(struct perf_counter *counter, int nmi, |
2634 | struct perf_sample_data *data) | 2635 | struct perf_sample_data *data) |
2635 | { | 2636 | { |
2636 | int ret; | 2637 | int ret; |
@@ -4592,6 +4593,11 @@ perf_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu) | |||
4592 | perf_counter_init_cpu(cpu); | 4593 | perf_counter_init_cpu(cpu); |
4593 | break; | 4594 | break; |
4594 | 4595 | ||
4596 | case CPU_ONLINE: | ||
4597 | case CPU_ONLINE_FROZEN: | ||
4598 | hw_perf_counter_setup_online(cpu); | ||
4599 | break; | ||
4600 | |||
4595 | case CPU_DOWN_PREPARE: | 4601 | case CPU_DOWN_PREPARE: |
4596 | case CPU_DOWN_PREPARE_FROZEN: | 4602 | case CPU_DOWN_PREPARE_FROZEN: |
4597 | perf_counter_exit_cpu(cpu); | 4603 | perf_counter_exit_cpu(cpu); |
@@ -4616,6 +4622,8 @@ void __init perf_counter_init(void) | |||
4616 | { | 4622 | { |
4617 | perf_cpu_notify(&perf_cpu_nb, (unsigned long)CPU_UP_PREPARE, | 4623 | perf_cpu_notify(&perf_cpu_nb, (unsigned long)CPU_UP_PREPARE, |
4618 | (void *)(long)smp_processor_id()); | 4624 | (void *)(long)smp_processor_id()); |
4625 | perf_cpu_notify(&perf_cpu_nb, (unsigned long)CPU_ONLINE, | ||
4626 | (void *)(long)smp_processor_id()); | ||
4619 | register_cpu_notifier(&perf_cpu_nb); | 4627 | register_cpu_notifier(&perf_cpu_nb); |
4620 | } | 4628 | } |
4621 | 4629 | ||