x86/oprofile: Implement mux_clone()
To setup a counter for all cpus, its structure is cloned from cpu 0. This patch implements mux_clone() to do this part for multiplexing data. Signed-off-by: Robert Richter <robert.richter@amd.com>
This commit is contained in:
parent
5280514471
commit
4d015f79e9
1 changed files with 22 additions and 13 deletions
|
@ -264,6 +264,16 @@ static inline void mux_init(struct oprofile_operations *ops)
|
||||||
ops->switch_events = nmi_switch_event;
|
ops->switch_events = nmi_switch_event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void mux_clone(int cpu)
|
||||||
|
{
|
||||||
|
if (!has_mux())
|
||||||
|
return;
|
||||||
|
|
||||||
|
memcpy(per_cpu(cpu_msrs, cpu).multiplex,
|
||||||
|
per_cpu(cpu_msrs, 0).multiplex,
|
||||||
|
sizeof(struct op_msr) * model->num_virt_counters);
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
inline int op_x86_phys_to_virt(int phys) { return phys; }
|
inline int op_x86_phys_to_virt(int phys) { return phys; }
|
||||||
|
@ -272,6 +282,7 @@ static inline int nmi_setup_mux(void) { return 1; }
|
||||||
static inline void
|
static inline void
|
||||||
nmi_cpu_setup_mux(int cpu, struct op_msrs const * const msrs) { }
|
nmi_cpu_setup_mux(int cpu, struct op_msrs const * const msrs) { }
|
||||||
static inline void mux_init(struct oprofile_operations *ops) { }
|
static inline void mux_init(struct oprofile_operations *ops) { }
|
||||||
|
static void mux_clone(int cpu) { }
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -350,20 +361,18 @@ static int nmi_setup(void)
|
||||||
/* Assume saved/restored counters are the same on all CPUs */
|
/* Assume saved/restored counters are the same on all CPUs */
|
||||||
model->fill_in_addresses(&per_cpu(cpu_msrs, 0));
|
model->fill_in_addresses(&per_cpu(cpu_msrs, 0));
|
||||||
for_each_possible_cpu(cpu) {
|
for_each_possible_cpu(cpu) {
|
||||||
if (cpu != 0) {
|
if (!cpu)
|
||||||
memcpy(per_cpu(cpu_msrs, cpu).counters,
|
continue;
|
||||||
per_cpu(cpu_msrs, 0).counters,
|
|
||||||
sizeof(struct op_msr) * model->num_counters);
|
|
||||||
|
|
||||||
memcpy(per_cpu(cpu_msrs, cpu).controls,
|
memcpy(per_cpu(cpu_msrs, cpu).counters,
|
||||||
per_cpu(cpu_msrs, 0).controls,
|
per_cpu(cpu_msrs, 0).counters,
|
||||||
sizeof(struct op_msr) * model->num_controls);
|
sizeof(struct op_msr) * model->num_counters);
|
||||||
#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
|
|
||||||
memcpy(per_cpu(cpu_msrs, cpu).multiplex,
|
memcpy(per_cpu(cpu_msrs, cpu).controls,
|
||||||
per_cpu(cpu_msrs, 0).multiplex,
|
per_cpu(cpu_msrs, 0).controls,
|
||||||
sizeof(struct op_msr) * model->num_virt_counters);
|
sizeof(struct op_msr) * model->num_controls);
|
||||||
#endif
|
|
||||||
}
|
mux_clone(cpu);
|
||||||
}
|
}
|
||||||
on_each_cpu(nmi_cpu_setup, NULL, 1);
|
on_each_cpu(nmi_cpu_setup, NULL, 1);
|
||||||
nmi_enabled = 1;
|
nmi_enabled = 1;
|
||||||
|
|
Loading…
Add table
Reference in a new issue