mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-16 01:04:08 +08:00
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
@ -40,6 +40,7 @@
|
||||
#include <linux/percpu.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/cpu.h>
|
||||
#include <linux/smp.h>
|
||||
|
||||
#include <linux/hw_breakpoint.h>
|
||||
@ -388,7 +389,8 @@ register_wide_hw_breakpoint(struct perf_event_attr *attr,
|
||||
if (!cpu_events)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
for_each_possible_cpu(cpu) {
|
||||
get_online_cpus();
|
||||
for_each_online_cpu(cpu) {
|
||||
pevent = per_cpu_ptr(cpu_events, cpu);
|
||||
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;
|
||||
}
|
||||
}
|
||||
put_online_cpus();
|
||||
|
||||
return cpu_events;
|
||||
|
||||
fail:
|
||||
for_each_possible_cpu(cpu) {
|
||||
for_each_online_cpu(cpu) {
|
||||
pevent = per_cpu_ptr(cpu_events, cpu);
|
||||
if (IS_ERR(*pevent))
|
||||
break;
|
||||
unregister_hw_breakpoint(*pevent);
|
||||
}
|
||||
put_online_cpus();
|
||||
|
||||
free_percpu(cpu_events);
|
||||
/* return the error if any */
|
||||
return ERR_PTR(err);
|
||||
}
|
||||
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_len = HW_BREAKPOINT_LEN_4;
|
||||
|
||||
ret = -EAGAIN;
|
||||
entry->ksym_hbp = register_wide_hw_breakpoint(&entry->attr,
|
||||
ksym_hbp_handler);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user