[PATCH 2/2] tracing: Add trace_trigger_soft_disabled() in front of trace_event_buffer_commit() in trace_inject_entry()
From: jiasheng
Date: Thu Sep 02 2021 - 03:09:31 EST
We have found that in the complied files trace_event_buffer_commit()
appear more than 200 times, and under at least 90% circumstances
that trace_trigger_soft_disabled() and trace_event_buffer_commit()
appear in pairs.
For example, they appear together in the trace_event_raw_event_##call()
of the file complie from 'include/trace/trace_events.h'.
But we have found that in the trace_inject_entry(), there is only
trace_event_buffer_commit() instead of the pair.
Therefore, we consider that the trace_trigger_soft_disabled()
might be forgotten.
Signed-off-by: jiasheng <jiasheng@xxxxxxxxxxx>
---
kernel/trace/trace_events_inject.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/trace/trace_events_inject.c b/kernel/trace/trace_events_inject.c
index c188045..6dfd3cd 100644
--- a/kernel/trace/trace_events_inject.c
+++ b/kernel/trace/trace_events_inject.c
@@ -21,6 +21,8 @@ trace_inject_entry(struct trace_event_file *file, void *rec, int len)
void *entry;
rcu_read_lock_sched();
+ if (trace_trigger_soft_disabled(file))
+ return written;
entry = trace_event_buffer_reserve(&fbuffer, file, len);
if (entry) {
memcpy(entry, rec, len);
--
2.7.4