Re: [PATCH 2/2] crypto: hisilicon/trng - support tfms sharing the device

From: huangchenghai

Date: Sun Dec 21 2025 - 22:36:29 EST



在 2025/12/19 11:06, Herbert Xu 写道:
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,

Okay, I will move the lock inside the read loop in hisi_trng_generate.


Thanks,

Chenghai