Re: [PATCH v5 09/21] drivers: crypto: meson: process more than MAXDESCS descriptors

From: neil . armstrong
Date: Fri Mar 22 2024 - 06:14:25 EST


On 22/03/2024 09:27, Corentin Labbe wrote:
Le Fri, Mar 01, 2024 at 04:29:24PM +0300, Alexey Romanov a écrit :
1. The old alhorithm was not designed to process a large
amount of memory, and therefore gave incorrect results.

2. Not all Amlogic SoC's use 3 KEY/IV descriptors.
Add keyiv descriptors count parameter to platform data.

Signed-off-by: Alexey Romanov <avromanov@xxxxxxxxxxxxxxxxx>
---
drivers/crypto/amlogic/amlogic-gxl-cipher.c | 441 ++++++++++++--------
drivers/crypto/amlogic/amlogic-gxl-core.c | 1 +
drivers/crypto/amlogic/amlogic-gxl.h | 2 +
3 files changed, 280 insertions(+), 164 deletions(-)


Hello

I have started to test by adding patch one by one and when testing this one I got:
[ 21.674995] gxl-crypto c883e000.crypto: will run requests pump with realtime priority
[ 21.679686] gxl-crypto c883e000.crypto: will run requests pump with realtime priority
[ 21.704366] ------------[ cut here ]------------
[ 21.704480] DMA-API: gxl-crypto c883e000.crypto: device driver tries to sync DMA memory it has not allocated [device address=0x000000000264c000] [size=48 bytes]
[ 21.717684] WARNING: CPU: 1 PID: 263 at kernel/dma/debug.c:1105 check_sync+0x1d0/0x688
[ 21.725512] Modules linked in: meson_rng meson_gxbb_wdt rng_core amlogic_gxl_crypto(+) meson_canvas libphy(+) watchdog ghash_generic gcm xctr xts cts essiv authenc cmac xcbc ccm
[ 21.741211] CPU: 1 PID: 263 Comm: c883e000.crypto Not tainted 6.8.0-rc1-00052-g595d4248b127 #24
[ 21.749834] Hardware name: Libre Computer AML-S905X-CC (DT)
[ 21.755353] pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 21.762252] pc : check_sync+0x1d0/0x688
[ 21.766047] lr : check_sync+0x1d0/0x688
[ 21.769842] sp : ffff8000820fbb40
[ 21.773119] x29: ffff8000820fbb40 x28: 0000000000000000 x27: 0000000000000000
[ 21.780192] x26: ffff800081d639d0 x25: 0000000000001327 x24: ffff00000288b010
[ 21.787265] x23: 0000000000000050 x22: 0000000000001327 x21: ffff800081c23a20
[ 21.794336] x20: ffff800080fe0bb8 x19: ffff8000820fbbc0 x18: 0000000000000006
[ 21.801410] x17: 645b206465746163 x16: 6f6c6c6120746f6e x15: ffff8000820fb540
[ 21.808482] x14: 000000000000000b x13: ffff800081002748 x12: 0000000000000249
[ 21.815554] x11: 00000000000000c3 x10: ffff80008105a748 x9 : ffff800081002748
[ 21.822626] x8 : 00000000ffffefff x7 : ffff80008105a748 x6 : 80000000fffff000
[ 21.829700] x5 : ffff00007d9abb08 x4 : 0000000000000000 x3 : 0000000000000027
[ 21.836772] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff00000b314ec0
[ 21.843844] Call trace:
[ 21.846260] check_sync+0x1d0/0x688
[ 21.849710] debug_dma_sync_single_for_device+0xb8/0xc0
[ 21.854885] dma_sync_single_for_device+0xc0/0x11c
[ 21.859628] meson_handle_cipher_request+0x49c/0x7c4 [amlogic_gxl_crypto]
[ 21.866356] crypto_pump_work+0x160/0x2ac
[ 21.870324] kthread_worker_fn+0xe4/0x300
[ 21.874291] kthread+0x11c/0x120
[ 21.877483] ret_from_fork+0x10/0x20
[ 21.881020] irq event stamp: 9880
[ 21.884296] hardirqs last enabled at (9879): [<ffff800080988834>] _raw_spin_unlock_irqrestore+0x6c/0x70
[ 21.893698] hardirqs last disabled at (9880): [<ffff800080987ca0>] _raw_spin_lock_irqsave+0x84/0x88
[ 21.902668] softirqs last enabled at (5638): [<ffff800080010674>] __do_softirq+0x494/0x4dc
[ 21.910947] softirqs last disabled at (5627): [<ffff8000800161f0>] ____do_softirq+0x10/0x1c
[ 21.919227] ---[ end trace 0000000000000000 ]---

I confirm I see the same starting with this change with DMA_API_DEBUG=1

[ 4.745240] ------------[ cut here ]------------
[ 4.745295] DMA-API: gxl-crypto c883e000.crypto: device driver tries to sync DMA memory it has not allocated [device address=0x000000000a816030] [size=16 bytes]
[ 4.758496] WARNING: CPU: 3 PID: 75 at kernel/dma/debug.c:1105 check_sync+0x1d8/0x690
[ 4.766242] Modules linked in:
[ 4.769258] CPU: 3 PID: 75 Comm: c883e000.crypto Not tainted 6.8.0-rc6-next-20240229-g99fbe5828431 #167
[ 4.778576] Hardware name: Libre Computer AML-S905X-CC (DT)
[ 4.784094] pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 4.790993] pc : check_sync+0x1d8/0x690
[ 4.794786] lr : check_sync+0x1d8/0x690
[ 4.798581] sp : ffff800082563b90
[ 4.801859] x29: ffff800082563b90 x28: ffff8000816ef298 x27: 0000000000000000
[ 4.808934] x26: ffff0000041ed010 x25: 0000000000000018 x24: 0000000000004000
[ 4.816006] x23: ffff8000816d1190 x22: 0000000000004000 x21: ffff800081539b50
[ 4.823079] x20: ffff800082563c40 x19: ffff8000816ef2b0 x18: 0000000000000030
[ 4.830151] x17: 645b206465746163 x16: 6f6c6c6120746f6e x15: 0720072007200720
[ 4.837223] x14: ffff80008154f2c0 x13: 00000000000002a6 x12: 00000000000000e2
[ 4.844296] x11: 0720072007200720 x10: ffff8000815a72c0 x9 : 00000000fffff000
[ 4.851369] x8 : ffff80008154f2c0 x7 : ffff8000815a72c0 x6 : 0000000000000000
[ 4.858441] x5 : 80000000fffff000 x4 : 000000000000aff5 x3 : 0000000000000000
[ 4.865514] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff0000091a9100
[ 4.872587] Call trace:
[ 4.874999] check_sync+0x1d8/0x690
[ 4.878449] debug_dma_sync_single_for_cpu+0x84/0x8c
[ 4.883366] dma_sync_single_for_cpu+0x58/0x10c
[ 4.887851] meson_handle_cipher_request+0x3b0/0x780
[ 4.892767] crypto_pump_work+0x15c/0x2bc
[ 4.896734] kthread_worker_fn+0xcc/0x184
[ 4.900702] kthread+0x118/0x11c
[ 4.903893] ret_from_fork+0x10/0x20
[ 4.907430] ---[ end trace 0000000000000000 ]---

Thanks,
Neil


Regards