Re: [PATCH 3/4] crypto: iaa - use RCU per-package WQ tables
From: Vinicius Costa Gomes
Date: Thu Nov 12 2026 - 19:34:39 EST
Hi,
Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> writes:
> On Mon, Oct 19, 2026 at 04:06:22PM -0700, Vinicius Costa Gomes wrote:
>> rebalance_wq_table() gives CPU n all the WQs of IAA device
>> n / cpus_per_iaa. The flat index ignores package boundaries, so a CPU
>> can be paired with a device on another package, and each CPU sends all
>> its requests to one device while the other devices of its package stay
>> idle. The table is also rebuilt in place, so a request issued during a
>> probe or remove can read a NULL WQ and fail with -ENODEV.
>>
>> Replace it with one table per package, holding the WQs of every IAA
>> device on that package, and have each CPU round-robin over its package's
>> table. Rebalance builds the whole set of tables and publishes it with
>> rcu_replace_pointer(). The submit paths look the WQ up, and take their
>> reference on it, inside an RCU read-side section.
>>
>> - A package without IAA devices gets a copy of another package's table,
>> so the lookup needs no fallback.
>> - Every table has room for all the WQs, a few pointers more than it
>> needs, so they can be sized without counting per package.
>> - If a rebalance fails, the current tables are kept. On removal they
>> are cleared instead, because they still hold the removed WQ. Removal
>> then waits for a grace period before returning, because the idxd_wq
>> can be freed after that.
>>
>> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@xxxxxxxxx>
>> ---
>> drivers/crypto/intel/iaa/iaa_crypto.h | 7 -
>> drivers/crypto/intel/iaa/iaa_crypto_main.c | 346 ++++++++++-------------------
>> 2 files changed, 117 insertions(+), 236 deletions(-)
>
> Please respond to this comment:
>
> https://sashiko.dev/#/patchset/20261019-iaa-crypto-wq-tables-v1-0-fab67b2a1538%40intel.com
>
Weird that I haven't received any notification about these comments.
Anyway, as I moved some code around, sashiko considers it a "new" issue,
but from a quick look, it's a pre-existing one. Doesn't seem too hard to
fix, will include the fix on v2.
Cheers,
--
Vinicius