[PATCH v2 0/5] crypto: iaa - Fixes for multi entry SG lists

Vinicius Costa Gomes posted 5 patches 2 weeks, 5 days ago
drivers/crypto/intel/iaa/iaa_crypto_main.c  | 270 +++++++++++++++++++---------
drivers/crypto/intel/iaa/iaa_crypto_stats.c |   9 +
drivers/crypto/intel/iaa/iaa_crypto_stats.h |   2 +
drivers/dma/idxd/defaults.c                 |  12 +-
4 files changed, 201 insertions(+), 92 deletions(-)
[PATCH v2 0/5] crypto: iaa - Fixes for multi entry SG lists
Posted by Vinicius Costa Gomes 2 weeks, 5 days ago
Since commit e2c3b6b21c77 ("mm: zswap: use SG list decompression APIs
from zsmalloc"), iaa_crypto started seeing some failures with
multi-entry scatter lists.

For that we introduce software fallback, in patch 2/5, to iaa-crypto
when SG lists have more than one entry, for both input and output.
Patch 4/5 adds a bounce buffer so small/simple requests can be
linearized and sent to the hardware. This recovers most of the
performance.

Patch 1/5 updates the default resources reserved to iaa-crypto so more
engines are associated to the iaa_crypto group, resulting in better
utilization by default. Patch 3/5 fixes so software request "bytes"
are not counted as hardware "bytes". As the idxd changes only affect
iaa_crypto, sending them here makes more sense. Patch 5/5 fixes a
pre-existing issue pointed out by sashiko, that could cause data
corruption when a hardware error is reported.

A potential use-after-free issue when a descriptor submission times
out, pointed out by Sashiko, still remains and will be handled on a
future series.

It should be noted that as the software and hardware implementations
have different expectations for the window size, something like patch
[1] or the future 'set_params()' API are needed to verify that patch
2/5 works without patch 4/5.

[1] https://lore.kernel.org/linux-crypto/20260326100433.57324-1-giovanni.cabiddu@intel.com/

Cheers,

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
---
Changes in v2:
- Added patch 5/5, for a pre-existing issue, that touches the same
  code paths as this series (Sashiko);
- I took an old version of Giovanni's patch 4/5, new version is
  simpler to read; because of changes did not take Dave Jiang's
  Reviewed-by;
- Added the missing Signed-off-by tags (Dave Jiang);
- Link to v1: https://patch.msgid.link/20260713-iaa-crypto-fixes-zswap-v1-0-65cac23c684d@intel.com

---
Giovanni Cabiddu (4):
      dmaengine: idxd: assign all engines to group 0 in IAA defaults
      crypto: iaa - fall back to software for multi-entry scatterlists
      crypto: iaa - avoid counting fallback decompression bytes
      crypto: iaa - use bounce buffer for multi-sg decompress input

Vinicius Costa Gomes (1):
      crypto: iaa - unmap dst before software fallback on decompress

 drivers/crypto/intel/iaa/iaa_crypto_main.c  | 270 +++++++++++++++++++---------
 drivers/crypto/intel/iaa/iaa_crypto_stats.c |   9 +
 drivers/crypto/intel/iaa/iaa_crypto_stats.h |   2 +
 drivers/dma/idxd/defaults.c                 |  12 +-
 4 files changed, 201 insertions(+), 92 deletions(-)
---
base-commit: 947d62c094367ef6064907d570b47612cd579df6
change-id: 20260713-iaa-crypto-fixes-zswap-ff5baae311d1

Best regards,
--  
Vinicius
Re: [PATCH v2 0/5] crypto: iaa - Fixes for multi entry SG lists
Posted by Herbert Xu 1 week, 3 days ago
On Wed, Aug 05, 2026 at 02:19:21PM -0700, Vinicius Costa Gomes wrote:
> Since commit e2c3b6b21c77 ("mm: zswap: use SG list decompression APIs
> from zsmalloc"), iaa_crypto started seeing some failures with
> multi-entry scatter lists.
> 
> For that we introduce software fallback, in patch 2/5, to iaa-crypto
> when SG lists have more than one entry, for both input and output.
> Patch 4/5 adds a bounce buffer so small/simple requests can be
> linearized and sent to the hardware. This recovers most of the
> performance.
> 
> Patch 1/5 updates the default resources reserved to iaa-crypto so more
> engines are associated to the iaa_crypto group, resulting in better
> utilization by default. Patch 3/5 fixes so software request "bytes"
> are not counted as hardware "bytes". As the idxd changes only affect
> iaa_crypto, sending them here makes more sense. Patch 5/5 fixes a
> pre-existing issue pointed out by sashiko, that could cause data
> corruption when a hardware error is reported.
> 
> A potential use-after-free issue when a descriptor submission times
> out, pointed out by Sashiko, still remains and will be handled on a
> future series.
> 
> It should be noted that as the software and hardware implementations
> have different expectations for the window size, something like patch
> [1] or the future 'set_params()' API are needed to verify that patch
> 2/5 works without patch 4/5.
> 
> [1] https://lore.kernel.org/linux-crypto/20260326100433.57324-1-giovanni.cabiddu@intel.com/
> 
> Cheers,
> 
> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
> ---
> Changes in v2:
> - Added patch 5/5, for a pre-existing issue, that touches the same
>   code paths as this series (Sashiko);
> - I took an old version of Giovanni's patch 4/5, new version is
>   simpler to read; because of changes did not take Dave Jiang's
>   Reviewed-by;
> - Added the missing Signed-off-by tags (Dave Jiang);
> - Link to v1: https://patch.msgid.link/20260713-iaa-crypto-fixes-zswap-v1-0-65cac23c684d@intel.com
> 
> ---
> Giovanni Cabiddu (4):
>       dmaengine: idxd: assign all engines to group 0 in IAA defaults
>       crypto: iaa - fall back to software for multi-entry scatterlists
>       crypto: iaa - avoid counting fallback decompression bytes
>       crypto: iaa - use bounce buffer for multi-sg decompress input
> 
> Vinicius Costa Gomes (1):
>       crypto: iaa - unmap dst before software fallback on decompress
> 
>  drivers/crypto/intel/iaa/iaa_crypto_main.c  | 270 +++++++++++++++++++---------
>  drivers/crypto/intel/iaa/iaa_crypto_stats.c |   9 +
>  drivers/crypto/intel/iaa/iaa_crypto_stats.h |   2 +
>  drivers/dma/idxd/defaults.c                 |  12 +-
>  4 files changed, 201 insertions(+), 92 deletions(-)
> ---
> base-commit: 947d62c094367ef6064907d570b47612cd579df6
> change-id: 20260713-iaa-crypto-fixes-zswap-ff5baae311d1

All applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Re: (subset) [PATCH v2 0/5] crypto: iaa - Fixes for multi entry SG lists
Posted by Vinod Koul 1 week, 6 days ago
On Wed, 05 Aug 2026 14:19:21 -0700, Vinicius Costa Gomes wrote:
> Since commit e2c3b6b21c77 ("mm: zswap: use SG list decompression APIs
> from zsmalloc"), iaa_crypto started seeing some failures with
> multi-entry scatter lists.
> 
> For that we introduce software fallback, in patch 2/5, to iaa-crypto
> when SG lists have more than one entry, for both input and output.
> Patch 4/5 adds a bounce buffer so small/simple requests can be
> linearized and sent to the hardware. This recovers most of the
> performance.
> 
> [...]

Applied, thanks!

[1/5] dmaengine: idxd: assign all engines to group 0 in IAA defaults
      commit: 4a8b7929550eb94d60b32c2c06479444672da381

Best regards,
-- 
~Vinod