Re: [PATCH 1/1] crypto: jitterentropy - replace long-held spinlock with mutex

From: Stephan Mueller

Date: Mon Mar 30 2026 - 03:48:46 EST


Am Montag, 30. März 2026, 09:23:46 Mitteleuropäische Sommerzeit schrieb Haixin
Xu:

Hi Haixin,

> jent_kcapi_random() serializes the shared jitterentropy state, but it
> currently holds a spinlock across the jent_read_entropy() call. That
> path performs expensive jitter collection and SHA3 conditioning, so
> parallel readers can trigger stalls as contending waiters spin for
> the same lock.
>
> To prevent non-preemptible lock hold, replace rng->jent_lock with a
> mutex so contended readers sleep instead of spinning on a shared lock
> held across expensive entropy generation.

Thank you very much for the report and the patch.

Reviewed-by: Stephan Mueller <smueller@xxxxxxxxxx>

Ciao
Stephan