Linux block layer
 help / color / mirror / Atom feed
From: Leonid Ravich <lravich@amazon.com>
To: <herbert@gondor.apana.org.au>
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: Wed, 15 Jul 2026 12:01:02 +0000	[thread overview]
Message-ID: <20260715120102.6687-1-lravich@amazon.com> (raw)
In-Reply-To: <alRMn--pY1ELYmBJ@gondor.apana.org.au>

On Mon, Jul 13, 2026 at 12:25:35PM +1000, Herbert Xu wrote:
> This shouldn't be a template.  The default data-unit handling
> should go into the mid-API layer (so skcipher.c).  It should
> transparently split things up *if* the underlying algorithm does
> not support multiple units.

Done for v6 (mid-API split in skcipher.c, cherry-picking  acomp
CRYPTO_ALG_REQ_SEG / segmentation-wrapper patch as you suggested).  One
design fork I'd like your call on before I resend.

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.

  2. HW-offload-hint model (as in Inel acomp series): callers set
     unit_size only for CRYPTO_ALG_REQ_SEG algs and the mid-API never
     emulates non-native ones.  Zero overhead, but the path is dead
     until an in-tree skcipher advertises native support, unlike
     acomp, where IAA already does.

(1) is usable now with a small permanent SW cost; (2) mirrors the acomp
mid-layer dispatch but, absent a native skcipher, ships an interface
with no in-tree user.  Which would you prefer?

Thanks,
Leonid

  reply	other threads:[~2026-07-15 12:01 UTC|newest]

Thread overview: 12+ 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 [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-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=20260715120102.6687-1-lravich@amazon.com \
    --to=lravich@amazon.com \
    --cc=axboe@kernel.dk \
    --cc=davem@davemloft.net \
    --cc=dm-devel@lists.linux.dev \
    --cc=ebiggers@kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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