From: Steffen Klassert <steffen.klassert@secunet.com>
To: Wang Jinchao <wangjinchao@xfusion.com>
Cc: Daniel Jordan <daniel.m.jordan@oracle.com>,
<linux-crypto@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<stone.xulei@xfusion.com>
Subject: Re: [RFC/REFACT] Refactoring and significantly reducing code complexity
Date: Mon, 16 Oct 2023 12:28:07 +0200 [thread overview]
Message-ID: <ZS0QNxbtXPgPH1j2@gauss3.secunet.de> (raw)
In-Reply-To: <ZSCxxxMKoby6XWsg@fedora>
On Sat, Oct 07, 2023 at 09:17:59AM +0800, Wang Jinchao wrote:
> On Fri, Sep 29, 2023 at 07:47:22AM +0200, Steffen Klassert wrote:
> > On Thu, Sep 28, 2023 at 04:53:38PM +0800, Wang Jinchao wrote:
> > > This is a refactored version with the following main changes:
> > >
> > > - The parallel workqueue no longer uses the WQ_UNBOUND attribute
> > > - Removal of CPU-related logic, sysfs-related interfaces
> > > - removal of structures like padata_cpumask, and deletion of parallel_data
> > > - Using completion to maintain sequencing
> > > - no longer using lists
> > > - removing structures like padata_list and padata_serial_queue
> > > - Removal of padata_do_serial()
> >
> > This removes all the logic that is needed to ensure that
> > the parallelized objects return in the same order as
> > they were before the parallelization. This change makes
> > padata unusable for networking.
>
> The RFC use the following three to ensure serial timing sequence:
>
> 1. Use alloc_ordered_workqueue() to create a serial worker queue where
> serial() function runs. This ensures that serial() function executes
> as serial work was enqueued using queue_work().
> 2. Queue the serial work before enqueueing parallel work in padata_do_parallel().
> This ensures the serial work follows the same order as the padata_do_parallel().
> 3. The serial work wait for completion of parallel_done, which will be
> complete()ed after the parallel() function within the parallel work.
I had a closer look to the padata codebase now. The logic to
parallelize/serialize changed quite a bit since I wrote padata
initially. I don't understand the new logic completely,
so we need to rely on Daniels review for this.
> This is just a design idea, because I am not familiar with IPsec, I haven't
> tested it in a real network environment yet.
> Could you give me some clues on how to use pcrypt in an IPsec scenario?
pcrypt has performance gains if the cost of the crypto
oreration is higher than the cost of moving the crypto
request to another cpu. That was the case back in the
days, but the situation changed since then. We now have
hardware support for crypto, like aes-ni etc.
So for hardware supported algorithms, pcrypt will not
help much. But it is still interesting for crypto
algorithms that are implemented in software only.
Here is how you can instantiate a pcrypted
algorithm:
----------------------------------------------------
You need to instantiate pcrypt before you can use it.
You need either crconf or the tcrypt module to instantiate pcrypt.
With crconf:
You can get crconf from https://sourceforge.net/projects/crconf/
After installing crconf do e.g.
crconf add driver "pcrypt(authenc(hmac(sha1-generic),cbc(aes-asm)))" type 3
With tcrypt:
modprobe tcrypt alg="pcrypt(authenc(hmac(sha1-generic),cbc(aes-asm)))" type=3
The modprobe will return with an error, don't worry about it, that's ok.
Once you've did one of the above, your /proc/crypto should show
something like:
name : authenc(hmac(sha1),cbc(aes))
driver : pcrypt(authenc(hmac(sha1-generic),cbc(aes-asm)))
module : pcrypt
priority : 2100
refcnt : 1
selftest : passed
type : aead
async : yes
blocksize : 16
ivsize : 16
maxauthsize : 20
geniv : <built-in>
Now pcrypt is instantiated, e.g. all new IPsec states (that do
hmac-sha1, cbc-aes) will use it.
next prev parent reply other threads:[~2023-10-16 10:28 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-28 8:53 Wang Jinchao
2023-09-29 5:47 ` Steffen Klassert
2023-10-07 1:17 ` Wang Jinchao
2023-10-16 10:28 ` Steffen Klassert [this message]
2023-10-25 18:13 ` Daniel Jordan
2023-10-26 1:15 ` Wang Jinchao
2023-10-08 7:58 ` Wang Jinchao
2023-10-16 10:47 ` Steffen Klassert
2023-10-25 18:07 ` Daniel Jordan
2023-10-26 1:07 ` Wang Jinchao
2023-10-25 18:12 ` Daniel Jordan
2023-10-26 1:12 ` Wang Jinchao
2023-10-26 1:45 ` Wang Jinchao
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=ZS0QNxbtXPgPH1j2@gauss3.secunet.de \
--to=steffen.klassert@secunet.com \
--cc=daniel.m.jordan@oracle.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stone.xulei@xfusion.com \
--cc=wangjinchao@xfusion.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
all inboxes | Powered by JetHome®