rcutorture: Place event-traced strings into trace buffer
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 6 Jun 2017 23:39:00 +0000 (16:39 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Mon, 24 Jul 2017 23:04:12 +0000 (16:04 -0700)
Strings used in event tracing need to be specially handled, for example,
being copied to the trace buffer instead of being pointed to by the trace
buffer.  Although the TPS() macro can be used to "launder" pointed-to
strings, this might not be all that effective within a loadable module.
This commit therefore copies rcutorture's strings to the trace buffer.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
include/trace/events/rcu.h
kernel/rcu/rcutorture.c
tools/testing/selftests/rcutorture/configs/rcu/BUSTED.boot

index 91dc089d65b7e3abfd9d22bf4ac5e4bc593237cc..e91ae1f2290de4288aa0f70336f8596a4b68f711 100644 (file)
@@ -703,6 +703,7 @@ TRACE_EVENT(rcu_batch_end,
  * at the beginning and end of the read, respectively.  Note that the
  * callback address can be NULL.
  */
+#define RCUTORTURENAME_LEN 8
 TRACE_EVENT(rcu_torture_read,
 
        TP_PROTO(const char *rcutorturename, struct rcu_head *rhp,
@@ -711,7 +712,7 @@ TRACE_EVENT(rcu_torture_read,
        TP_ARGS(rcutorturename, rhp, secs, c_old, c),
 
        TP_STRUCT__entry(
-               __field(const char *, rcutorturename)
+               __field(char, rcutorturename[RCUTORTURENAME_LEN])
                __field(struct rcu_head *, rhp)
                __field(unsigned long, secs)
                __field(unsigned long, c_old)
@@ -719,7 +720,9 @@ TRACE_EVENT(rcu_torture_read,
        ),
 
        TP_fast_assign(
-               __entry->rcutorturename = rcutorturename;
+               strncpy(__entry->rcutorturename, rcutorturename,
+                       RCUTORTURENAME_LEN);
+               __entry->rcutorturename[RCUTORTURENAME_LEN - 1] = 0;
                __entry->rhp = rhp;
                __entry->secs = secs;
                __entry->c_old = c_old;
index 8d59c82bec0b4704b749918a34d1662717c22e2a..b48d2107f1762eb20eda5b13b9dd7509ae9d94ac 100644 (file)
@@ -496,7 +496,7 @@ static struct rcu_torture_ops rcu_busted_ops = {
        .fqs            = NULL,
        .stats          = NULL,
        .irq_capable    = 1,
-       .name           = "rcu_busted"
+       .name           = "busted"
 };
 
 /*
index 6804f9dcfc1b25c6dee8fd5be1907525c861fbc2..be7728db42fd68e79279b04d22cc5b2a58f6e778 100644 (file)
@@ -1 +1 @@
-rcutorture.torture_type=rcu_busted
+rcutorture.torture_type=busted