Commit 894d45bb authored by Mike Galbraith's avatar Mike Galbraith Committed by Paul E. McKenney

rcu: Convert rcu_state.ofl_lock to raw_spinlock_t

1e64b15a ("rcu: Fix grace-period hangs due to race with CPU offline")
added spinlock_t ofl_lock to the rcu_state structure, then takes it with
preemption disabled during CPU offline, which gives the -rt patchset's
sleeping spinlock heartburn.

This commit therefore converts ->ofl_lock to raw_spinlock_t.
Signed-off-by: default avatarMike Galbraith <efault@gmx.de>
Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
parent 8d8a9d0e
...@@ -97,7 +97,7 @@ struct rcu_state rcu_state = { ...@@ -97,7 +97,7 @@ struct rcu_state rcu_state = {
.abbr = RCU_ABBR, .abbr = RCU_ABBR,
.exp_mutex = __MUTEX_INITIALIZER(rcu_state.exp_mutex), .exp_mutex = __MUTEX_INITIALIZER(rcu_state.exp_mutex),
.exp_wake_mutex = __MUTEX_INITIALIZER(rcu_state.exp_wake_mutex), .exp_wake_mutex = __MUTEX_INITIALIZER(rcu_state.exp_wake_mutex),
.ofl_lock = __SPIN_LOCK_UNLOCKED(rcu_state.ofl_lock), .ofl_lock = __RAW_SPIN_LOCK_UNLOCKED(rcu_state.ofl_lock),
}; };
/* Dump rcu_node combining tree at boot to verify correct setup. */ /* Dump rcu_node combining tree at boot to verify correct setup. */
...@@ -1776,13 +1776,13 @@ static bool rcu_gp_init(void) ...@@ -1776,13 +1776,13 @@ static bool rcu_gp_init(void)
*/ */
rcu_state.gp_state = RCU_GP_ONOFF; rcu_state.gp_state = RCU_GP_ONOFF;
rcu_for_each_leaf_node(rnp) { rcu_for_each_leaf_node(rnp) {
spin_lock(&rcu_state.ofl_lock); raw_spin_lock(&rcu_state.ofl_lock);
raw_spin_lock_irq_rcu_node(rnp); raw_spin_lock_irq_rcu_node(rnp);
if (rnp->qsmaskinit == rnp->qsmaskinitnext && if (rnp->qsmaskinit == rnp->qsmaskinitnext &&
!rnp->wait_blkd_tasks) { !rnp->wait_blkd_tasks) {
/* Nothing to do on this leaf rcu_node structure. */ /* Nothing to do on this leaf rcu_node structure. */
raw_spin_unlock_irq_rcu_node(rnp); raw_spin_unlock_irq_rcu_node(rnp);
spin_unlock(&rcu_state.ofl_lock); raw_spin_unlock(&rcu_state.ofl_lock);
continue; continue;
} }
...@@ -1818,7 +1818,7 @@ static bool rcu_gp_init(void) ...@@ -1818,7 +1818,7 @@ static bool rcu_gp_init(void)
} }
raw_spin_unlock_irq_rcu_node(rnp); raw_spin_unlock_irq_rcu_node(rnp);
spin_unlock(&rcu_state.ofl_lock); raw_spin_unlock(&rcu_state.ofl_lock);
} }
rcu_gp_slow(gp_preinit_delay); /* Races with CPU hotplug. */ rcu_gp_slow(gp_preinit_delay); /* Races with CPU hotplug. */
...@@ -3377,7 +3377,7 @@ void rcu_report_dead(unsigned int cpu) ...@@ -3377,7 +3377,7 @@ void rcu_report_dead(unsigned int cpu)
/* Remove outgoing CPU from mask in the leaf rcu_node structure. */ /* Remove outgoing CPU from mask in the leaf rcu_node structure. */
mask = rdp->grpmask; mask = rdp->grpmask;
spin_lock(&rcu_state.ofl_lock); raw_spin_lock(&rcu_state.ofl_lock);
raw_spin_lock_irqsave_rcu_node(rnp, flags); /* Enforce GP memory-order guarantee. */ raw_spin_lock_irqsave_rcu_node(rnp, flags); /* Enforce GP memory-order guarantee. */
rdp->rcu_ofl_gp_seq = READ_ONCE(rcu_state.gp_seq); rdp->rcu_ofl_gp_seq = READ_ONCE(rcu_state.gp_seq);
rdp->rcu_ofl_gp_flags = READ_ONCE(rcu_state.gp_flags); rdp->rcu_ofl_gp_flags = READ_ONCE(rcu_state.gp_flags);
...@@ -3388,7 +3388,7 @@ void rcu_report_dead(unsigned int cpu) ...@@ -3388,7 +3388,7 @@ void rcu_report_dead(unsigned int cpu)
} }
rnp->qsmaskinitnext &= ~mask; rnp->qsmaskinitnext &= ~mask;
raw_spin_unlock_irqrestore_rcu_node(rnp, flags); raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
spin_unlock(&rcu_state.ofl_lock); raw_spin_unlock(&rcu_state.ofl_lock);
per_cpu(rcu_cpu_started, cpu) = 0; per_cpu(rcu_cpu_started, cpu) = 0;
} }
......
...@@ -343,7 +343,7 @@ struct rcu_state { ...@@ -343,7 +343,7 @@ struct rcu_state {
const char *name; /* Name of structure. */ const char *name; /* Name of structure. */
char abbr; /* Abbreviated name. */ char abbr; /* Abbreviated name. */
spinlock_t ofl_lock ____cacheline_internodealigned_in_smp; raw_spinlock_t ofl_lock ____cacheline_internodealigned_in_smp;
/* Synchronize offline with */ /* Synchronize offline with */
/* GP pre-initialization. */ /* GP pre-initialization. */
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment