Skip to contentSkip to conversation

tracepoints: Code clean up

PATCH New Steven Rostedt 1 participant 1 message Feb 4, 2021 Tracing

lore
Share & tools
lore

Steven Rostedt

author maintainer
#0 lore raw

PATCH v2 1/1 tracepoints: Code clean up

From: "Steven Rostedt (VMware)" <[email protected]>

Restructure the code a bit to make it simpler, fix some formatting problems and add READ_ONCE/WRITE_ONCE to make sure there's no compiler load/store tearing to the variables that can be accessed across CPUs.

Started with Mathieu Desnoyers's patch:

And will keep his signature, but I will take the responsibility of this being correct, and keep the authorship.

---
 include/linux/tracepoint.h |  2 +-
 kernel/tracepoint.c        | 91 +++++++++++++++-----------------------
 2 files changed, 36 insertions(+), 57 deletions(-)
include/linux/tracepoint.h +1 -1
index 966ed8980327..dc1d4c612cc3 100644
@@ -309,7 +309,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
 			rcu_dereference_raw((&__tracepoint_##_name)->funcs); \
 		if (it_func_ptr) {					\
 			do {						\
-				it_func = (it_func_ptr)->func;		\
+				it_func = READ_ONCE((it_func_ptr)->func); \
 				__data = (it_func_ptr)->data;		\
 				((void(*)(void *, proto))(it_func))(__data, args); \
 			} while ((++it_func_ptr)->func);		\
kernel/tracepoint.c +35 -56

126 lines not on this page · raw message

Signature · 1 line
2.25.4