Skip to contentSkip to conversation

rcu: don't use __this_cpu_* from preemptible context

PATCH In review Sasha Levin 2 participants 2 messages Dec 28, 2014 – Dec 31, 2014 RCU

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rcu: don't use __this_cpu_* from preemptible context

Commit "rcu: Make cond_resched_rcu_qs() apply to normal RCU flavors" has added debug code which tries to read from __this_cpu in a preemptible code, which doesn't work too well.

---
 kernel/rcu/tree_trace.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tree_trace.c +1 -1
index a9b79ca..fbb6240 100644
@@ -122,7 +122,7 @@ static void print_one_rcu_data(struct seq_file *m, struct rcu_data *rdp)
 		   cpu_is_offline(rdp->cpu) ? '!' : ' ',
 		   ulong2long(rdp->completed), ulong2long(rdp->gpnum),
 		   rdp->passed_quiesce,
-		   rdp->rcu_qs_ctr_snap == __this_cpu_read(rcu_qs_ctr),
+		   rdp->rcu_qs_ctr_snap == per_cpu(rcu_qs_ctr, rdp->cpu),
 		   rdp->qs_pending);
 	seq_printf(m, " dt=%d/%llx/%d df=%lu",
 		   atomic_read(&rdp->dynticks->dynticks),
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 5 lines · Sasha Levin

Commit "rcu: Make cond_resched_rcu_qs() apply to normal RCU flavors" has added debug code which tries to read from __this_cpu in a preemptible code, which doesn't work too well.

Good catch, queued for 3.20 (same as the offending commit).

Thanx, Paul

Quoted 20 lines
---
 kernel/rcu/tree_trace.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tree_trace.c +1 -1
index a9b79ca..fbb6240 100644
@@ -122,7 +122,7 @@ static void print_one_rcu_data(struct seq_file *m, struct rcu_data *rdp)
 		   cpu_is_offline(rdp->cpu) ? '!' : ' ',
 		   ulong2long(rdp->completed), ulong2long(rdp->gpnum),
 		   rdp->passed_quiesce,
-		   rdp->rcu_qs_ctr_snap == __this_cpu_read(rcu_qs_ctr),
+		   rdp->rcu_qs_ctr_snap == per_cpu(rcu_qs_ctr, rdp->cpu),
 		   rdp->qs_pending);
 	seq_printf(m, " dt=%d/%llx/%d df=%lu",
 		   atomic_read(&rdp->dynticks->dynticks),
Signature · 1 line
1.7.10.4