tracing/uprobes: Use trace_event_buffer_reserve() helper

To be consistent with kprobes and eprobes, use
trace_event_buffer_reserver() and trace_event_buffer_commit(). This will
ensure that any updates to trace events will also be implemented on uprobe
events.

Link: https://lkml.kernel.org/r/20211206162440.69fbf96c@gandalf.local.homeAcked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent 5e6cd84e
...@@ -949,8 +949,7 @@ static void __uprobe_trace_func(struct trace_uprobe *tu, ...@@ -949,8 +949,7 @@ static void __uprobe_trace_func(struct trace_uprobe *tu,
struct trace_event_file *trace_file) struct trace_event_file *trace_file)
{ {
struct uprobe_trace_entry_head *entry; struct uprobe_trace_entry_head *entry;
struct trace_buffer *buffer; struct trace_event_buffer fbuffer;
struct ring_buffer_event *event;
void *data; void *data;
int size, esize; int size, esize;
struct trace_event_call *call = trace_probe_event_call(&tu->tp); struct trace_event_call *call = trace_probe_event_call(&tu->tp);
...@@ -965,12 +964,10 @@ static void __uprobe_trace_func(struct trace_uprobe *tu, ...@@ -965,12 +964,10 @@ static void __uprobe_trace_func(struct trace_uprobe *tu,
esize = SIZEOF_TRACE_ENTRY(is_ret_probe(tu)); esize = SIZEOF_TRACE_ENTRY(is_ret_probe(tu));
size = esize + tu->tp.size + dsize; size = esize + tu->tp.size + dsize;
event = trace_event_buffer_lock_reserve(&buffer, trace_file, entry = trace_event_buffer_reserve(&fbuffer, trace_file, size);
call->event.type, size, 0); if (!entry)
if (!event)
return; return;
entry = ring_buffer_event_data(event);
if (is_ret_probe(tu)) { if (is_ret_probe(tu)) {
entry->vaddr[0] = func; entry->vaddr[0] = func;
entry->vaddr[1] = instruction_pointer(regs); entry->vaddr[1] = instruction_pointer(regs);
...@@ -982,7 +979,7 @@ static void __uprobe_trace_func(struct trace_uprobe *tu, ...@@ -982,7 +979,7 @@ static void __uprobe_trace_func(struct trace_uprobe *tu,
memcpy(data, ucb->buf, tu->tp.size + dsize); memcpy(data, ucb->buf, tu->tp.size + dsize);
event_trigger_unlock_commit(trace_file, buffer, event, entry, 0); trace_event_buffer_commit(&fbuffer);
} }
/* uprobe handler */ /* uprobe handler */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment