Re: [PATCH] crypto: virtio: Convert from tasklet to BH workqueue
From: Herbert Xu
Date: Sat Feb 28 2026 - 03:44:33 EST
On Sat, Feb 07, 2026 at 01:20:01PM -0500, Pat Somaru wrote:
> The only generic interface to execute asynchronously in the BH context
> is tasklet; however, it's marked deprecated and has some design flaws
> such as the execution code accessing the tasklet item after the
> execution is complete which can lead to subtle use-after-free in certain
> usage scenarios and less-developed flush and cancel mechanisms.
>
> To replace tasklets, BH workqueue support was recently added. A BH
> workqueue behaves similarly to regular workqueues except that the queued
> work items are executed in the BH context.
>
> Convert virtio_crypto_core.c from tasklet to BH workqueue.
>
> Semantically, this is an equivalent conversion and there shouldn't be
> any user-visible behavior changes. The BH workqueue implementation uses
> the same softirq infrastructure, and performance-critical networking
> conversions have shown no measurable performance impact.
>
> Signed-off-by: Pat Somaru <patso@xxxxxxxxxxxxxx>
> ---
> Hi, I'm working on converting tasklet usages to the BH WQ API.
>
> The virtio-crypto driver uses a tasklet per data queue to process
> completed crypto operations in BH context. This converts that tasklet
> to use the BH workqueue infrastructure.
>
> This patch was tested by:
> - Building with allmodconfig: no new warnings (compared to v6.18)
> - Building with allyesconfig: no new warnings (compared to v6.18)
> - Booting defconfig kernel via vng and running `uname -a`:
> Linux virtme-ng 6.18.0-virtme #1 SMP PREEMPT_DYNAMIC 0 x86_64 GNU/Linux
>
> Maintainers can apply this directly to the crypto subsystem tree or ack
> it for the workqueue tree to carry.
>
> drivers/crypto/virtio/virtio_crypto_common.h | 3 ++-
> drivers/crypto/virtio/virtio_crypto_core.c | 11 +++++------
> 2 files changed, 7 insertions(+), 7 deletions(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt