linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gilad Ben-Yossef <gilad@benyossef.com>
To: Russell King - ARM Linux <linux@armlinux.org.uk>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	Jonathan Corbet <corbet@lwn.net>,
	David Howells <dhowells@redhat.com>,
	Tom Lendacky <thomas.lendacky@amd.com>,
	Gary Hook <gary.hook@amd.com>,
	Boris Brezillon <boris.brezillon@free-electrons.com>,
	Arnaud Ebalard <arno@natisbad.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Alasdair Kergon <agk@redhat.com>,
	Mike Snitzer <snitzer@redhat.com>,
	device-mapper development <dm-devel@redhat.com>,
	Steve French <sfrench@samba.org>,
	"Theodore Y. Ts'o" <tytso@mit.edu>,
	Jaegeuk Kim <jaegeuk@kernel.org>,
	Steffen Klassert <steffen.klassert@secunet.com>,
	Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
	Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
	Mimi Zohar <zohar@linux.vnet.ibm.com>,
	Dmitry Kasatkin <dmitry.kasatkin@gmail.com>,
	James Morris <james.l.morris@oracle.com>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	linux-cifs@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-ima-user@lists.sourceforge.net, netdev@vger.kernel.org,
	samba-technical@lists.samba.org,
	Linux kernel mailing list <linux-kernel@vger.kernel.org>,
	linux-fscrypt@vger.kernel.org, keyrings@vger.kernel.org,
	linux-mediatek@lists.infradead.org,
	Linux Crypto Mailing List <linux-crypto@vger.kernel.org>,
	linux-security-module@vger.kernel.org,
	linux-ima-devel@lists.sourceforge.net,
	linux-arm-kernel@lists.infradead.org,
	Ofir Drang <ofir.drang@arm.com>
Subject: Re: [PATCH v9 00/20] simplify crypto wait for async op
Date: Wed, 18 Oct 2017 08:44:31 +0300	[thread overview]
Message-ID: <CAOtvUMfOSo4KSBX3UKtYj1sgmReAdhmmi1MhZGq0aFk-vptahg@mail.gmail.com> (raw)
In-Reply-To: <20171017140629.GO20805@n2100.armlinux.org.uk>

On Tue, Oct 17, 2017 at 5:06 PM, Russell King - ARM Linux
<linux@armlinux.org.uk> wrote:
> On Sun, Oct 15, 2017 at 10:19:45AM +0100, Gilad Ben-Yossef wrote:
>> Many users of kernel async. crypto services have a pattern of
>> starting an async. crypto op and than using a completion
>> to wait for it to end.
>>
>> This patch set simplifies this common use case in two ways:
>>
>> First, by separating the return codes of the case where a
>> request is queued to a backlog due to the provider being
>> busy (-EBUSY) from the case the request has failed due
>> to the provider being busy and backlogging is not enabled
>> (-EAGAIN).
>>
>> Next, this change is than built on to create a generic API
>> to wait for a async. crypto operation to complete.
>>
>> The end result is a smaller code base and an API that is
>> easier to use and more difficult to get wrong.
>>
>> The patch set was boot tested on x86_64 and arm64 which
>> at the very least tests the crypto users via testmgr and
>> tcrypt but I do note that I do not have access to some
>> of the HW whose drivers are modified nor do I claim I was
>> able to test all of the corner cases.
>>
>> The patch set is based upon linux-next release tagged
>> next-20171013.
>
> Has there been any performance impact analysis of these changes?  I
> ended up with patches for one of the crypto drivers which converted
> its interrupt handling to threaded interrupts being reverted because
> it caused a performance degredation.
>
> Moving code to latest APIs to simplify it is not always beneficial.

I agree with the sentiment but I believe this one is justified.

This patch set basically does 3 things:

1.  Replace one immediate value (-EBUSY) by another (-EAGAIN). Mostly it's just
s/EBUSY/EAGAIN/g. In very few places this resulted very trivial code
changes. I don't
foresee this having any effect on performance.

2. Removal of some conditions and/or conditional jumps that were used to discern
between two different cases which are now now easily tested for by the
different return
value. If at all, this will be an increase in performance, although I
don't expect it to be
noticeable.

3. Replacing a whole bunch of open coded code and data structures
which were pretty much
cut and pasted from the Documentation and therefore identical, with a
single copy thereof.

Every place that I found that deviated slightly from the identical
pattern, it turned out to be
a bug of some sorts and patches for those were sent and accepted already.

So, we might be losing a few inline optimization opportunities but
we're gaining better
cache utilization. Again, I don't expect any of this to have a
noticeable effect to either
direction.

I did run the changed code as best I could and did not notice any
performance changes and
none of the testers and maintainers that ACKed mentioned any.

Having said that, it's a big change that touches many places,
sub-systems and drivers. I do
not claim to have thoroughly tested for performance all the changes in
person. In some cases,
I don't even have access to the specialized hardware. I did get a
reasonable amount of review
and testers I believe - would always love to see more :-)

Many thanks,
Gilad




-- 
Gilad Ben-Yossef
Chief Coffee Drinker

"If you take a class in large-scale robotics, can you end up in a
situation where the homework eats your dog?"
 -- Jean-Baptiste Queru

      reply	other threads:[~2017-10-18  5:44 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-15  9:19 [PATCH v9 00/20] simplify crypto wait for async op Gilad Ben-Yossef
2017-10-15  9:19 ` [PATCH v9 01/20] crypto: change transient busy return code to -EAGAIN Gilad Ben-Yossef
2017-10-15  9:19 ` [PATCH v9 02/20] crypto: ccp: use -EAGAIN for transient busy indication Gilad Ben-Yossef
2017-10-15  9:19 ` [PATCH v9 03/20] net: " Gilad Ben-Yossef
2017-10-15  9:19 ` [PATCH v9 04/20] crypto: remove redundant backlog checks on EBUSY Gilad Ben-Yossef
2017-10-15  9:19 ` [PATCH v9 05/20] crypto: marvell/cesa: " Gilad Ben-Yossef
2017-10-15  9:19 ` [PATCH v9 06/20] crypto: introduce crypto wait for async op Gilad Ben-Yossef
2017-10-15  9:19 ` [PATCH v9 07/20] crypto: move algif to generic async completion Gilad Ben-Yossef
2017-10-15  9:19 ` [PATCH v9 08/20] crypto: move pub key " Gilad Ben-Yossef
2017-10-15  9:19 ` [PATCH v9 09/20] crypto: move drbg " Gilad Ben-Yossef
2017-10-15  9:19 ` [PATCH v9 10/20] crypto: move gcm " Gilad Ben-Yossef
2017-10-15  9:19 ` [PATCH v9 11/20] crypto: move testmgr " Gilad Ben-Yossef
2017-10-15  9:19 ` [PATCH v9 12/20] fscrypt: move " Gilad Ben-Yossef
2017-10-15  9:19 ` [PATCH v9 13/20] dm: move dm-verity " Gilad Ben-Yossef
2017-10-15  9:19 ` [PATCH v9 14/20] cifs: move " Gilad Ben-Yossef
2017-10-15  9:20 ` [PATCH v9 15/20] ima: " Gilad Ben-Yossef
2017-10-15  9:20 ` [PATCH v9 16/20] crypto: tcrypt: " Gilad Ben-Yossef
2017-10-15  9:20 ` [PATCH v9 17/20] crypto: talitos: " Gilad Ben-Yossef
2017-10-17 10:50   ` Christophe LEROY
2017-10-15  9:20 ` [PATCH v9 18/20] crypto: qce: " Gilad Ben-Yossef
2017-10-15  9:20 ` [PATCH v9 19/20] crypto: mediatek: " Gilad Ben-Yossef
2017-10-15  9:20 ` [PATCH v9 20/20] crypto: adapt api sample to use async. op wait Gilad Ben-Yossef
2017-10-15 15:38 ` [PATCH v9 00/20] simplify crypto wait for async op Herbert Xu
2017-10-17 11:55   ` Gilad Ben-Yossef
2017-10-17 13:09     ` Herbert Xu
2017-10-17 14:06 ` Russell King - ARM Linux
2017-10-18  5:44   ` Gilad Ben-Yossef [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=CAOtvUMfOSo4KSBX3UKtYj1sgmReAdhmmi1MhZGq0aFk-vptahg@mail.gmail.com \
    --to=gilad@benyossef.com \
    --cc=agk@redhat.com \
    --cc=arno@natisbad.org \
    --cc=boris.brezillon@free-electrons.com \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=gary.hook@amd.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=jaegeuk@kernel.org \
    --cc=james.l.morris@oracle.com \
    --cc=keyrings@vger.kernel.org \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-fscrypt@vger.kernel.org \
    --cc=linux-ima-devel@lists.sourceforge.net \
    --cc=linux-ima-user@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=matthias.bgg@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=ofir.drang@arm.com \
    --cc=samba-technical@lists.samba.org \
    --cc=serge@hallyn.com \
    --cc=sfrench@samba.org \
    --cc=snitzer@redhat.com \
    --cc=steffen.klassert@secunet.com \
    --cc=thomas.lendacky@amd.com \
    --cc=tytso@mit.edu \
    --cc=yoshfuji@linux-ipv6.org \
    --cc=zohar@linux.vnet.ibm.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).