diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2020-05-22 01:16:49 +0100 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2020-05-22 01:16:49 +0100 |
commit | 4a954e94d64196de405c68365e7571c03f1097b7 (patch) | |
tree | 63f940cea25acb14034dc975b49dde1e39afc15a | |
parent | 92cd235ced0a4f144d6cbc024c594e71642424da (diff) | |
download | linux-stable-queue-4a954e94d64196de405c68365e7571c03f1097b7.tar.gz |
Add yet another padata fix
7 files changed, 57 insertions, 17 deletions
diff --git a/queue-3.16/padata-always-acquire-cpu_hotplug_lock-before-pinst-lock.patch b/queue-3.16/padata-always-acquire-cpu_hotplug_lock-before-pinst-lock.patch index 4db3abc1..e28c4c4a 100644 --- a/queue-3.16/padata-always-acquire-cpu_hotplug_lock-before-pinst-lock.patch +++ b/queue-3.16/padata-always-acquire-cpu_hotplug_lock-before-pinst-lock.patch @@ -41,7 +41,7 @@ Signed-off-by: Ben Hutchings <ben@decadent.org.uk> --- a/kernel/padata.c +++ b/kernel/padata.c -@@ -614,8 +614,8 @@ int padata_set_cpumask(struct padata_ins +@@ -620,8 +620,8 @@ int padata_set_cpumask(struct padata_ins struct cpumask *serial_mask, *parallel_mask; int err = -EINVAL; @@ -51,7 +51,7 @@ Signed-off-by: Ben Hutchings <ben@decadent.org.uk> switch (cpumask_type) { case PADATA_CPU_PARALLEL: -@@ -633,8 +633,8 @@ int padata_set_cpumask(struct padata_ins +@@ -639,8 +639,8 @@ int padata_set_cpumask(struct padata_ins err = __padata_set_cpumasks(pinst, parallel_mask, serial_mask); out: diff --git a/queue-3.16/padata-ensure-the-reorder-timer-callback-runs-on-the-correct-cpu.patch b/queue-3.16/padata-ensure-the-reorder-timer-callback-runs-on-the-correct-cpu.patch index 3e4a2653..4271536f 100644 --- a/queue-3.16/padata-ensure-the-reorder-timer-callback-runs-on-the-correct-cpu.patch +++ b/queue-3.16/padata-ensure-the-reorder-timer-callback-runs-on-the-correct-cpu.patch @@ -95,7 +95,7 @@ Signed-off-by: Ben Hutchings <ben@decadent.org.uk> } static void padata_serial_worker(struct work_struct *serial_work) -@@ -404,6 +444,7 @@ static void padata_init_pqueues(struct p +@@ -410,6 +450,7 @@ static void padata_init_pqueues(struct p __padata_list_init(&pqueue->reorder); __padata_list_init(&pqueue->parallel); INIT_WORK(&pqueue->work, padata_parallel_worker); diff --git a/queue-3.16/padata-initialize-pd-cpu-with-effective-cpumask.patch b/queue-3.16/padata-initialize-pd-cpu-with-effective-cpumask.patch index 0dec176e..5797cd38 100644 --- a/queue-3.16/padata-initialize-pd-cpu-with-effective-cpumask.patch +++ b/queue-3.16/padata-initialize-pd-cpu-with-effective-cpumask.patch @@ -56,7 +56,7 @@ Signed-off-by: Ben Hutchings <ben@decadent.org.uk> --- a/kernel/padata.c +++ b/kernel/padata.c -@@ -435,7 +435,7 @@ static struct parallel_data *padata_allo +@@ -441,7 +441,7 @@ static struct parallel_data *padata_allo atomic_set(&pd->refcnt, 0); pd->pinst = pinst; spin_lock_init(&pd->lock); diff --git a/queue-3.16/padata-remove-broken-queue-flushing.patch b/queue-3.16/padata-remove-broken-queue-flushing.patch index f2cd9764..1014cb42 100644 --- a/queue-3.16/padata-remove-broken-queue-flushing.patch +++ b/queue-3.16/padata-remove-broken-queue-flushing.patch @@ -66,7 +66,7 @@ Signed-off-by: Ben Hutchings <ben@decadent.org.uk> } /** -@@ -432,7 +440,7 @@ static struct parallel_data *padata_allo +@@ -438,7 +446,7 @@ static struct parallel_data *padata_allo padata_init_squeues(pd); atomic_set(&pd->seq_nr, -1); atomic_set(&pd->reorder_objects, 0); @@ -75,7 +75,7 @@ Signed-off-by: Ben Hutchings <ben@decadent.org.uk> pd->pinst = pinst; spin_lock_init(&pd->lock); pd->cpu = cpumask_first(pd->cpumask.pcpu); -@@ -459,29 +467,6 @@ static void padata_free_pd(struct parall +@@ -465,29 +473,6 @@ static void padata_free_pd(struct parall kfree(pd); } @@ -105,7 +105,7 @@ Signed-off-by: Ben Hutchings <ben@decadent.org.uk> static void __padata_start(struct padata_instance *pinst) { pinst->flags |= PADATA_INIT; -@@ -495,10 +480,6 @@ static void __padata_stop(struct padata_ +@@ -501,10 +486,6 @@ static void __padata_stop(struct padata_ pinst->flags &= ~PADATA_INIT; synchronize_rcu(); @@ -116,7 +116,7 @@ Signed-off-by: Ben Hutchings <ben@decadent.org.uk> } /* Replace the internal control structure with a new one. */ -@@ -519,8 +500,8 @@ static void padata_replace(struct padata +@@ -525,8 +506,8 @@ static void padata_replace(struct padata if (!cpumask_equal(pd_old->cpumask.cbcpu, pd_new->cpumask.cbcpu)) notification_mask |= PADATA_CPU_SERIAL; diff --git a/queue-3.16/padata-replace-delayed-timer-with-immediate-workqueue-in.patch b/queue-3.16/padata-replace-delayed-timer-with-immediate-workqueue-in.patch index a3b7cec1..ada19878 100644 --- a/queue-3.16/padata-replace-delayed-timer-with-immediate-workqueue-in.patch +++ b/queue-3.16/padata-replace-delayed-timer-with-immediate-workqueue-in.patch @@ -27,9 +27,7 @@ try. A subsequent patch will fix it by replacing it with a ref counting scheme. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> -[bwh: Backported to 3.16: - - Deleted code used the old timer API here - - Adjust context] +[bwh: Backported to 3.16: Deleted code used the old timer API here] Signed-off-by: Ben Hutchings <ben@decadent.org.uk> --- include/linux/padata.h | 13 ++---- @@ -264,10 +262,10 @@ Signed-off-by: Ben Hutchings <ben@decadent.org.uk> } EXPORT_SYMBOL(padata_do_serial); -@@ -455,14 +397,12 @@ static void padata_init_pqueues(struct p - cpu_index = 0; - for_each_cpu(cpu, pd->cpumask.pcpu) { - pqueue = per_cpu_ptr(pd->pqueue, cpu); +@@ -461,14 +403,12 @@ static void padata_init_pqueues(struct p + continue; + } + - pqueue->pd = pd; pqueue->cpu_index = cpu_index; cpu_index++; @@ -279,7 +277,7 @@ Signed-off-by: Ben Hutchings <ben@decadent.org.uk> atomic_set(&pqueue->num_obj, 0); } } -@@ -490,12 +430,13 @@ static struct parallel_data *padata_allo +@@ -496,12 +436,13 @@ static struct parallel_data *padata_allo padata_init_pqueues(pd); padata_init_squeues(pd); @@ -294,7 +292,7 @@ Signed-off-by: Ben Hutchings <ben@decadent.org.uk> return pd; -@@ -530,8 +471,6 @@ static void padata_flush_queues(struct p +@@ -536,8 +477,6 @@ static void padata_flush_queues(struct p flush_work(&pqueue->work); } diff --git a/queue-3.16/padata-set-cpu_index-of-unused-cpus-to-1.patch b/queue-3.16/padata-set-cpu_index-of-unused-cpus-to-1.patch new file mode 100644 index 00000000..a1b1a3e4 --- /dev/null +++ b/queue-3.16/padata-set-cpu_index-of-unused-cpus-to-1.patch @@ -0,0 +1,41 @@ +From: Mathias Krause <minipli@googlemail.com> +Date: Fri, 8 Sep 2017 20:57:09 +0200 +Subject: padata: set cpu_index of unused CPUs to -1 + +commit 1bd845bcb41d5b7f83745e0cb99273eb376f2ec5 upstream. + +The parallel queue per-cpu data structure gets initialized only for CPUs +in the 'pcpu' CPU mask set. This is not sufficient as the reorder timer +may run on a different CPU and might wrongly decide it's the target CPU +for the next reorder item as per-cpu memory gets memset(0) and we might +be waiting for the first CPU in cpumask.pcpu, i.e. cpu_index 0. + +Make the '__this_cpu_read(pd->pqueue->cpu_index) == next_queue->cpu_index' +compare in padata_get_next() fail in this case by initializing the +cpu_index member of all per-cpu parallel queues. Use -1 for unused ones. + +Signed-off-by: Mathias Krause <minipli@googlemail.com> +Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> +Signed-off-by: Ben Hutchings <ben@decadent.org.uk> +--- + kernel/padata.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +--- a/kernel/padata.c ++++ b/kernel/padata.c +@@ -395,8 +395,14 @@ static void padata_init_pqueues(struct p + struct padata_parallel_queue *pqueue; + + cpu_index = 0; +- for_each_cpu(cpu, pd->cpumask.pcpu) { ++ for_each_possible_cpu(cpu) { + pqueue = per_cpu_ptr(pd->pqueue, cpu); ++ ++ if (!cpumask_test_cpu(cpu, pd->cpumask.pcpu)) { ++ pqueue->cpu_index = -1; ++ continue; ++ } ++ + pqueue->pd = pd; + pqueue->cpu_index = cpu_index; + cpu_index++; diff --git a/queue-3.16/series b/queue-3.16/series index e41375eb..c8b44c12 100644 --- a/queue-3.16/series +++ b/queue-3.16/series @@ -4,6 +4,7 @@ spi-spi-dw-add-lock-protect-dw_spi-rx-tx-to-prevent-concurrent-calls.patch padata-remove-unused-but-set-variables.patch padata-avoid-race-in-reordering.patch padata-get_next-is-never-null.patch +padata-set-cpu_index-of-unused-cpus-to-1.patch padata-ensure-the-reorder-timer-callback-runs-on-the-correct-cpu.patch padata-ensure-padata_do_serial-runs-on-the-correct-cpu.patch padata-replace-delayed-timer-with-immediate-workqueue-in.patch |