lkml.org 
[lkml]   [2019]   [Aug]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] padata: validate cpumask without removed CPU during offline
On Fri, Aug 09, 2019 at 05:06:03PM -0400, Daniel Jordan wrote:
>
> diff --git a/kernel/padata.c b/kernel/padata.c
> index d056276a96ce..01460ea1d160 100644
> --- a/kernel/padata.c
> +++ b/kernel/padata.c
> @@ -702,10 +702,7 @@ static int __padata_remove_cpu(struct padata_instance *pinst, int cpu)
> struct parallel_data *pd = NULL;
>
> if (cpumask_test_cpu(cpu, cpu_online_mask)) {
> -
> - if (!padata_validate_cpumask(pinst, pinst->cpumask.pcpu) ||
> - !padata_validate_cpumask(pinst, pinst->cpumask.cbcpu))
> - __padata_stop(pinst);
> + __padata_stop(pinst);
>
> pd = padata_alloc_pd(pinst, pinst->cpumask.pcpu,
> pinst->cpumask.cbcpu);
> @@ -716,6 +713,9 @@ static int __padata_remove_cpu(struct padata_instance *pinst, int cpu)
>
> cpumask_clear_cpu(cpu, pd->cpumask.cbcpu);
> cpumask_clear_cpu(cpu, pd->cpumask.pcpu);
> + if (padata_validate_cpumask(pinst, pd->cpumask.pcpu) &&
> + padata_validate_cpumask(pinst, pd->cpumask.cbcpu))
> + __padata_start(pinst);
> }

I looked back at the original code and in fact the original
assumption is to call this after cpu_online_mask has been modified.

So I suspect we need to change the state at which this is called
by CPU hotplug. IOW the commit that broke this is 30e92153b4e6.

This would also allow us to get rid of the two cpumask_clear_cpu
calls on pd->cpumask which is just bogus as you should only ever
modify the pd->cpumask prior to the padata_repalce call (because
the readers are not serialised with respect to this).

Cheers,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

\
 
 \ /
  Last update: 2019-08-22 05:51    [W:0.135 / U:25.928 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site