Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 199727
b: refs/heads/master
c: 3771f07
h: refs/heads/master
i:
  199725: a67f725
  199723: a2a0bae
  199719: 746b903
  199711: b798980
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed May 31, 2010
1 parent f34604f commit 9155476
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8a49542c0554af7d0073aac0ee73ee65b807ef34
refs/heads/master: 3771f0771154675d4a0ca780be2411f3cc357208
2 changes: 1 addition & 1 deletion trunk/include/trace/ftrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ perf_trace_##call(void *__data, proto) \
\
{ assign; } \
\
head = per_cpu_ptr(event_call->perf_events, smp_processor_id());\
head = this_cpu_ptr(event_call->perf_events); \
perf_trace_buf_submit(entry, __entry_size, rctx, __addr, \
__count, &__regs, head); \
}
Expand Down
10 changes: 8 additions & 2 deletions trunk/kernel/trace/trace_event_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ int perf_trace_enable(struct perf_event *p_event)
if (WARN_ON_ONCE(!list))
return -EINVAL;

list = per_cpu_ptr(list, smp_processor_id());
list = this_cpu_ptr(list);
hlist_add_head_rcu(&p_event->hlist_entry, list);

return 0;
Expand All @@ -142,6 +142,12 @@ void perf_trace_destroy(struct perf_event *p_event)
tp_event->class->perf_probe,
tp_event);

/*
* Ensure our callback won't be called anymore. See
* tracepoint_probe_unregister() and __DO_TRACE().
*/
synchronize_sched();

free_percpu(tp_event->perf_events);
tp_event->perf_events = NULL;

Expand Down Expand Up @@ -169,7 +175,7 @@ __kprobes void *perf_trace_buf_prepare(int size, unsigned short type,
if (*rctxp < 0)
return NULL;

raw_data = per_cpu_ptr(perf_trace_buf[*rctxp], smp_processor_id());
raw_data = this_cpu_ptr(perf_trace_buf[*rctxp]);

/* zero the dead bytes from align to not leak stack to user */
memset(&raw_data[size - sizeof(u64)], 0, sizeof(u64));
Expand Down
4 changes: 2 additions & 2 deletions trunk/kernel/trace/trace_kprobe.c
Original file line number Diff line number Diff line change
Expand Up @@ -1359,7 +1359,7 @@ static __kprobes void kprobe_perf_func(struct kprobe *kp,
for (i = 0; i < tp->nr_args; i++)
call_fetch(&tp->args[i].fetch, regs, data + tp->args[i].offset);

head = per_cpu_ptr(call->perf_events, smp_processor_id());
head = this_cpu_ptr(call->perf_events);
perf_trace_buf_submit(entry, size, rctx, entry->ip, 1, regs, head);
}

Expand Down Expand Up @@ -1392,7 +1392,7 @@ static __kprobes void kretprobe_perf_func(struct kretprobe_instance *ri,
for (i = 0; i < tp->nr_args; i++)
call_fetch(&tp->args[i].fetch, regs, data + tp->args[i].offset);

head = per_cpu_ptr(call->perf_events, smp_processor_id());
head = this_cpu_ptr(call->perf_events);
perf_trace_buf_submit(entry, size, rctx, entry->ret_ip, 1, regs, head);
}

Expand Down
4 changes: 2 additions & 2 deletions trunk/kernel/trace/trace_syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ static void perf_syscall_enter(void *ignore, struct pt_regs *regs, long id)
syscall_get_arguments(current, regs, 0, sys_data->nb_args,
(unsigned long *)&rec->args);

head = per_cpu_ptr(sys_data->enter_event->perf_events, smp_processor_id());
head = this_cpu_ptr(sys_data->enter_event->perf_events);
perf_trace_buf_submit(rec, size, rctx, 0, 1, regs, head);
}

Expand Down Expand Up @@ -595,7 +595,7 @@ static void perf_syscall_exit(void *ignore, struct pt_regs *regs, long ret)
rec->nr = syscall_nr;
rec->ret = syscall_get_return_value(current, regs);

head = per_cpu_ptr(sys_data->exit_event->perf_events, smp_processor_id());
head = this_cpu_ptr(sys_data->exit_event->perf_events);
perf_trace_buf_submit(rec, size, rctx, 0, 1, regs, head);
}

Expand Down

0 comments on commit 9155476

Please sign in to comment.