* [PATCH] Remove redundant wait for completion [not found] <CAJz2qXnPquUZSeO9SWSmvLKcdhnT96KnD66F-oatdnotYkxS+A () mail ! gmail ! com> @ 2019-12-13 9:18 ` John Mathew 2019-12-18 16:47 ` Sebastian Andrzej Siewior 0 siblings, 1 reply; 2+ messages in thread From: John Mathew @ 2019-12-13 9:18 UTC (permalink / raw) To: linux-rt-users; +Cc: lukas.bulwahn, John Mathew Wait and completion was bieng done to uninitialized member variable of casted 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) + if (!alg) alg = ERR_PTR(-ENOENT); else if (crypto_is_test_larval(larval) && !(alg->cra_flags & CRYPTO_ALG_TESTED)) -- 2.17.1 ^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Remove redundant wait for completion 2019-12-13 9:18 ` [PATCH] Remove redundant wait for completion John Mathew @ 2019-12-18 16:47 ` Sebastian Andrzej Siewior 0 siblings, 0 replies; 2+ messages in thread From: Sebastian Andrzej Siewior @ 2019-12-18 16:47 UTC (permalink / raw) To: John Mathew; +Cc: linux-rt-users, lukas.bulwahn 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 ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-12-18 16:47 UTC | newest] Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [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 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).