rcu/trace: Print negative GP numbers correctly
authorJoel Fernandes (Google) <joel@joelfernandes.org>
Fri, 19 Jun 2020 01:36:39 +0000 (21:36 -0400)
committerPaul E. McKenney <paulmck@kernel.org>
Tue, 25 Aug 2020 01:36:04 +0000 (18:36 -0700)
GP numbers start from -300 and gp_seq numbers start of -1200 (for a
shift of 2). These negative numbers are printed as unsigned long which
not only takes up more text space, but is rather confusing to the reader
as they have to constantly expend energy to truncate the number. Just
print the negative numbering directly.

Cc: Uladzislau Rezki (Sony) <urezki@gmail.com>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
include/trace/events/rcu.h

index ced71237b7e4ad40c2c9914dfabe5d5bdb512cf3..155b5cb43cfd39e95cf9e0802cf06a734fb41d6f 100644 (file)
@@ -74,17 +74,17 @@ TRACE_EVENT_RCU(rcu_grace_period,
 
        TP_STRUCT__entry(
                __field(const char *, rcuname)
-               __field(unsigned long, gp_seq)
+               __field(long, gp_seq)
                __field(const char *, gpevent)
        ),
 
        TP_fast_assign(
                __entry->rcuname = rcuname;
-               __entry->gp_seq = gp_seq;
+               __entry->gp_seq = (long)gp_seq;
                __entry->gpevent = gpevent;
        ),
 
-       TP_printk("%s %lu %s",
+       TP_printk("%s %ld %s",
                  __entry->rcuname, __entry->gp_seq, __entry->gpevent)
 );
 
@@ -114,8 +114,8 @@ TRACE_EVENT_RCU(rcu_future_grace_period,
 
        TP_STRUCT__entry(
                __field(const char *, rcuname)
-               __field(unsigned long, gp_seq)
-               __field(unsigned long, gp_seq_req)
+               __field(long, gp_seq)
+               __field(long, gp_seq_req)
                __field(u8, level)
                __field(int, grplo)
                __field(int, grphi)
@@ -124,16 +124,16 @@ TRACE_EVENT_RCU(rcu_future_grace_period,
 
        TP_fast_assign(
                __entry->rcuname = rcuname;
-               __entry->gp_seq = gp_seq;
-               __entry->gp_seq_req = gp_seq_req;
+               __entry->gp_seq = (long)gp_seq;
+               __entry->gp_seq_req = (long)gp_seq_req;
                __entry->level = level;
                __entry->grplo = grplo;
                __entry->grphi = grphi;
                __entry->gpevent = gpevent;
        ),
 
-       TP_printk("%s %lu %lu %u %d %d %s",
-                 __entry->rcuname, __entry->gp_seq, __entry->gp_seq_req, __entry->level,
+       TP_printk("%s %ld %ld %u %d %d %s",
+                 __entry->rcuname, (long)__entry->gp_seq, (long)__entry->gp_seq_req, __entry->level,
                  __entry->grplo, __entry->grphi, __entry->gpevent)
 );
 
@@ -153,7 +153,7 @@ TRACE_EVENT_RCU(rcu_grace_period_init,
 
        TP_STRUCT__entry(
                __field(const char *, rcuname)
-               __field(unsigned long, gp_seq)
+               __field(long, gp_seq)
                __field(u8, level)
                __field(int, grplo)
                __field(int, grphi)
@@ -162,14 +162,14 @@ TRACE_EVENT_RCU(rcu_grace_period_init,
 
        TP_fast_assign(
                __entry->rcuname = rcuname;
-               __entry->gp_seq = gp_seq;
+               __entry->gp_seq = (long)gp_seq;
                __entry->level = level;
                __entry->grplo = grplo;
                __entry->grphi = grphi;
                __entry->qsmask = qsmask;
        ),
 
-       TP_printk("%s %lu %u %d %d %lx",
+       TP_printk("%s %ld %u %d %d %lx",
                  __entry->rcuname, __entry->gp_seq, __entry->level,
                  __entry->grplo, __entry->grphi, __entry->qsmask)
 );
@@ -197,17 +197,17 @@ TRACE_EVENT_RCU(rcu_exp_grace_period,
 
        TP_STRUCT__entry(
                __field(const char *, rcuname)
-               __field(unsigned long, gpseq)
+               __field(long, gpseq)
                __field(const char *, gpevent)
        ),
 
        TP_fast_assign(
                __entry->rcuname = rcuname;
-               __entry->gpseq = gpseq;
+               __entry->gpseq = (long)gpseq;
                __entry->gpevent = gpevent;
        ),
 
-       TP_printk("%s %lu %s",
+       TP_printk("%s %ld %s",
                  __entry->rcuname, __entry->gpseq, __entry->gpevent)
 );
 
@@ -316,17 +316,17 @@ TRACE_EVENT_RCU(rcu_preempt_task,
 
        TP_STRUCT__entry(
                __field(const char *, rcuname)
-               __field(unsigned long, gp_seq)
+               __field(long, gp_seq)
                __field(int, pid)
        ),
 
        TP_fast_assign(
                __entry->rcuname = rcuname;
-               __entry->gp_seq = gp_seq;
+               __entry->gp_seq = (long)gp_seq;
                __entry->pid = pid;
        ),
 
-       TP_printk("%s %lu %d",
+       TP_printk("%s %ld %d",
                  __entry->rcuname, __entry->gp_seq, __entry->pid)
 );
 
@@ -343,17 +343,17 @@ TRACE_EVENT_RCU(rcu_unlock_preempted_task,
 
        TP_STRUCT__entry(
                __field(const char *, rcuname)
-               __field(unsigned long, gp_seq)
+               __field(long, gp_seq)
                __field(int, pid)
        ),
 
        TP_fast_assign(
                __entry->rcuname = rcuname;
-               __entry->gp_seq = gp_seq;
+               __entry->gp_seq = (long)gp_seq;
                __entry->pid = pid;
        ),
 
-       TP_printk("%s %lu %d", __entry->rcuname, __entry->gp_seq, __entry->pid)
+       TP_printk("%s %ld %d", __entry->rcuname, __entry->gp_seq, __entry->pid)
 );
 
 /*
@@ -374,7 +374,7 @@ TRACE_EVENT_RCU(rcu_quiescent_state_report,
 
        TP_STRUCT__entry(
                __field(const char *, rcuname)
-               __field(unsigned long, gp_seq)
+               __field(long, gp_seq)
                __field(unsigned long, mask)
                __field(unsigned long, qsmask)
                __field(u8, level)
@@ -385,7 +385,7 @@ TRACE_EVENT_RCU(rcu_quiescent_state_report,
 
        TP_fast_assign(
                __entry->rcuname = rcuname;
-               __entry->gp_seq = gp_seq;
+               __entry->gp_seq = (long)gp_seq;
                __entry->mask = mask;
                __entry->qsmask = qsmask;
                __entry->level = level;
@@ -394,7 +394,7 @@ TRACE_EVENT_RCU(rcu_quiescent_state_report,
                __entry->gp_tasks = gp_tasks;
        ),
 
-       TP_printk("%s %lu %lx>%lx %u %d %d %u",
+       TP_printk("%s %ld %lx>%lx %u %d %d %u",
                  __entry->rcuname, __entry->gp_seq,
                  __entry->mask, __entry->qsmask, __entry->level,
                  __entry->grplo, __entry->grphi, __entry->gp_tasks)
@@ -415,19 +415,19 @@ TRACE_EVENT_RCU(rcu_fqs,
 
        TP_STRUCT__entry(
                __field(const char *, rcuname)
-               __field(unsigned long, gp_seq)
+               __field(long, gp_seq)
                __field(int, cpu)
                __field(const char *, qsevent)
        ),
 
        TP_fast_assign(
                __entry->rcuname = rcuname;
-               __entry->gp_seq = gp_seq;
+               __entry->gp_seq = (long)gp_seq;
                __entry->cpu = cpu;
                __entry->qsevent = qsevent;
        ),
 
-       TP_printk("%s %lu %d %s",
+       TP_printk("%s %ld %d %s",
                  __entry->rcuname, __entry->gp_seq,
                  __entry->cpu, __entry->qsevent)
 );