From: Herbert Xu <herbert@gondor.apana.org.au>
To: huangchenghai <huangchenghai2@huawei.com>
Cc: davem@davemloft.net, linux-kernel@vger.kernel.org,
linux-crypto@vger.kernel.org, liulongfang@huawei.com,
qianweili@huawei.com, wangzhou1@hisilicon.com,
linwenkai6@hisilicon.com
Subject: Re: [PATCH 2/4] crypto: hisilicon/sec2 - fix scheduling while atomic in aead soft fallback
Date: Thu, 8 Oct 2026 19:27:59 +1100 [thread overview]
Message-ID: <asdUD5XOvhQbpHNN@gondor.apana.org.au> (raw)
In-Reply-To: <82938646-1ee4-4789-8911-051c43b84d57@huawei.com>
On Wed, Sep 30, 2026 at 09:22:31AM +0800, huangchenghai wrote:
>
> The sizes vary by algorithm. The worst case in the sec2 driver is
> authenc(hmac(sha512),cbc(aes)) at ~568 bytes, mainly due to reqoff = 2 *
> SHA512_DIGEST_SIZE plus the embedded HMAC ahash request. The ccm variants
> are ~468 bytes since crypto_ccm_req_priv_ctx embeds a full ahash_request
> union along with two 3-element scatterlist arrays. gcm(aes) and gcm(sm4)
> are ~288 bytes and fit within the current 384.
>
> The only concern with bumping MAX_SYNC_AEAD_REQSIZE is stack usage, since
> SYNC_AEAD_REQUEST_ON_STACK allocates on the 16KB kernel stack. But the
> fallback path is shallow -- driver -> crypto_aead_encrypt -> template
> internals -- so the additional stack usage should be fine.
>
> Would increasing MAX_SYNC_AEAD_REQSIZE to 1024 be acceptable? That covers
> all current algorithms with some headroom. Per-call stack allocation would
> be roughly 1KB, which seems reasonable for this path.
Thanks for looking into this.
My preference would be to change authenc to store everything on
the stack *if* both skcipher and the hash are actually sync.
Let me write something up.
Cheers,
--
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-10-08 8:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 10:29 [PATCH 0/4] crypto: hisilicon - fix several issues in QM and SEC drivers Chenghai Huang
2026-09-11 10:29 ` [PATCH 1/4] crypto: hisilicon/qm - fix devm_kcalloc argument order Chenghai Huang
2026-09-11 10:29 ` [PATCH 2/4] crypto: hisilicon/sec2 - fix scheduling while atomic in aead soft fallback Chenghai Huang
2026-09-18 9:13 ` Herbert Xu
[not found] ` <c19bbae6-e1f1-4ca4-8156-8b1fb6746319@huawei.com>
2026-09-28 5:14 ` Herbert Xu
[not found] ` <82938646-1ee4-4789-8911-051c43b84d57@huawei.com>
2026-10-08 8:27 ` Herbert Xu [this message]
2026-09-11 10:29 ` [PATCH 3/4] crypto: hisilicon/qm - fix memory leak in hisi_qm_sort_devices Chenghai Huang
2026-09-11 10:29 ` [PATCH 4/4] crypto: hisilicon/qm - fix GFP flag inconsistency in hisi_qm_memory_init Chenghai Huang
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=asdUD5XOvhQbpHNN@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=davem@davemloft.net \
--cc=huangchenghai2@huawei.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linwenkai6@hisilicon.com \
--cc=liulongfang@huawei.com \
--cc=qianweili@huawei.com \
--cc=wangzhou1@hisilicon.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