rcu: Semicolon inside RCU_TRACE() for Tiny RCU
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Mon, 23 Jan 2017 20:02:09 +0000 (12:02 -0800)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 18 Apr 2017 18:38:17 +0000 (11:38 -0700)
The current use of "RCU_TRACE(statement);" can cause odd bugs, especially
where "statement" is a local-variable declaration, as it can leave a
misplaced ";" in the source code.  This commit therefore converts these
to "RCU_TRACE(statement;)", which avoids the misplaced ";".

Reported-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
kernel/rcu/tiny.c
kernel/rcu/tiny_plugin.h

index 6ad330dbbae2ec3fa4f74fdc1cc1a2ff1154bc9d..e5385731e39109d9a27a47d123ac44908402fcce 100644 (file)
@@ -79,7 +79,7 @@ EXPORT_SYMBOL(__rcu_is_watching);
  */
 static int rcu_qsctr_help(struct rcu_ctrlblk *rcp)
 {
-       RCU_TRACE(reset_cpu_stall_ticks(rcp));
+       RCU_TRACE(reset_cpu_stall_ticks(rcp);)
        if (rcp->donetail != rcp->curtail) {
                rcp->donetail = rcp->curtail;
                return 1;
@@ -125,7 +125,7 @@ void rcu_bh_qs(void)
  */
 void rcu_check_callbacks(int user)
 {
-       RCU_TRACE(check_cpu_stalls());
+       RCU_TRACE(check_cpu_stalls();)
        if (user)
                rcu_sched_qs();
        else if (!in_softirq())
@@ -143,7 +143,7 @@ static void __rcu_process_callbacks(struct rcu_ctrlblk *rcp)
        const char *rn = NULL;
        struct rcu_head *next, *list;
        unsigned long flags;
-       RCU_TRACE(int cb_count = 0);
+       RCU_TRACE(int cb_count = 0;)
 
        /* Move the ready-to-invoke callbacks to a local list. */
        local_irq_save(flags);
@@ -152,7 +152,7 @@ static void __rcu_process_callbacks(struct rcu_ctrlblk *rcp)
                local_irq_restore(flags);
                return;
        }
-       RCU_TRACE(trace_rcu_batch_start(rcp->name, 0, rcp->qlen, -1));
+       RCU_TRACE(trace_rcu_batch_start(rcp->name, 0, rcp->qlen, -1);)
        list = rcp->rcucblist;
        rcp->rcucblist = *rcp->donetail;
        *rcp->donetail = NULL;
@@ -162,7 +162,7 @@ static void __rcu_process_callbacks(struct rcu_ctrlblk *rcp)
        local_irq_restore(flags);
 
        /* Invoke the callbacks on the local list. */
-       RCU_TRACE(rn = rcp->name);
+       RCU_TRACE(rn = rcp->name;)
        while (list) {
                next = list->next;
                prefetch(next);
@@ -171,9 +171,9 @@ static void __rcu_process_callbacks(struct rcu_ctrlblk *rcp)
                __rcu_reclaim(rn, list);
                local_bh_enable();
                list = next;
-               RCU_TRACE(cb_count++);
+               RCU_TRACE(cb_count++;)
        }
-       RCU_TRACE(rcu_trace_sub_qlen(rcp, cb_count));
+       RCU_TRACE(rcu_trace_sub_qlen(rcp, cb_count);)
        RCU_TRACE(trace_rcu_batch_end(rcp->name,
                                      cb_count, 0, need_resched(),
                                      is_idle_task(current),
@@ -221,7 +221,7 @@ static void __call_rcu(struct rcu_head *head,
        local_irq_save(flags);
        *rcp->curtail = head;
        rcp->curtail = &head->next;
-       RCU_TRACE(rcp->qlen++);
+       RCU_TRACE(rcp->qlen++;)
        local_irq_restore(flags);
 
        if (unlikely(is_idle_task(current))) {
@@ -254,8 +254,8 @@ EXPORT_SYMBOL_GPL(call_rcu_bh);
 void __init rcu_init(void)
 {
        open_softirq(RCU_SOFTIRQ, rcu_process_callbacks);
-       RCU_TRACE(reset_cpu_stall_ticks(&rcu_sched_ctrlblk));
-       RCU_TRACE(reset_cpu_stall_ticks(&rcu_bh_ctrlblk));
+       RCU_TRACE(reset_cpu_stall_ticks(&rcu_sched_ctrlblk);)
+       RCU_TRACE(reset_cpu_stall_ticks(&rcu_bh_ctrlblk);)
 
        rcu_early_boot_tests();
 }
index c64b827ecbca19656395e873ca06da0c92a6298e..df3a60e19f074709cb7678cf77d427ba68cbcbf4 100644 (file)
@@ -162,8 +162,8 @@ static void reset_cpu_stall_ticks(struct rcu_ctrlblk *rcp)
 
 static void check_cpu_stalls(void)
 {
-       RCU_TRACE(check_cpu_stall(&rcu_bh_ctrlblk));
-       RCU_TRACE(check_cpu_stall(&rcu_sched_ctrlblk));
+       RCU_TRACE(check_cpu_stall(&rcu_bh_ctrlblk);)
+       RCU_TRACE(check_cpu_stall(&rcu_sched_ctrlblk);)
 }
 
 #endif /* #ifdef CONFIG_RCU_TRACE */