rcu: Avoid ->dynticks_nesting store tearing
Although ->dynticks_nesting is updated only by process level, it is accessed from hardirq to check for interrupt-from-idle quiescent states. Store tearing is thus possible, so this commit applies WRITE_ONCE() to ->dynticks_nesting stores. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
This commit is contained in:
parent
914955e18c
commit
2342172fd6
|
@ -778,7 +778,7 @@ static void rcu_eqs_enter_common(bool user)
|
||||||
do_nocb_deferred_wakeup(rdp);
|
do_nocb_deferred_wakeup(rdp);
|
||||||
}
|
}
|
||||||
rcu_prepare_for_idle();
|
rcu_prepare_for_idle();
|
||||||
rdtp->dynticks_nesting = 0;
|
WRITE_ONCE(rdtp->dynticks_nesting, 0); /* Avoid irq-access tearing. */
|
||||||
rcu_dynticks_eqs_enter();
|
rcu_dynticks_eqs_enter();
|
||||||
rcu_dynticks_task_enter();
|
rcu_dynticks_task_enter();
|
||||||
}
|
}
|
||||||
|
@ -976,7 +976,7 @@ static void rcu_eqs_exit(bool user)
|
||||||
rdtp->dynticks_nesting++;
|
rdtp->dynticks_nesting++;
|
||||||
} else {
|
} else {
|
||||||
rcu_eqs_exit_common(1, user);
|
rcu_eqs_exit_common(1, user);
|
||||||
rdtp->dynticks_nesting = 1;
|
WRITE_ONCE(rdtp->dynticks_nesting, 1);
|
||||||
WRITE_ONCE(rdtp->dynticks_nmi_nesting, DYNTICK_IRQ_NONIDLE);
|
WRITE_ONCE(rdtp->dynticks_nmi_nesting, DYNTICK_IRQ_NONIDLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3713,7 +3713,7 @@ rcu_init_percpu_data(int cpu, struct rcu_state *rsp)
|
||||||
if (rcu_segcblist_empty(&rdp->cblist) && /* No early-boot CBs? */
|
if (rcu_segcblist_empty(&rdp->cblist) && /* No early-boot CBs? */
|
||||||
!init_nocb_callback_list(rdp))
|
!init_nocb_callback_list(rdp))
|
||||||
rcu_segcblist_init(&rdp->cblist); /* Re-enable callbacks. */
|
rcu_segcblist_init(&rdp->cblist); /* Re-enable callbacks. */
|
||||||
rdp->dynticks->dynticks_nesting = 1;
|
rdp->dynticks->dynticks_nesting = 1; /* CPU not up, no tearing. */
|
||||||
rcu_dynticks_eqs_online();
|
rcu_dynticks_eqs_online();
|
||||||
raw_spin_unlock_rcu_node(rnp); /* irqs remain disabled. */
|
raw_spin_unlock_rcu_node(rnp); /* irqs remain disabled. */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue