From: Corentin Labbe <clabbe.montjoie@gmail.com>
To: Horia Geanta <horia.geanta@nxp.com>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
"herbert@gondor.apana.org.au" <herbert@gondor.apana.org.au>,
"mripard@kernel.org" <mripard@kernel.org>,
"wens@csie.org" <wens@csie.org>,
Iuliana Prodan <iuliana.prodan@nxp.com>,
"linux-sunxi@googlegroups.com" <linux-sunxi@googlegroups.com>,
"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/9] crypto: engine: workqueue can only be processed one by one
Date: Tue, 28 Jan 2020 17:55:34 +0100 [thread overview]
Message-ID: <20200128165534.GA11610@Red> (raw)
In-Reply-To: <20200128155800.GB17295@Red>
On Tue, Jan 28, 2020 at 04:58:00PM +0100, Corentin Labbe wrote:
> On Tue, Jan 28, 2020 at 03:50:14PM +0000, Horia Geanta wrote:
> > On 1/22/2020 12:46 PM, Corentin Labbe wrote:
> > > Some bykeshedding are unnecessary since a workqueue can only be executed
> > > one by one.
> > > This behaviour is documented in:
> > > - kernel/kthread.c: comment of kthread_worker_fn()
> > > - Documentation/core-api/workqueue.rst: the functions associated with the work items one after the other
> > [...]
> > > @@ -73,16 +73,6 @@ static void crypto_pump_requests(struct crypto_engine *engine,
> > >
> > > spin_lock_irqsave(&engine->queue_lock, flags);
> > >
> > > - /* Make sure we are not already running a request */
> > > - if (engine->cur_req)
> > > - goto out;
> > > -
> > This check is here for a good reason, namely because crypto engine
> > cannot currently handle multiple crypto requests being in "flight"
> > in parallel.
> >
> > More exactly, if this check is removed the following sequence could occur:
> > crypto_pump_work() -> crypto_pump_requests() -> .do_one_request(areq1)
> > crypto_pump_work() -> crypto_pump_requests() -> .do_one_request(areq2)
> > crypto_finalize_request(areq1)
> > crypto_finalize_request(areq2)
> >
>
> As explained in the commitlog, crypto_pump_work() cannot be ran twice.
>
Sorry, I have misunderstood and wrongly answered.
Right since some driver does not block on do_one_request(), crypto_pump_work() can be ran one after one and so launch two request.
So this patch is bad.
Regards
WARNING: multiple messages have this Message-ID (diff)
From: Corentin Labbe <clabbe.montjoie@gmail.com>
To: Horia Geanta <horia.geanta@nxp.com>
Cc: "herbert@gondor.apana.org.au" <herbert@gondor.apana.org.au>,
Iuliana Prodan <iuliana.prodan@nxp.com>,
"linux-sunxi@googlegroups.com" <linux-sunxi@googlegroups.com>,
"mripard@kernel.org" <mripard@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"wens@csie.org" <wens@csie.org>,
"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
"davem@davemloft.net" <davem@davemloft.net>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 1/9] crypto: engine: workqueue can only be processed one by one
Date: Tue, 28 Jan 2020 17:55:34 +0100 [thread overview]
Message-ID: <20200128165534.GA11610@Red> (raw)
In-Reply-To: <20200128155800.GB17295@Red>
On Tue, Jan 28, 2020 at 04:58:00PM +0100, Corentin Labbe wrote:
> On Tue, Jan 28, 2020 at 03:50:14PM +0000, Horia Geanta wrote:
> > On 1/22/2020 12:46 PM, Corentin Labbe wrote:
> > > Some bykeshedding are unnecessary since a workqueue can only be executed
> > > one by one.
> > > This behaviour is documented in:
> > > - kernel/kthread.c: comment of kthread_worker_fn()
> > > - Documentation/core-api/workqueue.rst: the functions associated with the work items one after the other
> > [...]
> > > @@ -73,16 +73,6 @@ static void crypto_pump_requests(struct crypto_engine *engine,
> > >
> > > spin_lock_irqsave(&engine->queue_lock, flags);
> > >
> > > - /* Make sure we are not already running a request */
> > > - if (engine->cur_req)
> > > - goto out;
> > > -
> > This check is here for a good reason, namely because crypto engine
> > cannot currently handle multiple crypto requests being in "flight"
> > in parallel.
> >
> > More exactly, if this check is removed the following sequence could occur:
> > crypto_pump_work() -> crypto_pump_requests() -> .do_one_request(areq1)
> > crypto_pump_work() -> crypto_pump_requests() -> .do_one_request(areq2)
> > crypto_finalize_request(areq1)
> > crypto_finalize_request(areq2)
> >
>
> As explained in the commitlog, crypto_pump_work() cannot be ran twice.
>
Sorry, I have misunderstood and wrongly answered.
Right since some driver does not block on do_one_request(), crypto_pump_work() can be ran one after one and so launch two request.
So this patch is bad.
Regards
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-01-28 16:55 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-22 10:45 [PATCH 0/9] crypto: engine: permit to handle multiple requests Corentin Labbe
2020-01-22 10:45 ` Corentin Labbe
2020-01-22 10:45 ` [PATCH 1/9] crypto: engine: workqueue can only be processed one by one Corentin Labbe
2020-01-22 10:45 ` Corentin Labbe
2020-01-28 15:50 ` Horia Geanta
2020-01-28 15:58 ` Corentin Labbe
2020-01-28 15:58 ` Corentin Labbe
2020-01-28 16:55 ` Corentin Labbe [this message]
2020-01-28 16:55 ` Corentin Labbe
2020-01-22 10:45 ` [PATCH 2/9] crypto: engine: get rid of cur_req_prepared Corentin Labbe
2020-01-22 10:45 ` Corentin Labbe
2020-01-22 10:45 ` [PATCH 3/9] crypto: engine: get rid of cur_req Corentin Labbe
2020-01-22 10:45 ` Corentin Labbe
2020-01-22 10:45 ` [PATCH 4/9] crypto: engine: permit to choose queue length Corentin Labbe
2020-01-22 10:45 ` Corentin Labbe
2020-01-22 10:45 ` [PATCH 5/9] crypto: engine: add enqueue_request/can_do_more Corentin Labbe
2020-01-22 10:45 ` Corentin Labbe
2020-01-27 22:58 ` Iuliana Prodan
2020-01-27 22:58 ` Iuliana Prodan
2020-01-28 8:40 ` Corentin Labbe
2020-01-28 8:40 ` Corentin Labbe
2020-01-28 11:00 ` Iuliana Prodan
2020-01-28 11:00 ` Iuliana Prodan
2020-01-22 10:45 ` [PATCH 6/9] crypto: sun8i-ce: move iv data to request context Corentin Labbe
2020-01-22 10:45 ` Corentin Labbe
2020-01-22 10:45 ` [PATCH 7/9] crypto: sun8i-ce: increase task list size Corentin Labbe
2020-01-22 10:45 ` Corentin Labbe
2020-01-22 10:45 ` [PATCH 8/9] crypto: sun8i-ce: split into prepare/run/unprepare Corentin Labbe
2020-01-22 10:45 ` Corentin Labbe
2020-01-22 10:45 ` [PATCH 9/9] crypto: sun8i-ce: permit to batch requests Corentin Labbe
2020-01-22 10:45 ` Corentin Labbe
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=20200128165534.GA11610@Red \
--to=clabbe.montjoie@gmail.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=horia.geanta@nxp.com \
--cc=iuliana.prodan@nxp.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sunxi@googlegroups.com \
--cc=mripard@kernel.org \
--cc=wens@csie.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.