All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] tracing: Add trace_trigger_soft_disabled() in front of trace_event_buffer_commit() in trace_inject_entry()
@ 2021-09-02  7:09 jiasheng
  0 siblings, 0 replies; only message in thread
From: jiasheng @ 2021-09-02  7:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: jiasheng

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@iscas.ac.cn>
---
 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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-02  7:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-02  7:09 [PATCH 2/2] tracing: Add trace_trigger_soft_disabled() in front of trace_event_buffer_commit() in trace_inject_entry() jiasheng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.