]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
rcu: Protect rcu_node accesses during CPU stall warnings
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Fri, 10 Aug 2012 23:55:59 +0000 (16:55 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 4 Sep 2012 23:38:48 +0000 (16:38 -0700)
The print_other_cpu_stall() function accesses a number of rcu_node
fields without protection from the ->lock.  In theory, this is not
a problem because the fields accessed are all integers, but in
practice the compiler can get nasty.  Therefore, the commit extends
the existing critical section to cover the entire loop body.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
kernel/rcutree.c

index 9f44749eb9bb84582e4f377b12c4b8f170942471..3d63d1c6e73982173b104914432b0e67e146563e 100644 (file)
@@ -746,14 +746,15 @@ static void print_other_cpu_stall(struct rcu_state *rsp)
        rcu_for_each_leaf_node(rsp, rnp) {
                raw_spin_lock_irqsave(&rnp->lock, flags);
                ndetected += rcu_print_task_stall(rnp);
+               if (rnp->qsmask != 0) {
+                       for (cpu = 0; cpu <= rnp->grphi - rnp->grplo; cpu++)
+                               if (rnp->qsmask & (1UL << cpu)) {
+                                       print_cpu_stall_info(rsp,
+                                                            rnp->grplo + cpu);
+                                       ndetected++;
+                               }
+               }
                raw_spin_unlock_irqrestore(&rnp->lock, flags);
-               if (rnp->qsmask == 0)
-                       continue;
-               for (cpu = 0; cpu <= rnp->grphi - rnp->grplo; cpu++)
-                       if (rnp->qsmask & (1UL << cpu)) {
-                               print_cpu_stall_info(rsp, rnp->grplo + cpu);
-                               ndetected++;
-                       }
        }
 
        /*