linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Jordan <daniel.m.jordan@oracle.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Eric Biggers <ebiggers@kernel.org>,
	Linux Crypto Mailing List <linux-crypto@vger.kernel.org>,
	Steffen Klassert <steffen.klassert@secunet.com>,
	Daniel Jordan <daniel.m.jordan@oracle.com>
Subject: Re: [v2 PATCH] crypto: pcrypt - Avoid deadlock by using per-instance padata queues
Date: Fri, 22 Nov 2019 11:28:12 -0500	[thread overview]
Message-ID: <20191122162812.a4uzsnvr7crghtzo@ca-dmjordan1.us.oracle.com> (raw)
In-Reply-To: <20191119185827.nerskpvddkcsih25@gondor.apana.org.au>

On Wed, Nov 20, 2019 at 02:58:27AM +0800, Herbert Xu wrote:
>  static int __padata_remove_cpu(struct padata_instance *pinst, int cpu)
>  {
> -	struct parallel_data *pd = NULL;
> -
>  	if (cpumask_test_cpu(cpu, cpu_online_mask)) {
> +		cpumask_clear_cpu(cpu, pinst->cpumask.pcpu);
> +		cpumask_clear_cpu(cpu, pinst->cpumask.cbcpu);
>  
>  		if (!padata_validate_cpumask(pinst, pinst->cpumask.pcpu) ||
>  		    !padata_validate_cpumask(pinst, pinst->cpumask.cbcpu))
>  			__padata_stop(pinst);
>  
> -		pd = padata_alloc_pd(pinst, pinst->cpumask.pcpu,
> -				     pinst->cpumask.cbcpu);
> -		if (!pd)
> -			return -ENOMEM;
> -
> -		padata_replace(pinst, pd);
> -
> -		cpumask_clear_cpu(cpu, pd->cpumask.cbcpu);
> -		cpumask_clear_cpu(cpu, pd->cpumask.pcpu);
> +		padata_replace(pinst);
>  	}

Clearing the offlined CPU from pinst's cpumasks means it won't be used if it
comes back online.

The CPU could be cleared from all pd's attached to the instance, but that
doesn't address another bug in this function that's fixed by this patch:

    https://lore.kernel.org/linux-crypto/20190828221425.22701-6-daniel.m.jordan@oracle.com/

Should I add it into the next version of the padata series I just posted?:

    https://lore.kernel.org/linux-crypto/20191120185412.302-1-daniel.m.jordan@oracle.com/

It would obviate the need for your patch to mess with cpumask_clear_cpu().  Or
is there something else you'd prefer?

Thanks,
Daniel

  reply	other threads:[~2019-11-22 16:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-19 13:05 [PATCH] crypto: pcrypt - Avoid deadlock by using per-instance padata queues Herbert Xu
2019-11-19 17:37 ` Eric Biggers
2019-11-19 18:58   ` [v2 PATCH] " Herbert Xu
2019-11-22 16:28     ` Daniel Jordan [this message]
2019-11-26  5:32     ` Daniel Jordan
2019-11-26  7:58       ` [v3 " Herbert Xu
2019-11-27 19:14         ` Eric Biggers
2019-11-29  8:40           ` [PATCH] crypto: pcrypt - Do not clear MAY_SLEEP flag in original request Herbert Xu
2019-11-29 19:24             ` Eric Biggers
2019-11-27 23:38         ` [v3 PATCH] crypto: pcrypt - Avoid deadlock by using per-instance padata queues Daniel Jordan
2019-11-29 19:25         ` Eric Biggers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191122162812.a4uzsnvr7crghtzo@ca-dmjordan1.us.oracle.com \
    --to=daniel.m.jordan@oracle.com \
    --cc=ebiggers@kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=steffen.klassert@secunet.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).