Re: [PATCH 1/4] crypto: engine - clear busy and recheck running in the retry pump loop
From: Jean-Michel Hautbois
Date: Thu Nov 12 2026 - 04:15:12 EST
Hi Chenghai,
> When the loop drains the queue it exits with busy still set, and
> crypto_transfer_request() queues a pump only when the engine is not
> busy: if the loop ends with the inline error completion in req_err_1,
> which queues no pump, the next request is enqueued with nothing to run
> it and the engine queue stalls. crypto_engine_stop() also spins
> waiting for the stale busy flag, up to failing with -EBUSY, and the
> loop keeps submitting to hardware after stop was requested because it
> never rechecks running.
I ran into the same stale busy flag while measuring crypto_engine, and
had a narrower fix for it in crypto_transfer_request(). Yours also
covers crypto_engine_stop(), so I dropped mine.
> Jump to the idle check instead: the loop now clears busy and exits
> when the queue is empty, and stops submitting once the engine is no
> longer running. Engines without retry support are unaffected.
Tested with virtio-crypto under QEMU/KVM: a small request no longer
waits for a big one in flight (about 350 us down to 4-8 us).
Tested-by: Jean-Michel Hautbois <jmhautbois@xxxxxxxxxxxx>
--
Jean-Michel Hautbois <jmhautbois@xxxxxxxxxxxx>