ksym_tracer: Fix to make the tracer work
ksym tracer doesn't work: # echo tasklist_lock:rw- > ksym_trace_filter -bash: echo: write error: No such device It's because we pass to perf_event_create_kernel_counter() a cpu number which is not present. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: K.Prasad <prasad@linux.vnet.ibm.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> LKML-Reference: <4B3AF19E.1010201@cn.fujitsu.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
40892367bc
commit
88f7a890d7
2 changed files with 7 additions and 4 deletions
|
@ -40,6 +40,7 @@
|
||||||
#include <linux/percpu.h>
|
#include <linux/percpu.h>
|
||||||
#include <linux/sched.h>
|
#include <linux/sched.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
|
#include <linux/cpu.h>
|
||||||
#include <linux/smp.h>
|
#include <linux/smp.h>
|
||||||
|
|
||||||
#include <linux/hw_breakpoint.h>
|
#include <linux/hw_breakpoint.h>
|
||||||
|
@ -388,7 +389,8 @@ register_wide_hw_breakpoint(struct perf_event_attr *attr,
|
||||||
if (!cpu_events)
|
if (!cpu_events)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
for_each_possible_cpu(cpu) {
|
get_online_cpus();
|
||||||
|
for_each_online_cpu(cpu) {
|
||||||
pevent = per_cpu_ptr(cpu_events, cpu);
|
pevent = per_cpu_ptr(cpu_events, cpu);
|
||||||
bp = perf_event_create_kernel_counter(attr, cpu, -1, triggered);
|
bp = perf_event_create_kernel_counter(attr, cpu, -1, triggered);
|
||||||
|
|
||||||
|
@ -399,18 +401,20 @@ register_wide_hw_breakpoint(struct perf_event_attr *attr,
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
put_online_cpus();
|
||||||
|
|
||||||
return cpu_events;
|
return cpu_events;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
for_each_possible_cpu(cpu) {
|
for_each_online_cpu(cpu) {
|
||||||
pevent = per_cpu_ptr(cpu_events, cpu);
|
pevent = per_cpu_ptr(cpu_events, cpu);
|
||||||
if (IS_ERR(*pevent))
|
if (IS_ERR(*pevent))
|
||||||
break;
|
break;
|
||||||
unregister_hw_breakpoint(*pevent);
|
unregister_hw_breakpoint(*pevent);
|
||||||
}
|
}
|
||||||
|
put_online_cpus();
|
||||||
|
|
||||||
free_percpu(cpu_events);
|
free_percpu(cpu_events);
|
||||||
/* return the error if any */
|
|
||||||
return ERR_PTR(err);
|
return ERR_PTR(err);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(register_wide_hw_breakpoint);
|
EXPORT_SYMBOL_GPL(register_wide_hw_breakpoint);
|
||||||
|
|
|
@ -197,7 +197,6 @@ int process_new_ksym_entry(char *ksymname, int op, unsigned long addr)
|
||||||
entry->attr.bp_addr = addr;
|
entry->attr.bp_addr = addr;
|
||||||
entry->attr.bp_len = HW_BREAKPOINT_LEN_4;
|
entry->attr.bp_len = HW_BREAKPOINT_LEN_4;
|
||||||
|
|
||||||
ret = -EAGAIN;
|
|
||||||
entry->ksym_hbp = register_wide_hw_breakpoint(&entry->attr,
|
entry->ksym_hbp = register_wide_hw_breakpoint(&entry->attr,
|
||||||
ksym_hbp_handler);
|
ksym_hbp_handler);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue