From 6334822c529b31302db14e55b6009d0aac580985 Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Tue, 11 Feb 2020 14:51:01 -0500 Subject: [PATCH] fix: rcu: Fix data-race due to atomic_t copy-by-value (v5.6) See upstream commit : commit 6cf539a87a61a4fbc43f625267dbcbcf283872ed Author: Marco Elver Date: Wed Oct 9 17:57:43 2019 +0200 rcu: Fix data-race due to atomic_t copy-by-value This fixes a data-race where `atomic_t dynticks` is copied by value. The copy is performed non-atomically, resulting in a data-race if `dynticks` is updated concurrently. Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- instrumentation/events/lttng-module/rcu.h | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/instrumentation/events/lttng-module/rcu.h b/instrumentation/events/lttng-module/rcu.h index cebfa908..028adc50 100644 --- a/instrumentation/events/lttng-module/rcu.h +++ b/instrumentation/events/lttng-module/rcu.h @@ -386,7 +386,22 @@ LTTNG_TRACEPOINT_EVENT(rcu_fqs, * events use the upper bits of each number, while interrupt-related * events use the lower bits. */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,16,0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)) +LTTNG_TRACEPOINT_EVENT(rcu_dyntick, + + TP_PROTO(const char *polarity, long oldnesting, long newnesting, int dynticks), + + TP_ARGS(polarity, oldnesting, newnesting, dynticks), + + TP_FIELDS( + ctf_string(polarity, polarity) + ctf_integer(long, oldnesting, oldnesting) + ctf_integer(long, newnesting, newnesting) + ctf_integer(int, dynticks, dynticks) + ) +) + +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,16,0)) LTTNG_TRACEPOINT_EVENT(rcu_dyntick, TP_PROTO(const char *polarity, long oldnesting, long newnesting, atomic_t dynticks), -- 2.34.1