Re: [PATCH 2/2] crypto: hisilicon/trng - support tfms sharing the device
From: Herbert Xu
Date: Thu Dec 18 2025 - 22:06:46 EST
On Thu, Nov 20, 2025 at 09:58:12PM +0800, Chenghai Huang wrote:
>
> +static int hisi_trng_reseed(struct hisi_trng *trng)
> +{
> + u8 seed[SW_DRBG_SEED_SIZE];
> + int size;
>
> - return ret;
> + /* Allow other threads to acquire the lock and execute their jobs. */
> + mutex_unlock(&trng->lock);
> + mutex_lock(&trng->lock);
If we have a bunch threads doing generate, then they will all hit
reseed and end up here for no reason at all.
If you want to stop one thread from hogging the lock, perhaps move
it inside the read loop in hisi_trng_generate?
Cheers,
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt