fix: rcu: Fix data-race due to atomic_t copy-by-value (v5.6)
[lttng-modules.git] / instrumentation / events / lttng-module / rcu.h
index 8392946a74d3da24147a8ae1bd2356634be682df..028adc508612e4dddd7c577c45fe8fc43bdd9d0e 100644 (file)
@@ -1,10 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 #undef TRACE_SYSTEM
 #define TRACE_SYSTEM rcu
 
-#if !defined(_TRACE_RCU_H) || defined(TRACE_HEADER_MULTI_READ)
-#define _TRACE_RCU_H
+#if !defined(LTTNG_TRACE_RCU_H) || defined(TRACE_HEADER_MULTI_READ)
+#define LTTNG_TRACE_RCU_H
 
-#include <linux/tracepoint.h>
+#include <probes/lttng-tracepoint-event.h>
 #include <linux/version.h>
 
 /*
  * An "@" character within "<activity>" is a comment character: Data
  * reduction scripts will ignore the "@" and the remainder of the line.
  */
-TRACE_EVENT(rcu_utilization,
+LTTNG_TRACEPOINT_EVENT(rcu_utilization,
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
+       TP_PROTO(const char *s),
+#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
        TP_PROTO(char *s),
+#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
 
        TP_ARGS(s),
 
-       TP_STRUCT__entry(
-               __string(s, s)
-       ),
-
-       TP_fast_assign(
-               tp_strcpy(s, s)
-       ),
-
-       TP_printk("%s", __get_str(s))
+       TP_FIELDS(
+               ctf_string(s, s)
+       )
 )
 
 #ifdef CONFIG_RCU_TRACE
 
-#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU)
+#if defined(CONFIG_TREE_RCU) \
+       || (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) \
+               && defined(CONFIG_PREEMPT_RCU)) \
+       || defined(CONFIG_TREE_PREEMPT_RCU)
 
 /*
  * Tracepoint for grace-period events: starting and ending a grace
@@ -48,27 +50,46 @@ TRACE_EVENT(rcu_utilization,
  * and "cpuofl", respectively), and a CPU being kicked for being too
  * long in dyntick-idle mode ("kick").
  */
-TRACE_EVENT(rcu_grace_period,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0))
+LTTNG_TRACEPOINT_EVENT(rcu_grace_period,
 
-       TP_PROTO(char *rcuname, unsigned long gpnum, char *gpevent),
+       TP_PROTO(const char *rcuname, unsigned long gp_seq, const char *gpevent),
+
+       TP_ARGS(rcuname, gp_seq, gpevent),
+
+       TP_FIELDS(
+               ctf_string(rcuname, rcuname)
+               ctf_integer(unsigned long, gp_seq, gp_seq)
+               ctf_string(gpevent, gpevent)
+       )
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
+LTTNG_TRACEPOINT_EVENT(rcu_grace_period,
+
+       TP_PROTO(const char *rcuname, unsigned long gpnum, const char *gpevent),
 
        TP_ARGS(rcuname, gpnum, gpevent),
 
-       TP_STRUCT__entry(
-               __string(rcuname, rcuname)
-               __field(unsigned long, gpnum)
-               __string(gpevent, gpevent)
-       ),
+       TP_FIELDS(
+               ctf_string(rcuname, rcuname)
+               ctf_integer(unsigned long, gpnum, gpnum)
+               ctf_string(gpevent, gpevent)
+       )
+)
+#else
+LTTNG_TRACEPOINT_EVENT(rcu_grace_period,
+
+       TP_PROTO(char *rcuname, unsigned long gpnum, char *gpevent),
 
-       TP_fast_assign(
-               tp_strcpy(rcuname, rcuname)
-               tp_assign(gpnum, gpnum)
-               tp_strcpy(gpevent, gpevent)
-       ),
+       TP_ARGS(rcuname, gpnum, gpevent),
 
-       TP_printk("%s %lu %s",
-                 __get_str(rcuname), __entry->gpnum, __get_str(gpevent))
+       TP_FIELDS(
+               ctf_string(rcuname, rcuname)
+               ctf_integer(unsigned long, gpnum, gpnum)
+               ctf_string(gpevent, gpevent)
+       )
 )
+#endif
 
 /*
  * Tracepoint for grace-period-initialization events.  These are
@@ -77,35 +98,58 @@ TRACE_EVENT(rcu_grace_period,
  * rcu_node structure, and the mask of CPUs that will be waited for.
  * All but the type of RCU are extracted from the rcu_node structure.
  */
-TRACE_EVENT(rcu_grace_period_init,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0))
+LTTNG_TRACEPOINT_EVENT(rcu_grace_period_init,
+
+       TP_PROTO(const char *rcuname, unsigned long gp_seq, u8 level,
+                int grplo, int grphi, unsigned long qsmask),
+
+       TP_ARGS(rcuname, gp_seq, level, grplo, grphi, qsmask),
+
+       TP_FIELDS(
+               ctf_string(rcuname, rcuname)
+               ctf_integer(unsigned long, gp_seq, gp_seq)
+               ctf_integer(u8, level, level)
+               ctf_integer(int, grplo, grplo)
+               ctf_integer(int, grphi, grphi)
+               ctf_integer(unsigned long, qsmask, qsmask)
+       )
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
+LTTNG_TRACEPOINT_EVENT(rcu_grace_period_init,
+
+       TP_PROTO(const char *rcuname, unsigned long gpnum, u8 level,
+                int grplo, int grphi, unsigned long qsmask),
+
+       TP_ARGS(rcuname, gpnum, level, grplo, grphi, qsmask),
+
+       TP_FIELDS(
+               ctf_string(rcuname, rcuname)
+               ctf_integer(unsigned long, gpnum, gpnum)
+               ctf_integer(u8, level, level)
+               ctf_integer(int, grplo, grplo)
+               ctf_integer(int, grphi, grphi)
+               ctf_integer(unsigned long, qsmask, qsmask)
+       )
+)
+#else
+LTTNG_TRACEPOINT_EVENT(rcu_grace_period_init,
 
        TP_PROTO(char *rcuname, unsigned long gpnum, u8 level,
                 int grplo, int grphi, unsigned long qsmask),
 
        TP_ARGS(rcuname, gpnum, level, grplo, grphi, qsmask),
 
-       TP_STRUCT__entry(
-               __string(rcuname, rcuname)
-               __field(unsigned long, gpnum)
-               __field(u8, level)
-               __field(int, grplo)
-               __field(int, grphi)
-               __field(unsigned long, qsmask)
-       ),
-
-       TP_fast_assign(
-               tp_strcpy(rcuname, rcuname)
-               tp_assign(gpnum, gpnum)
-               tp_assign(level, level)
-               tp_assign(grplo, grplo)
-               tp_assign(grphi, grphi)
-               tp_assign(qsmask, qsmask)
-       ),
-
-       TP_printk("%s %lu %u %d %d %lx",
-                 __get_str(rcuname), __entry->gpnum, __entry->level,
-                 __entry->grplo, __entry->grphi, __entry->qsmask)
+       TP_FIELDS(
+               ctf_string(rcuname, rcuname)
+               ctf_integer(unsigned long, gpnum, gpnum)
+               ctf_integer(u8, level, level)
+               ctf_integer(int, grplo, grplo)
+               ctf_integer(int, grphi, grphi)
+               ctf_integer(unsigned long, qsmask, qsmask)
+       )
 )
+#endif
 
 /*
  * Tracepoint for tasks blocking within preemptible-RCU read-side
@@ -113,53 +157,92 @@ TRACE_EVENT(rcu_grace_period_init,
  * include SRCU), the grace-period number that the task is blocking
  * (the current or the next), and the task's PID.
  */
-TRACE_EVENT(rcu_preempt_task,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0))
+LTTNG_TRACEPOINT_EVENT(rcu_preempt_task,
 
-       TP_PROTO(char *rcuname, int pid, unsigned long gpnum),
+       TP_PROTO(const char *rcuname, int pid, unsigned long gp_seq),
+
+       TP_ARGS(rcuname, pid, gp_seq),
+
+       TP_FIELDS(
+               ctf_string(rcuname, rcuname)
+               ctf_integer(unsigned long, gp_seq, gp_seq)
+               ctf_integer(int, pid, pid)
+       )
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
+LTTNG_TRACEPOINT_EVENT(rcu_preempt_task,
+
+       TP_PROTO(const char *rcuname, int pid, unsigned long gpnum),
 
        TP_ARGS(rcuname, pid, gpnum),
 
-       TP_STRUCT__entry(
-               __string(rcuname, rcuname)
-               __field(unsigned long, gpnum)
-               __field(int, pid)
-       ),
+       TP_FIELDS(
+               ctf_string(rcuname, rcuname)
+               ctf_integer(unsigned long, gpnum, gpnum)
+               ctf_integer(int, pid, pid)
+       )
+)
+#else
+LTTNG_TRACEPOINT_EVENT(rcu_preempt_task,
+
+       TP_PROTO(char *rcuname, int pid, unsigned long gpnum),
 
-       TP_fast_assign(
-               tp_strcpy(rcuname, rcuname)
-               tp_assign(gpnum, gpnum)
-               tp_assign(pid, pid)
-       ),
+       TP_ARGS(rcuname, pid, gpnum),
 
-       TP_printk("%s %lu %d",
-                 __get_str(rcuname), __entry->gpnum, __entry->pid)
+       TP_FIELDS(
+               ctf_string(rcuname, rcuname)
+               ctf_integer(unsigned long, gpnum, gpnum)
+               ctf_integer(int, pid, pid)
+       )
 )
+#endif
 
 /*
  * Tracepoint for tasks that blocked within a given preemptible-RCU
  * read-side critical section exiting that critical section.  Track the
  * type of RCU (which one day might include SRCU) and the task's PID.
  */
-TRACE_EVENT(rcu_unlock_preempted_task,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0))
+LTTNG_TRACEPOINT_EVENT(rcu_unlock_preempted_task,
 
-       TP_PROTO(char *rcuname, unsigned long gpnum, int pid),
+       TP_PROTO(const char *rcuname, unsigned long gp_seq, int pid),
+
+       TP_ARGS(rcuname, gp_seq, pid),
+
+       TP_FIELDS(
+               ctf_string(rcuname, rcuname)
+               ctf_integer(unsigned long, gp_seq, gp_seq)
+               ctf_integer(int, pid, pid)
+       )
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
+LTTNG_TRACEPOINT_EVENT(rcu_unlock_preempted_task,
+
+       TP_PROTO(const char *rcuname, unsigned long gpnum, int pid),
 
        TP_ARGS(rcuname, gpnum, pid),
 
-       TP_STRUCT__entry(
-               __string(rcuname, rcuname)
-               __field(unsigned long, gpnum)
-               __field(int, pid)
-       ),
+       TP_FIELDS(
+               ctf_string(rcuname, rcuname)
+               ctf_integer(unsigned long, gpnum, gpnum)
+               ctf_integer(int, pid, pid)
+       )
+)
+#else
+LTTNG_TRACEPOINT_EVENT(rcu_unlock_preempted_task,
 
-       TP_fast_assign(
-               tp_strcpy(rcuname, rcuname)
-               tp_assign(gpnum, gpnum)
-               tp_assign(pid, pid)
-       ),
+       TP_PROTO(char *rcuname, unsigned long gpnum, int pid),
 
-       TP_printk("%s %lu %d", __get_str(rcuname), __entry->gpnum, __entry->pid)
+       TP_ARGS(rcuname, gpnum, pid),
+
+       TP_FIELDS(
+               ctf_string(rcuname, rcuname)
+               ctf_integer(unsigned long, gpnum, gpnum)
+               ctf_integer(int, pid, pid)
+       )
 )
+#endif
 
 /*
  * Tracepoint for quiescent-state-reporting events.  These are
@@ -169,7 +252,48 @@ TRACE_EVENT(rcu_unlock_preempted_task,
  * whether there are any blocked tasks blocking the current grace period.
  * All but the type of RCU are extracted from the rcu_node structure.
  */
-TRACE_EVENT(rcu_quiescent_state_report,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0))
+LTTNG_TRACEPOINT_EVENT(rcu_quiescent_state_report,
+
+       TP_PROTO(const char *rcuname, unsigned long gp_seq,
+                unsigned long mask, unsigned long qsmask,
+                u8 level, int grplo, int grphi, int gp_tasks),
+
+       TP_ARGS(rcuname, gp_seq, mask, qsmask, level, grplo, grphi, gp_tasks),
+
+       TP_FIELDS(
+               ctf_string(rcuname, rcuname)
+               ctf_integer(unsigned long, gp_seq, gp_seq)
+               ctf_integer(unsigned long, mask, mask)
+               ctf_integer(unsigned long, qsmask, qsmask)
+               ctf_integer(u8, level, level)
+               ctf_integer(int, grplo, grplo)
+               ctf_integer(int, grphi, grphi)
+               ctf_integer(u8, gp_tasks, gp_tasks)
+       )
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
+LTTNG_TRACEPOINT_EVENT(rcu_quiescent_state_report,
+
+       TP_PROTO(const char *rcuname, unsigned long gpnum,
+                unsigned long mask, unsigned long qsmask,
+                u8 level, int grplo, int grphi, int gp_tasks),
+
+       TP_ARGS(rcuname, gpnum, mask, qsmask, level, grplo, grphi, gp_tasks),
+
+       TP_FIELDS(
+               ctf_string(rcuname, rcuname)
+               ctf_integer(unsigned long, gpnum, gpnum)
+               ctf_integer(unsigned long, mask, mask)
+               ctf_integer(unsigned long, qsmask, qsmask)
+               ctf_integer(u8, level, level)
+               ctf_integer(int, grplo, grplo)
+               ctf_integer(int, grphi, grphi)
+               ctf_integer(u8, gp_tasks, gp_tasks)
+       )
+)
+#else
+LTTNG_TRACEPOINT_EVENT(rcu_quiescent_state_report,
 
        TP_PROTO(char *rcuname, unsigned long gpnum,
                 unsigned long mask, unsigned long qsmask,
@@ -177,33 +301,18 @@ TRACE_EVENT(rcu_quiescent_state_report,
 
        TP_ARGS(rcuname, gpnum, mask, qsmask, level, grplo, grphi, gp_tasks),
 
-       TP_STRUCT__entry(
-               __string(rcuname, rcuname)
-               __field(unsigned long, gpnum)
-               __field(unsigned long, mask)
-               __field(unsigned long, qsmask)
-               __field(u8, level)
-               __field(int, grplo)
-               __field(int, grphi)
-               __field(u8, gp_tasks)
-       ),
-
-       TP_fast_assign(
-               tp_strcpy(rcuname, rcuname)
-               tp_assign(gpnum, gpnum)
-               tp_assign(mask, mask)
-               tp_assign(qsmask, qsmask)
-               tp_assign(level, level)
-               tp_assign(grplo, grplo)
-               tp_assign(grphi, grphi)
-               tp_assign(gp_tasks, gp_tasks)
-       ),
-
-       TP_printk("%s %lu %lx>%lx %u %d %d %u",
-                 __get_str(rcuname), __entry->gpnum,
-                 __entry->mask, __entry->qsmask, __entry->level,
-                 __entry->grplo, __entry->grphi, __entry->gp_tasks)
+       TP_FIELDS(
+               ctf_string(rcuname, rcuname)
+               ctf_integer(unsigned long, gpnum, gpnum)
+               ctf_integer(unsigned long, mask, mask)
+               ctf_integer(unsigned long, qsmask, qsmask)
+               ctf_integer(u8, level, level)
+               ctf_integer(int, grplo, grplo)
+               ctf_integer(int, grphi, grphi)
+               ctf_integer(u8, gp_tasks, gp_tasks)
+       )
 )
+#endif
 
 /*
  * Tracepoint for quiescent states detected by force_quiescent_state().
@@ -213,32 +322,56 @@ TRACE_EVENT(rcu_quiescent_state_report,
  * or "kick" when kicking a CPU that has been in dyntick-idle mode for
  * too long.
  */
-TRACE_EVENT(rcu_fqs,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0))
+LTTNG_TRACEPOINT_EVENT(rcu_fqs,
 
-       TP_PROTO(char *rcuname, unsigned long gpnum, int cpu, char *qsevent),
+       TP_PROTO(const char *rcuname, unsigned long gp_seq, int cpu, const char *qsevent),
+
+       TP_ARGS(rcuname, gp_seq, cpu, qsevent),
+
+       TP_FIELDS(
+               ctf_integer(unsigned long, gp_seq, gp_seq)
+               ctf_integer(int, cpu, cpu)
+               ctf_string(rcuname, rcuname)
+               ctf_string(qsevent, qsevent)
+       )
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
+LTTNG_TRACEPOINT_EVENT(rcu_fqs,
+
+       TP_PROTO(const char *rcuname, unsigned long gpnum, int cpu, const char *qsevent),
 
        TP_ARGS(rcuname, gpnum, cpu, qsevent),
 
-       TP_STRUCT__entry(
-               __string(rcuname, rcuname)
-               __field(unsigned long, gpnum)
-               __field(int, cpu)
-               __string(qsevent, qsevent)
-       ),
+       TP_FIELDS(
+               ctf_integer(unsigned long, gpnum, gpnum)
+               ctf_integer(int, cpu, cpu)
+               ctf_string(rcuname, rcuname)
+               ctf_string(qsevent, qsevent)
+       )
+)
+#else
+LTTNG_TRACEPOINT_EVENT(rcu_fqs,
+
+       TP_PROTO(char *rcuname, unsigned long gpnum, int cpu, char *qsevent),
 
-       TP_fast_assign(
-               tp_strcpy(rcuname, rcuname)
-               tp_assign(gpnum, gpnum)
-               tp_assign(cpu, cpu)
-               tp_strcpy(qsevent, qsevent)
-       ),
+       TP_ARGS(rcuname, gpnum, cpu, qsevent),
 
-       TP_printk("%s %lu %d %s",
-                 __get_str(rcuname), __entry->gpnum,
-                 __entry->cpu, __get_str(qsevent))
+       TP_FIELDS(
+               ctf_integer(unsigned long, gpnum, gpnum)
+               ctf_integer(int, cpu, cpu)
+               ctf_string(rcuname, rcuname)
+               ctf_string(qsevent, qsevent)
+       )
 )
+#endif
 
-#endif /* #if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) */
+#endif /*
+        * #if defined(CONFIG_TREE_RCU)
+        *      || (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0)
+        *              && defined(CONFIG_PREEMPT_RCU))
+        *      || defined(CONFIG_TREE_PREEMPT_RCU)
+        */
 
 /*
  * Tracepoint for dyntick-idle entry/exit events.  These take a string
@@ -253,41 +386,75 @@ TRACE_EVENT(rcu_fqs,
  * events use the upper bits of each number, while interrupt-related
  * events use the lower bits.
  */
-TRACE_EVENT(rcu_dyntick,
+#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),
+
+       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, atomic_read(&dynticks))
+       )
+)
+
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
+LTTNG_TRACEPOINT_EVENT(rcu_dyntick,
+
+       TP_PROTO(const char *polarity, long long oldnesting, long long newnesting),
+
+       TP_ARGS(polarity, oldnesting, newnesting),
+
+       TP_FIELDS(
+               ctf_string(polarity, polarity)
+               ctf_integer(long long, oldnesting, oldnesting)
+               ctf_integer(long long, newnesting, newnesting)
+       )
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
+LTTNG_TRACEPOINT_EVENT(rcu_dyntick,
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
        TP_PROTO(char *polarity, long long oldnesting, long long newnesting),
 
        TP_ARGS(polarity, oldnesting, newnesting),
+
+       TP_FIELDS(
+               ctf_string(polarity, polarity)
+               ctf_integer(long long, oldnesting, oldnesting)
+               ctf_integer(long long, newnesting, newnesting)
+       )
+)
 #else
+LTTNG_TRACEPOINT_EVENT(rcu_dyntick,
+
        TP_PROTO(char *polarity),
 
        TP_ARGS(polarity),
-#endif
 
-       TP_STRUCT__entry(
-               __string(polarity, polarity)
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
-               __field(long long, oldnesting)
-               __field(long long, newnesting)
+       TP_FIELDS(
+               ctf_string(polarity, polarity)
+       )
+)
 #endif
-       ),
 
-       TP_fast_assign(
-               tp_strcpy(polarity, polarity)
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
-               tp_assign(oldnesting, oldnesting)
-               tp_assign(newnesting, newnesting)
-#endif
-       ),
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
-       TP_printk("%s %llx %llx", __get_str(polarity),
-                 __entry->oldnesting, __entry->newnesting)
-#else
-       TP_printk("%s", __get_str(polarity))
-#endif
-)
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
 /*
@@ -312,21 +479,19 @@ TRACE_EVENT(rcu_dyntick,
  *     "Demigrate": Timer fired on wrong CPU, woke up correct CPU.
  *     "Cleanup after idle": Idle exited, timer canceled.
  */
-TRACE_EVENT(rcu_prep_idle,
+LTTNG_TRACEPOINT_EVENT(rcu_prep_idle,
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
+       TP_PROTO(const char *reason),
+#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
        TP_PROTO(char *reason),
+#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
 
        TP_ARGS(reason),
 
-       TP_STRUCT__entry(
-               __string(reason, reason)
-       ),
-
-       TP_fast_assign(
-               tp_strcpy(reason, reason)
-       ),
-
-       TP_printk("%s", __get_str(reason))
+       TP_FIELDS(
+               ctf_string(reason, reason)
+       )
 )
 #endif
 
@@ -337,9 +502,14 @@ TRACE_EVENT(rcu_prep_idle,
  * number of lazy callbacks queued, and the fourth element is the
  * total number of callbacks queued.
  */
-TRACE_EVENT(rcu_callback,
+LTTNG_TRACEPOINT_EVENT(rcu_callback,
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
+       TP_PROTO(const char *rcuname, struct rcu_head *rhp, long qlen_lazy,
+                long qlen),
+
+       TP_ARGS(rcuname, rhp, qlen_lazy, qlen),
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
        TP_PROTO(char *rcuname, struct rcu_head *rhp, long qlen_lazy,
                 long qlen),
 
@@ -350,35 +520,15 @@ TRACE_EVENT(rcu_callback,
        TP_ARGS(rcuname, rhp, qlen),
 #endif
 
-       TP_STRUCT__entry(
-               __string(rcuname, rcuname)
-               __field(void *, rhp)
-               __field(void *, func)
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
-               __field(long, qlen_lazy)
-#endif
-               __field(long, qlen)
-       ),
-
-       TP_fast_assign(
-               tp_strcpy(rcuname, rcuname)
-               tp_assign(rhp, rhp)
-               tp_assign(func, rhp->func)
+       TP_FIELDS(
+               ctf_string(rcuname, rcuname)
+               ctf_integer_hex(void *, rhp, rhp)
+               ctf_integer_hex(void *, func, rhp->func)
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
-               tp_assign(qlen_lazy, qlen_lazy)
-#endif
-               tp_assign(qlen, qlen)
-       ),
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
-       TP_printk("%s rhp=%p func=%pf %ld/%ld",
-                 __get_str(rcuname), __entry->rhp, __entry->func,
-                 __entry->qlen_lazy, __entry->qlen)
-#else
-       TP_printk("%s rhp=%p func=%pf %ld",
-                 __get_str(rcuname), __entry->rhp, __entry->func,
-                 __entry->qlen)
+               ctf_integer(long, qlen_lazy, qlen_lazy)
 #endif
+               ctf_integer(long, qlen, qlen)
+       )
 )
 
 /*
@@ -389,9 +539,15 @@ TRACE_EVENT(rcu_callback,
  * the fourth argument is the number of lazy callbacks queued, and the
  * fifth argument is the total number of callbacks queued.
  */
-TRACE_EVENT(rcu_kfree_callback,
+LTTNG_TRACEPOINT_EVENT(rcu_kfree_callback,
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
+       TP_PROTO(const char *rcuname, struct rcu_head *rhp, unsigned long offset,
+                long qlen_lazy, long qlen),
+
+       TP_ARGS(rcuname, rhp, offset, qlen_lazy, qlen),
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
        TP_PROTO(char *rcuname, struct rcu_head *rhp, unsigned long offset,
                 long qlen_lazy, long qlen),
 
@@ -403,35 +559,15 @@ TRACE_EVENT(rcu_kfree_callback,
        TP_ARGS(rcuname, rhp, offset, qlen),
 #endif
 
-       TP_STRUCT__entry(
-               __string(rcuname, rcuname)
-               __field(void *, rhp)
-               __field(unsigned long, offset)
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
-               __field(long, qlen_lazy)
-#endif
-               __field(long, qlen)
-       ),
-
-       TP_fast_assign(
-               tp_strcpy(rcuname, rcuname)
-               tp_assign(rhp, rhp)
-               tp_assign(offset, offset)
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
-               tp_assign(qlen_lazy, qlen_lazy)
-#endif
-               tp_assign(qlen, qlen)
-       ),
-
+       TP_FIELDS(
+               ctf_string(rcuname, rcuname)
+               ctf_integer_hex(void *, rhp, rhp)
+               ctf_integer_hex(unsigned long, offset, offset)
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
-       TP_printk("%s rhp=%p func=%ld %ld/%ld",
-                 __get_str(rcuname), __entry->rhp, __entry->offset,
-                 __entry->qlen_lazy, __entry->qlen)
-#else
-       TP_printk("%s rhp=%p func=%ld %ld",
-                 __get_str(rcuname), __entry->rhp, __entry->offset,
-                 __entry->qlen)
+               ctf_integer(long, qlen_lazy, qlen_lazy)
 #endif
+               ctf_integer(long, qlen, qlen)
+       )
 )
 
 /*
@@ -441,9 +577,17 @@ TRACE_EVENT(rcu_kfree_callback,
  * the total number of callbacks queued, and the fourth argument is
  * the current RCU-callback batch limit.
  */
-TRACE_EVENT(rcu_batch_start,
+LTTNG_TRACEPOINT_EVENT(rcu_batch_start,
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
+       TP_PROTO(const char *rcuname, long qlen_lazy, long qlen, long blimit),
+
+       TP_ARGS(rcuname, qlen_lazy, qlen, blimit),
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
+       TP_PROTO(char *rcuname, long qlen_lazy, long qlen, long blimit),
+
+       TP_ARGS(rcuname, qlen_lazy, qlen, blimit),
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
        TP_PROTO(char *rcuname, long qlen_lazy, long qlen, int blimit),
 
        TP_ARGS(rcuname, qlen_lazy, qlen, blimit),
@@ -453,32 +597,18 @@ TRACE_EVENT(rcu_batch_start,
        TP_ARGS(rcuname, qlen, blimit),
 #endif
 
-       TP_STRUCT__entry(
-               __string(rcuname, rcuname)
+       TP_FIELDS(
+               ctf_string(rcuname, rcuname)
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
-               __field(long, qlen_lazy)
+               ctf_integer(long, qlen_lazy, qlen_lazy)
 #endif
-               __field(long, qlen)
-               __field(int, blimit)
-       ),
-
-       TP_fast_assign(
-               tp_strcpy(rcuname, rcuname)
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
-               tp_assign(qlen_lazy, qlen_lazy)
-#endif
-               tp_assign(qlen, qlen)
-               tp_assign(blimit, blimit)
-       ),
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
-       TP_printk("%s CBs=%ld/%ld bl=%d",
-                 __get_str(rcuname), __entry->qlen_lazy, __entry->qlen,
-                 __entry->blimit)
+               ctf_integer(long, qlen, qlen)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
+               ctf_integer(long, blimit, blimit)
 #else
-       TP_printk("%s CBs=%ld bl=%d",
-                 __get_str(rcuname), __entry->qlen, __entry->blimit)
+               ctf_integer(int, blimit, blimit)
 #endif
+       )
 )
 
 /*
@@ -486,26 +616,21 @@ TRACE_EVENT(rcu_batch_start,
  * The first argument is the type of RCU, and the second argument is
  * a pointer to the RCU callback itself.
  */
-TRACE_EVENT(rcu_invoke_callback,
+LTTNG_TRACEPOINT_EVENT(rcu_invoke_callback,
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
+       TP_PROTO(const char *rcuname, struct rcu_head *rhp),
+#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
        TP_PROTO(char *rcuname, struct rcu_head *rhp),
+#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
 
        TP_ARGS(rcuname, rhp),
 
-       TP_STRUCT__entry(
-               __string(rcuname, rcuname)
-               __field(void *, rhp)
-               __field(void *, func)
-       ),
-
-       TP_fast_assign(
-               tp_strcpy(rcuname, rcuname)
-               tp_assign(rhp, rhp)
-               tp_assign(func, rhp->func)
-       ),
-
-       TP_printk("%s rhp=%p func=%pf",
-                 __get_str(rcuname), __entry->rhp, __entry->func)
+       TP_FIELDS(
+               ctf_string(rcuname, rcuname)
+               ctf_integer_hex(void *, rhp, rhp)
+               ctf_integer_hex(void *, func, rhp->func)
+       )
 )
 
 /*
@@ -515,26 +640,21 @@ TRACE_EVENT(rcu_invoke_callback,
  * is the offset of the callback within the enclosing RCU-protected
  * data structure.
  */
-TRACE_EVENT(rcu_invoke_kfree_callback,
+LTTNG_TRACEPOINT_EVENT(rcu_invoke_kfree_callback,
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
+       TP_PROTO(const char *rcuname, struct rcu_head *rhp, unsigned long offset),
+#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
        TP_PROTO(char *rcuname, struct rcu_head *rhp, unsigned long offset),
+#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
 
        TP_ARGS(rcuname, rhp, offset),
 
-       TP_STRUCT__entry(
-               __string(rcuname, rcuname)
-               __field(void *, rhp)
-               __field(unsigned long, offset)
-       ),
-
-       TP_fast_assign(
-               tp_strcpy(rcuname, rcuname)
-               tp_assign(rhp, rhp)
-               tp_assign(offset, offset)
-       ),
-
-       TP_printk("%s rhp=%p func=%ld",
-                 __get_str(rcuname), __entry->rhp, __entry->offset)
+       TP_FIELDS(
+               ctf_string(rcuname, rcuname)
+               ctf_integer_hex(void *, rhp, rhp)
+               ctf_integer(unsigned long, offset, offset)
+       )
 )
 
 /*
@@ -548,9 +668,19 @@ TRACE_EVENT(rcu_invoke_kfree_callback,
  * and the sixth argument (risk) is the return value from
  * rcu_is_callbacks_kthread().
  */
-TRACE_EVENT(rcu_batch_end,
+LTTNG_TRACEPOINT_EVENT(rcu_batch_end,
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0))
+       TP_PROTO(const char *rcuname, int callbacks_invoked,
+                char cb, char nr, char iit, char risk),
+
+       TP_ARGS(rcuname, callbacks_invoked, cb, nr, iit, risk),
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
+       TP_PROTO(const char *rcuname, int callbacks_invoked,
+                bool cb, bool nr, bool iit, bool risk),
+
+       TP_ARGS(rcuname, callbacks_invoked, cb, nr, iit, risk),
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
        TP_PROTO(char *rcuname, int callbacks_invoked,
                 bool cb, bool nr, bool iit, bool risk),
 
@@ -561,39 +691,21 @@ TRACE_EVENT(rcu_batch_end,
        TP_ARGS(rcuname, callbacks_invoked),
 #endif
 
-       TP_STRUCT__entry(
-               __string(rcuname, rcuname)
-               __field(int, callbacks_invoked)
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
-               __field(bool, cb)
-               __field(bool, nr)
-               __field(bool, iit)
-               __field(bool, risk)
-#endif
-       ),
-
-       TP_fast_assign(
-               tp_strcpy(rcuname, rcuname)
-               tp_assign(callbacks_invoked, callbacks_invoked)
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
-               tp_assign(cb, cb)
-               tp_assign(nr, nr)
-               tp_assign(iit, iit)
-               tp_assign(risk, risk)
-#endif
-       ),
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
-       TP_printk("%s CBs-invoked=%d idle=%c%c%c%c",
-                 __get_str(rcuname), __entry->callbacks_invoked,
-                 __entry->cb ? 'C' : '.',
-                 __entry->nr ? 'S' : '.',
-                 __entry->iit ? 'I' : '.',
-                 __entry->risk ? 'R' : '.')
-#else
-       TP_printk("%s CBs-invoked=%d",
-                 __get_str(rcuname), __entry->callbacks_invoked)
+       TP_FIELDS(
+               ctf_string(rcuname, rcuname)
+               ctf_integer(int, callbacks_invoked, callbacks_invoked)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0))
+               ctf_integer(char, cb, cb)
+               ctf_integer(char, nr, nr)
+               ctf_integer(char, iit, iit)
+               ctf_integer(char, risk, risk)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
+               ctf_integer(bool, cb, cb)
+               ctf_integer(bool, nr, nr)
+               ctf_integer(bool, iit, iit)
+               ctf_integer(bool, risk, risk)
 #endif
+       )
 )
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
@@ -602,9 +714,14 @@ TRACE_EVENT(rcu_batch_end,
  * of the RCU flavor from rcutorture's viewpoint and the second argument
  * is the callback address.
  */
-TRACE_EVENT(rcu_torture_read,
+LTTNG_TRACEPOINT_EVENT(rcu_torture_read,
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
+       TP_PROTO(const char *rcutorturename, struct rcu_head *rhp,
+                unsigned long secs, unsigned long c_old, unsigned long c),
+
+       TP_ARGS(rcutorturename, rhp, secs, c_old, c),
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
        TP_PROTO(char *rcutorturename, struct rcu_head *rhp,
                 unsigned long secs, unsigned long c_old, unsigned long c),
 
@@ -615,34 +732,15 @@ TRACE_EVENT(rcu_torture_read,
        TP_ARGS(rcutorturename, rhp),
 #endif
 
-       TP_STRUCT__entry(
-               __string(rcutorturename, rcutorturename)
-               __field(struct rcu_head *, rhp)
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
-               __field(unsigned long, secs)
-               __field(unsigned long, c_old)
-               __field(unsigned long, c)
-#endif
-       ),
-
-       TP_fast_assign(
-               tp_strcpy(rcutorturename, rcutorturename)
-               tp_assign(rhp, rhp)
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
-               tp_assign(secs, secs)
-               tp_assign(c_old, c_old)
-               tp_assign(c, c)
-#endif
-       ),
-
+       TP_FIELDS(
+               ctf_string(rcutorturename, rcutorturename)
+               ctf_integer_hex(struct rcu_head *, rhp, rhp)
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
-       TP_printk("%s torture read %p %luus c: %lu %lu",
-                 __entry->rcutorturename, __entry->rhp,
-                 __entry->secs, __entry->c_old, __entry->c)
-#else
-       TP_printk("%s torture read %p",
-                 __get_str(rcutorturename), __entry->rhp)
+               ctf_integer(unsigned long, secs, secs)
+               ctf_integer(unsigned long, c_old, c_old)
+               ctf_integer(unsigned long, c, c)
 #endif
+       )
 )
 #endif
 
@@ -664,36 +762,39 @@ TRACE_EVENT(rcu_torture_read,
  * The "cpu" argument is the CPU or -1 if meaningless, the "cnt" argument
  * is the count of remaining callbacks, and "done" is the piggybacking count.
  */
-TRACE_EVENT(rcu_barrier,
+LTTNG_TRACEPOINT_EVENT(rcu_barrier,
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
+       TP_PROTO(const char *rcuname, const char *s, int cpu, int cnt, unsigned long done),
+#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
        TP_PROTO(char *rcuname, char *s, int cpu, int cnt, unsigned long done),
+#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
 
        TP_ARGS(rcuname, s, cpu, cnt, done),
 
-       TP_STRUCT__entry(
-               __string(rcuname, rcuname)
-               __string(s, s)
-               __field(int, cpu)
-               __field(int, cnt)
-               __field(unsigned long, done)
-       ),
-
-       TP_fast_assign(
-               tp_strcpy(rcuname, rcuname)
-               tp_strcpy(s, s)
-               tp_assign(cpu, cpu)
-               tp_assign(cnt, cnt)
-               tp_assign(done, done)
-       ),
-
-       TP_printk("%s %s cpu %d remaining %d # %lu",
-                 __get_str(rcuname), __get_str(s), __entry->cpu, __entry->cnt,
-                 __entry->done)
+       TP_FIELDS(
+               ctf_string(rcuname, rcuname)
+               ctf_string(s, s)
+               ctf_integer(int, cpu, cpu)
+               ctf_integer(int, cnt, cnt)
+               ctf_integer(unsigned long, done, done)
+       )
 )
 #endif
 
 #else /* #ifdef CONFIG_RCU_TRACE */
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0))
+#define trace_rcu_grace_period(rcuname, gp_seq, gpevent) do { } while (0)
+#define trace_rcu_grace_period_init(rcuname, gp_seq, level, grplo, grphi, \
+                                   qsmask) do { } while (0)
+#define trace_rcu_preempt_task(rcuname, pid, gp_seq) do { } while (0)
+#define trace_rcu_unlock_preempted_task(rcuname, gp_seq, pid) do { } while (0)
+#define trace_rcu_quiescent_state_report(rcuname, gp_seq, mask, qsmask, level, \
+                                        grplo, grphi, gp_tasks) do { } \
+       while (0)
+#define trace_rcu_fqs(rcuname, gp_seq, cpu, qsevent) do { } while (0)
+#else
 #define trace_rcu_grace_period(rcuname, gpnum, gpevent) do { } while (0)
 #define trace_rcu_grace_period_init(rcuname, gpnum, level, grplo, grphi, \
                                    qsmask) do { } while (0)
@@ -703,7 +804,11 @@ TRACE_EVENT(rcu_barrier,
                                         grplo, grphi, gp_tasks) do { } \
        while (0)
 #define trace_rcu_fqs(rcuname, gpnum, cpu, qsevent) do { } while (0)
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
+#endif
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,16,0))
+#define trace_rcu_dyntick(polarity, oldnesting, newnesting, dyntick) do { } while (0)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
 #define trace_rcu_dyntick(polarity, oldnesting, newnesting) do { } while (0)
 #else
 #define trace_rcu_dyntick(polarity) do { } while (0)
@@ -741,7 +846,7 @@ TRACE_EVENT(rcu_barrier,
 #endif
 #endif /* #else #ifdef CONFIG_RCU_TRACE */
 
-#endif /* _TRACE_RCU_H */
+#endif /* LTTNG_TRACE_RCU_H */
 
 /* This part must be outside protection */
-#include "../../../probes/define_trace.h"
+#include <probes/define_trace.h>
This page took 0.034598 seconds and 4 git commands to generate.