Skip to content

Commit 894d45b

Browse files
Mike Galbraithpaulmck
authored andcommitted
rcu: Convert rcu_state.ofl_lock to raw_spinlock_t
1e64b15 ("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: Mike Galbraith <efault@gmx.de> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
1 parent 8d8a9d0 commit 894d45b

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

‎kernel/rcu/tree.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ struct rcu_state rcu_state = {
9797
.abbr = RCU_ABBR,
9898
.exp_mutex = __MUTEX_INITIALIZER(rcu_state.exp_mutex),
9999
.exp_wake_mutex = __MUTEX_INITIALIZER(rcu_state.exp_wake_mutex),
100-
.ofl_lock = __SPIN_LOCK_UNLOCKED(rcu_state.ofl_lock),
100+
.ofl_lock = __RAW_SPIN_LOCK_UNLOCKED(rcu_state.ofl_lock),
101101
};
102102

103103
/* Dump rcu_node combining tree at boot to verify correct setup. */
@@ -1776,13 +1776,13 @@ static bool rcu_gp_init(void)
17761776
*/
17771777
rcu_state.gp_state = RCU_GP_ONOFF;
17781778
rcu_for_each_leaf_node(rnp) {
1779-
spin_lock(&rcu_state.ofl_lock);
1779+
raw_spin_lock(&rcu_state.ofl_lock);
17801780
raw_spin_lock_irq_rcu_node(rnp);
17811781
if (rnp->qsmaskinit == rnp->qsmaskinitnext &&
17821782
!rnp->wait_blkd_tasks) {
17831783
/* Nothing to do on this leaf rcu_node structure. */
17841784
raw_spin_unlock_irq_rcu_node(rnp);
1785-
spin_unlock(&rcu_state.ofl_lock);
1785+
raw_spin_unlock(&rcu_state.ofl_lock);
17861786
continue;
17871787
}
17881788

@@ -1818,7 +1818,7 @@ static bool rcu_gp_init(void)
18181818
}
18191819

18201820
raw_spin_unlock_irq_rcu_node(rnp);
1821-
spin_unlock(&rcu_state.ofl_lock);
1821+
raw_spin_unlock(&rcu_state.ofl_lock);
18221822
}
18231823
rcu_gp_slow(gp_preinit_delay); /* Races with CPU hotplug. */
18241824

@@ -3377,7 +3377,7 @@ void rcu_report_dead(unsigned int cpu)
33773377

33783378
/* Remove outgoing CPU from mask in the leaf rcu_node structure. */
33793379
mask = rdp->grpmask;
3380-
spin_lock(&rcu_state.ofl_lock);
3380+
raw_spin_lock(&rcu_state.ofl_lock);
33813381
raw_spin_lock_irqsave_rcu_node(rnp, flags); /* Enforce GP memory-order guarantee. */
33823382
rdp->rcu_ofl_gp_seq = READ_ONCE(rcu_state.gp_seq);
33833383
rdp->rcu_ofl_gp_flags = READ_ONCE(rcu_state.gp_flags);
@@ -3388,7 +3388,7 @@ void rcu_report_dead(unsigned int cpu)
33883388
}
33893389
rnp->qsmaskinitnext &= ~mask;
33903390
raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
3391-
spin_unlock(&rcu_state.ofl_lock);
3391+
raw_spin_unlock(&rcu_state.ofl_lock);
33923392

33933393
per_cpu(rcu_cpu_started, cpu) = 0;
33943394
}

‎kernel/rcu/tree.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ struct rcu_state {
343343
const char *name; /* Name of structure. */
344344
char abbr; /* Abbreviated name. */
345345

346-
spinlock_t ofl_lock ____cacheline_internodealigned_in_smp;
346+
raw_spinlock_t ofl_lock ____cacheline_internodealigned_in_smp;
347347
/* Synchronize offline with */
348348
/* GP pre-initialization. */
349349
};

0 commit comments

Comments
 (0)