Re: [PATCH] crypto: iaa - Fix race condition when probing IAA devices
From: Vinicius Costa Gomes
Date: Thu Jun 12 2025 - 19:10:06 EST
Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> writes:
> On Wed, Jun 11, 2025 at 02:17:49PM -0700, Vinicius Costa Gomes wrote:
>>
>> >From what I could gather, the idea of the per-cpu workqueue table ("map"
>> really) is more to "spread" the workqueues to different CPUS than to
>> reduce contention.
>>
>> If the question is more about the choice of using per-cpu variables, I
>> can look for alternatives.
>
> Prior to your patch, the compress/decompress paths simply did a
> lockless per-cpu lookup to find the wq. Now you're taking a global
> spinlock to do the same lookup.
>
> That makes no sense. Either it should be redesigned to not use
> a spinlock, or the per-cpu data structure should be removed since
> it serves no purpose as you're always taking a global spinlock.
>
Will think a bit harder on this. It could be the code is trying too hard
being smart and there's a easier/simpler way out. I was only trying to
solve a bug that some folks found.
> Cheers,
> --
> Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Cheer,
--
Vinicius