From: Greg Kroah-Hartman Date: Fri, 7 Sep 2018 05:47:11 +0000 (+0200) Subject: 4.18-stable patches X-Git-Tag: v4.18.7~22 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=029781de896f22f688cec317d79c217f3ebd28f3;p=thirdparty%2Fkernel%2Fstable-queue.git 4.18-stable patches added patches: rcu-make-expedited-gps-handle-cpu-0-being-offline.patch --- diff --git a/queue-4.18/rcu-make-expedited-gps-handle-cpu-0-being-offline.patch b/queue-4.18/rcu-make-expedited-gps-handle-cpu-0-being-offline.patch new file mode 100644 index 00000000000..94f1d41b440 --- /dev/null +++ b/queue-4.18/rcu-make-expedited-gps-handle-cpu-0-being-offline.patch @@ -0,0 +1,57 @@ +From fcc63543650150629c8a873cbef3578770acecd9 Mon Sep 17 00:00:00 2001 +From: Boqun Feng +Date: Fri, 15 Jun 2018 12:06:31 -0700 +Subject: rcu: Make expedited GPs handle CPU 0 being offline + +From: Boqun Feng + +commit fcc63543650150629c8a873cbef3578770acecd9 upstream. + +Currently, the parallelized initialization of expedited grace periods uses +the workqueue associated with each rcu_node structure's ->grplo field. +This works fine unless that CPU is offline. This commit therefore uses +the CPU corresponding to the lowest-numbered online CPU, or just queues +the work on WORK_CPU_UNBOUND if there are no online CPUs corresponding +to this rcu_node structure. + +Note that this patch uses cpu_is_offline() instead of the usual approach +of checking bits in the rcu_node structure's ->qsmaskinitnext field. This +is safe because preemption is disabled across both the cpu_is_offline() +check and the call to queue_work_on(). + +Signed-off-by: Boqun Feng +[ paulmck: Disable preemption to close offline race window. ] +Signed-off-by: Paul E. McKenney +[ paulmck: Apply Peter Zijlstra feedback on CPU selection. ] +Tested-by: Aneesh Kumar K.V +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/rcu/tree_exp.h | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +--- a/kernel/rcu/tree_exp.h ++++ b/kernel/rcu/tree_exp.h +@@ -472,6 +472,7 @@ retry_ipi: + static void sync_rcu_exp_select_cpus(struct rcu_state *rsp, + smp_call_func_t func) + { ++ int cpu; + struct rcu_node *rnp; + + trace_rcu_exp_grace_period(rsp->name, rcu_exp_gp_seq_endval(rsp), TPS("reset")); +@@ -492,7 +493,13 @@ static void sync_rcu_exp_select_cpus(str + continue; + } + INIT_WORK(&rnp->rew.rew_work, sync_rcu_exp_select_node_cpus); +- queue_work_on(rnp->grplo, rcu_par_gp_wq, &rnp->rew.rew_work); ++ preempt_disable(); ++ cpu = cpumask_next(rnp->grplo - 1, cpu_online_mask); ++ /* If all offline, queue the work on an unbound CPU. */ ++ if (unlikely(cpu > rnp->grphi)) ++ cpu = WORK_CPU_UNBOUND; ++ queue_work_on(cpu, rcu_par_gp_wq, &rnp->rew.rew_work); ++ preempt_enable(); + rnp->exp_need_flush = true; + } + diff --git a/queue-4.18/series b/queue-4.18/series new file mode 100644 index 00000000000..1c7b6cb9308 --- /dev/null +++ b/queue-4.18/series @@ -0,0 +1 @@ +rcu-make-expedited-gps-handle-cpu-0-being-offline.patch diff --git a/queue-4.9/series b/queue-4.9/series new file mode 100644 index 00000000000..e69de29bb2d