linux/drivers/crypto/hisilicon
Longfang Liu c7f514e266 crypto: hisilicon/qm - prevent soft lockup in receive loop
[ Upstream commit 33fc506d2a ]

In the scenario where the accelerator business is fully loaded.
When the workqueue receiving messages and performing callback
processing, there are a large number of messages that need to be
received, and there are continuously messages that have been
processed and need to be received.
This will cause the receive loop here to be locked for a long time.
This scenario will cause watchdog timeout problems on OS with kernel
preemption turned off.

The error logs:
watchdog: BUG: soft lockup - CPU#23 stuck for 23s! [kworker/u262:1:1407]
[ 1461.978428][   C23] Call trace:
[ 1461.981890][   C23]  complete+0x8c/0xf0
[ 1461.986031][   C23]  kcryptd_async_done+0x154/0x1f4 [dm_crypt]
[ 1461.992154][   C23]  sec_skcipher_callback+0x7c/0xf4 [hisi_sec2]
[ 1461.998446][   C23]  sec_req_cb+0x104/0x1f4 [hisi_sec2]
[ 1462.003950][   C23]  qm_poll_req_cb+0xcc/0x150 [hisi_qm]
[ 1462.009531][   C23]  qm_work_process+0x60/0xc0 [hisi_qm]
[ 1462.015101][   C23]  process_one_work+0x1c4/0x470
[ 1462.020052][   C23]  worker_thread+0x150/0x3c4
[ 1462.024735][   C23]  kthread+0x108/0x13c
[ 1462.028889][   C23]  ret_from_fork+0x10/0x18

Therefore, it is necessary to add an actively scheduled operation in the
while loop to prevent this problem.
After adding it, no matter whether the OS turns on or off the kernel
preemption function. Neither will cause watchdog timeout issues.

Signed-off-by: Longfang Liu <liulongfang@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2023-11-28 17:19:44 +00:00
..
hpre crypto: hisilicon/qm - fix PF queue parameter issue 2023-11-20 11:59:20 +01:00
sec crypto: hisilicon/sec - Do not check for 0 return after calling platform_get_irq() 2023-08-11 19:19:27 +08:00
sec2 crypto: hisilicon/qm - fix PF queue parameter issue 2023-11-20 11:59:20 +01:00
trng hwrng: histb - Move driver to drivers/char/hw_random/histb-rng.c 2023-05-12 18:48:01 +08:00
zip crypto: hisilicon/qm - fix PF queue parameter issue 2023-11-20 11:59:20 +01:00
debugfs.c crypto: hisilicon/qm - the command dump process is modified 2022-11-18 17:00:22 +08:00
Kconfig hwrng: histb - Move driver to drivers/char/hw_random/histb-rng.c 2023-05-12 18:48:01 +08:00
Makefile hwrng: histb - Move driver to drivers/char/hw_random/histb-rng.c 2023-05-12 18:48:01 +08:00
qm.c crypto: hisilicon/qm - prevent soft lockup in receive loop 2023-11-28 17:19:44 +00:00
qm_common.h crypto: hisilicon/qm - fix PF queue parameter issue 2023-11-20 11:59:20 +01:00
sgl.c mm, treewide: redefine MAX_ORDER sanely 2023-04-05 19:42:46 -07:00