Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1561253
| From | "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 tip/core/rcu 13/18] rcu: Make rcu_cpu_starting() use its "cpu" argument |
| Date | 2017-01-18 04:40 +0100 |
| Message-ID | <t0Pgl-7ga-7@gated-at.bofh.it> (permalink) |
| References | <t0ODD-6Iu-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
The rcu_cpu_starting() function uses this_cpu_ptr() to locate the
incoming CPU's rcu_data structure. This works for the boot CPU and for
all CPUs onlined after rcu_init() executes (during very early boot).
Currently, this is the full set of CPUs, so all is well. But if
anyone ever parallelizes boot before rcu_init() time, it will fail.
This commit therefore substitutes the rcu_cpu_starting() function's
this_cpu_pointer() for per_cpu_ptr(), future-proofing the code and
(arguably) improving readability.
This commit inadvertently fixes a latent bug: If there ever had been
more than just the boot CPU online at rcu_init() time, the old code
would not initialize the non-boot CPUs, but rather would repeatedly
initialize the boot CPU.
Reported-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
---
kernel/rcu/tree.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index be2301238a23..a4b4762442bb 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -3873,7 +3873,7 @@ void rcu_cpu_starting(unsigned int cpu)
struct rcu_state *rsp;
for_each_rcu_flavor(rsp) {
- rdp = this_cpu_ptr(rsp->rda);
+ rdp = per_cpu_ptr(rsp->rda, cpu);
rnp = rdp->mynode;
mask = rdp->grpmask;
raw_spin_lock_irqsave_rcu_node(rnp, flags);
--
2.5.2
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH tip/core/rcu 0/20] Miscellaneous fixes for 4.11 "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-18 04:00 +0100
[PATCH v2 tip/core/rcu 01/18] rcu: update: Make RCU_EXPEDITE_BOOT be the default "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-18 04:00 +0100
[PATCH v2 tip/core/rcu 14/18] rcu: Enable RCU tracepoints by default to aid in debugging "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-18 04:00 +0100
[PATCH v2 tip/core/rcu 08/18] rcu: Remove short-term CPU kicking "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-18 04:00 +0100
Re: [PATCH v2 tip/core/rcu 08/18] rcu: Remove short-term CPU kicking Josh Triplett <josh@joshtriplett.org> - 2017-01-21 21:50 +0100
Re: [PATCH v2 tip/core/rcu 08/18] rcu: Remove short-term CPU kicking "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-23 20:40 +0100
[PATCH v2 tip/core/rcu 11/18] rcu: Don't wake rcuc/X kthreads on NOCB CPUs "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-18 04:10 +0100
[PATCH v2 tip/core/rcu 15/18] rcu: Fix comment in rcu_organize_nocb_kthreads() "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-18 04:30 +0100
[PATCH v2 tip/core/rcu 06/18] rcu: Remove unused but set variable "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-18 04:40 +0100
[PATCH v2 tip/core/rcu 13/18] rcu: Make rcu_cpu_starting() use its "cpu" argument "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-18 04:40 +0100
[PATCH v2 tip/core/rcu 18/18] rcu: Add lockdep checks to synchronous expedited primitives "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-18 05:00 +0100
[PATCH v2 tip/core/rcu 03/18] Fix: Disable sys_membarrier when nohz_full is enabled "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-18 05:40 +0100
[PATCH v2 tip/core/rcu 12/18] rcu: Add comment headers to expedited-grace-period counter functions "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-18 05:50 +0100
[PATCH v2 tip/core/rcu 17/18] rcu: Eliminate unused expedited_normal counter "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-18 05:50 +0100
[PATCH v2 tip/core/rcu 16/18] llist: Clarify comments about when locking is needed "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-18 06:20 +0100
[PATCH v2 tip/core/rcu 02/18] lockdep: Make RCU suspicious-access splats use pr_err "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-18 06:40 +0100
Re: [PATCH v2 tip/core/rcu 02/18] lockdep: Make RCU suspicious-access splats use pr_err Josh Triplett <josh@joshtriplett.org> - 2017-01-21 21:50 +0100
Re: [PATCH v2 tip/core/rcu 02/18] lockdep: Make RCU suspicious-access splats use pr_err "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-23 20:40 +0100
Re: [PATCH v2 tip/core/rcu 02/18] lockdep: Make RCU suspicious-access splats use pr_err Josh Triplett <josh@joshtriplett.org> - 2017-01-23 23:40 +0100
Re: [PATCH v2 tip/core/rcu 02/18] lockdep: Make RCU suspicious-access splats use pr_err "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-24 01:20 +0100
[PATCH v2 tip/core/rcu 05/18] rcu: Remove unneeded rcu_process_callbacks() declarations "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-18 07:10 +0100
[PATCH v2 tip/core/rcu 07/18] rcu: Add long-term CPU kicking "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-18 07:10 +0100
Re: [PATCH v2 tip/core/rcu 07/18] rcu: Add long-term CPU kicking Josh Triplett <josh@joshtriplett.org> - 2017-01-21 21:50 +0100
Re: [PATCH v2 tip/core/rcu 07/18] rcu: Add long-term CPU kicking "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-23 20:40 +0100
Re: [PATCH v2 tip/core/rcu 07/18] rcu: Add long-term CPU kicking Josh Triplett <josh@joshtriplett.org> - 2017-01-23 21:30 +0100
Re: [PATCH v2 tip/core/rcu 07/18] rcu: Add long-term CPU kicking Josh Triplett <josh@joshtriplett.org> - 2017-01-21 21:50 +0100
[PATCH v3 tip/core/rcu 0/18] Miscellaneous fixes for 4.11 "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-24 23:00 +0100
[PATCH v3 tip/core/rcu 17/18] rcu: Eliminate unused expedited_normal counter "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-24 23:00 +0100
[PATCH v3 tip/core/rcu 04/18] rcu: Only dump stalled-tasks stacks if there was a real stall "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-24 23:00 +0100
[PATCH v3 tip/core/rcu 16/18] llist: Clarify comments about when locking is needed "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-24 23:00 +0100
[PATCH v3 tip/core/rcu 06/18] rcu: Remove unused but set variable "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-24 23:00 +0100
[PATCH v3 tip/core/rcu 05/18] rcu: Remove unneeded rcu_process_callbacks() declarations "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-24 23:00 +0100
[PATCH v3 tip/core/rcu 02/18] lockdep: Make RCU suspicious-access splats use pr_err "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-24 23:00 +0100
[PATCH v3 tip/core/rcu 12/18] rcu: Add comment headers to expedited-grace-period counter functions "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-24 23:00 +0100
[PATCH v3 tip/core/rcu 14/18] rcu: Enable RCU tracepoints by default to aid in debugging "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-24 23:00 +0100
[PATCH v3 tip/core/rcu 07/18] rcu: Add long-term CPU kicking "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-24 23:00 +0100
[PATCH v3 tip/core/rcu 18/18] rcu: Add lockdep checks to synchronous expedited primitives "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-24 23:00 +0100
[PATCH v3 tip/core/rcu 11/18] rcu: Don't wake rcuc/X kthreads on NOCB CPUs "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-24 23:00 +0100
[PATCH v3 tip/core/rcu 13/18] rcu: Make rcu_cpu_starting() use its "cpu" argument "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-24 23:00 +0100
[PATCH v3 tip/core/rcu 10/18] rcu: Re-enable TASKS_RCU for User Mode Linux "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-24 23:00 +0100
[PATCH v3 tip/core/rcu 15/18] rcu: Fix comment in rcu_organize_nocb_kthreads() "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-24 23:00 +0100
csiph-web