From: Herbert Xu <herbert@gondor.apana.org.au>
To: Leonid Ravich <lravich@amazon.com>
Cc: linux-crypto@vger.kernel.org, dm-devel@lists.linux.dev,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
davem@davemloft.net, ebiggers@kernel.org, snitzer@kernel.org,
mpatocka@redhat.com, axboe@kernel.dk
Subject: Re: [PATCH v5 2/5] crypto: dun - data-unit-number dispatch template
Date: Sat, 19 Sep 2026 14:30:19 +1000 [thread overview]
Message-ID: <aq4P2xxmcYLjqKEu@gondor.apana.org.au> (raw)
In-Reply-To: <20260715120102.6687-1-lravich@amazon.com>
On Wed, Jul 15, 2026 at 12:01:02PM +0000, Leonid Ravich wrote:
>
> I benchmarked the mid-API split vs the legacy per-sector loop on
> r7i.metal (VAES-AVX512): dm-crypt shows no measurable throughput or
> latency regression, but a microbench isolates a fixed ~50 ns per 512B
> unit. It's a fixed per-call cost: the split
> copies the counter IV to a per-unit scratch and re-walks the sglist per
> unit and is paid only by callers setting unit_size != 0.
> That gives two directions:
>
> 1. SW batching layer (current v6): mid-API transparently splits when
> the alg lacks CRYPTO_ALG_REQ_SEG and unit_size != 0.
> Works today on every existing skcipher at the ~50 ns/unit cost,
> and goes quiet as algs gain native support.
I think we should be able to eliminate this overhead. Could you
send me the patch so I can take a look?
But going back to the dun template, I think we should still go with
no templates for plain64. But the other ones should use a template
instead of using the cc->iv_gen_ops->generator.
IOW if unit-splitting is in use, dm-crypt should always pass the
sector number in little-endian format in as the IV. Then depending
on which IV generator is configured (which should be done through
templates, just like essiv), they can generate the final IV.
With this scheme, there should be no overall increase in indirect
calls in any case (and with one less for plain64).
This still preserves the ability for optimised implementations to
eliminate indirect calls for the IV generator by handling it directly
rather than through the generic template.
Thanks,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
next prev parent reply other threads:[~2026-09-19 4:30 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-30 8:34 [PATCH v5 0/5] crypto: skcipher - multi-data-unit dispatch as a template Leonid Ravich
2026-06-30 8:34 ` [PATCH v5 1/5] crypto: skcipher - add per-request data_unit_size Leonid Ravich
2026-07-13 2:19 ` Herbert Xu
2026-06-30 8:34 ` [PATCH v5 2/5] crypto: dun - data-unit-number dispatch template Leonid Ravich
2026-07-13 2:25 ` Herbert Xu
2026-07-15 12:01 ` Leonid Ravich
2026-09-19 4:30 ` Herbert Xu [this message]
2026-06-30 8:34 ` [PATCH v5 3/5] crypto: testmgr - test dun() dispatch Leonid Ravich
2026-06-30 8:34 ` [PATCH v5 4/5] dm crypt: batch a bio segment's sectors via dun() Leonid Ravich
2026-07-16 13:34 ` kernel test robot
2026-09-19 4:08 ` Herbert Xu
2026-07-01 6:53 ` [PATCH v5 5/5] blk-crypto: fallback - batch a segment's data units " Leonid Ravich
2026-07-01 7:19 ` [PATCH v5 0/5] crypto: skcipher - multi-data-unit dispatch as a template Eric Biggers
2026-07-02 8:45 ` Leonid Ravich
2026-07-02 16:45 ` Eric Biggers
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=aq4P2xxmcYLjqKEu@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=axboe@kernel.dk \
--cc=davem@davemloft.net \
--cc=dm-devel@lists.linux.dev \
--cc=ebiggers@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lravich@amazon.com \
--cc=mpatocka@redhat.com \
--cc=snitzer@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox