linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: John Mathew <john.mathew@unikie.com>
Cc: linux-rt-users@vger.kernel.org, lukas.bulwahn@gmail.com
Subject: Re: [PATCH] Remove redundant wait for completion
Date: Wed, 18 Dec 2019 17:47:17 +0100	[thread overview]
Message-ID: <20191218164717.tfcxmwjze2wp23uz@linutronix.de> (raw)
In-Reply-To: <20191213091843.8365-1-john.mathew@unikie.com>

On 2019-12-13 11:18:43 [+0200], John Mathew wrote:
> Wait and completion was bieng done to
> uninitialized member variable of casted

Why was it uninitialized? If the 'larval' variables is not initialized
then complete_all() would fail.

> pointer. cryptomgr_probe completes all
> the waits when it completes itself. This
> causes the number of wakes to exceed the
> limit of 2.
> 
> This prevents swake_up_all_locked warnings.
> 
> Signed-off-by: John Mathew <john.mathew@unikie.com>
> ---
>  crypto/api.c | 13 +------------
>  1 file changed, 1 insertion(+), 12 deletions(-)
> 
> diff --git a/crypto/api.c b/crypto/api.c
> index d8ba54142620..b89c44c11c54 100644
> --- a/crypto/api.c
> +++ b/crypto/api.c
> @@ -153,12 +153,9 @@ static struct crypto_alg *crypto_larval_add(const char *name, u32 type,
>  
>  void crypto_larval_kill(struct crypto_alg *alg)
>  {
> -	struct crypto_larval *larval = (void *)alg;
> -
>  	down_write(&crypto_alg_sem);
>  	list_del(&alg->cra_list);
>  	up_write(&crypto_alg_sem);
> -	complete_all(&larval->completion);
>  	crypto_alg_put(alg);
>  }
>  EXPORT_SYMBOL_GPL(crypto_larval_kill);
> @@ -166,17 +163,9 @@ EXPORT_SYMBOL_GPL(crypto_larval_kill);
>  static struct crypto_alg *crypto_larval_wait(struct crypto_alg *alg)
>  {
>  	struct crypto_larval *larval = (void *)alg;
> -	long timeout;
> -
> -	timeout = wait_for_completion_killable_timeout(
> -		&larval->completion, 60 * HZ);
>  
>  	alg = larval->adult;
> -	if (timeout < 0)
> -		alg = ERR_PTR(-EINTR);
> -	else if (!timeout)
> -		alg = ERR_PTR(-ETIMEDOUT);
> -	else if (!alg)

I don't think this is correct. You remove the synchronisation but you
don't state why this is correct in all cases.

> +	if (!alg)
>  		alg = ERR_PTR(-ENOENT);
>  	else if (crypto_is_test_larval(larval) &&
>  		 !(alg->cra_flags & CRYPTO_ALG_TESTED))
Sebastian

      reply	other threads:[~2019-12-18 16:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAJz2qXnPquUZSeO9SWSmvLKcdhnT96KnD66F-oatdnotYkxS+A () mail ! gmail ! com>
2019-12-13  9:18 ` [PATCH] Remove redundant wait for completion John Mathew
2019-12-18 16:47   ` Sebastian Andrzej Siewior [this message]

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=20191218164717.tfcxmwjze2wp23uz@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=john.mathew@unikie.com \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=lukas.bulwahn@gmail.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).