mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: huangchenghai <huangchenghai2@huawei.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: <davem@davemloft.net>, <linux-kernel@vger.kernel.org>,
	<linux-crypto@vger.kernel.org>, <fanghao11@huawei.com>,
	<liulongfang@huawei.com>, <qianweili@huawei.com>,
	<linwenkai6@hisilicon.com>, <wangzhou1@hisilicon.com>
Subject: Re: [PATCH 2/2] crypto: hisilicon/trng - support tfms sharing the device
Date: Mon, 22 Dec 2025 11:36:20 +0800	[thread overview]
Message-ID: <1b60e2e2-ad38-40e2-8e15-bb37f1fabd0c@huawei.com> (raw)
In-Reply-To: <aUTBQjke3PxSREAu@gondor.apana.org.au>


在 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


      reply	other threads:[~2025-12-22  3:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-20 13:58 [PATCH 0/2] crypto: hisilicon/trng - support multiple " Chenghai Huang
2025-11-20 13:58 ` [PATCH 1/2] crypto: hisilicon/trng - use DEFINE_MUTEX() and LIST_HEAD() Chenghai Huang
2025-12-19  3:04   ` Herbert Xu
2025-12-22  6:10     ` huangchenghai
2025-12-24  2:49       ` Herbert Xu
2025-11-20 13:58 ` [PATCH 2/2] crypto: hisilicon/trng - support tfms sharing the device Chenghai Huang
2025-12-19  3:06   ` Herbert Xu
2025-12-22  3:36     ` huangchenghai [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1b60e2e2-ad38-40e2-8e15-bb37f1fabd0c@huawei.com \
    --to=huangchenghai2@huawei.com \
    --cc=davem@davemloft.net \
    --cc=fanghao11@huawei.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linwenkai6@hisilicon.com \
    --cc=liulongfang@huawei.com \
    --cc=qianweili@huawei.com \
    --cc=wangzhou1@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®