linux/drivers/crypto/intel/qat/qat_common
Giovanni Cabiddu 203b01001c crypto: qat - fix deadlock in backlog processing
If a request has the flag CRYPTO_TFM_REQ_MAY_BACKLOG set, the function
qat_alg_send_message_maybacklog(), enqueues it in a backlog list if
either (1) there is already at least one request in the backlog list, or
(2) the HW ring is nearly full or (3) the enqueue to the HW ring fails.
If an interrupt occurs right before the lock in qat_alg_backlog_req() is
taken and the backlog queue is being emptied, then there is no request
in the HW queues that can trigger a subsequent interrupt that can clear
the backlog queue. In addition subsequent requests are enqueued to the
backlog list and not sent to the hardware.

Fix it by holding the lock while taking the decision if the request
needs to be included in the backlog queue or not. This synchronizes the
flow with the interrupt handler that drains the backlog queue.

For performance reasons, the logic has been changed to try to enqueue
first without holding the lock.

Fixes: 3868238397 ("crypto: qat - add backlog mechanism")
Reported-by: Mikulas Patocka <mpatocka@redhat.com>
Closes: https://lore.kernel.org/all/af9581e2-58f9-cc19-428f-6f18f1f83d54@redhat.com/T/
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Reviewed-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2023-10-27 18:04:28 +08:00
..
Makefile crypto: qat - move adf_cfg_services 2023-10-27 18:04:28 +08:00
adf_accel_devices.h crypto: qat - add rp2svc sysfs attribute 2023-10-27 18:04:28 +08:00
adf_accel_engine.c crypto: qat - make fw images name constant 2023-06-16 20:30:35 +08:00
adf_admin.c crypto: qat - add rate limiting feature to qat_4xxx 2023-10-27 18:04:28 +08:00
adf_admin.h crypto: qat - add rate limiting feature to qat_4xxx 2023-10-27 18:04:28 +08:00
adf_aer.c crypto: qat - fix double free during reset 2023-10-20 13:39:25 +08:00
adf_cfg.c
adf_cfg.h
adf_cfg_common.h
adf_cfg_services.c crypto: qat - move adf_cfg_services 2023-10-27 18:04:28 +08:00
adf_cfg_services.h crypto: qat - move adf_cfg_services 2023-10-27 18:04:28 +08:00
adf_cfg_strings.h crypto: qat - enable dc chaining service 2023-09-20 13:15:54 +08:00
adf_cfg_user.h
adf_clock.c crypto: qat - move admin api 2023-10-27 18:04:28 +08:00
adf_clock.h crypto: qat - add measure clock frequency 2023-07-20 22:16:11 +12:00
adf_cnv_dbgfs.c crypto: qat - move admin api 2023-10-27 18:04:28 +08:00
adf_cnv_dbgfs.h crypto: qat - add cnv_errors debugfs file 2023-10-13 18:31:07 +08:00
adf_common_drv.h crypto: qat - move admin api 2023-10-27 18:04:28 +08:00
adf_ctl_drv.c
adf_dbgfs.c crypto: qat - add cnv_errors debugfs file 2023-10-13 18:31:07 +08:00
adf_dbgfs.h crypto: qat - add missing function declaration in adf_dbgfs.h 2023-06-06 12:13:19 +08:00
adf_dev_mgr.c
adf_fw_counters.c crypto: qat - move admin api 2023-10-27 18:04:28 +08:00
adf_fw_counters.h crypto: qat - add fw_counters debugfs file 2023-07-20 22:15:30 +12:00
adf_gen2_config.c crypto: qat - add heartbeat feature 2023-07-20 22:16:23 +12:00
adf_gen2_config.h
adf_gen2_dc.c
adf_gen2_dc.h
adf_gen2_hw_data.c
adf_gen2_hw_data.h crypto: qat - add heartbeat feature 2023-07-20 22:16:23 +12:00
adf_gen2_pfvf.c
adf_gen2_pfvf.h
adf_gen4_dc.c
adf_gen4_dc.h
adf_gen4_hw_data.c
adf_gen4_hw_data.h crypto: qat - add rate limiting feature to qat_4xxx 2023-10-27 18:04:28 +08:00
adf_gen4_pfvf.c
adf_gen4_pfvf.h
adf_gen4_pm.c crypto: qat - move admin api 2023-10-27 18:04:28 +08:00
adf_gen4_pm.h crypto: qat - add pm_status debugfs file 2023-10-13 18:31:07 +08:00
adf_gen4_pm_debugfs.c crypto: qat - move admin api 2023-10-27 18:04:28 +08:00
adf_gen4_ras.c crypto: qat - count QAT GEN4 errors 2023-10-27 18:04:27 +08:00
adf_gen4_ras.h crypto: qat - add handling of errors from ERRSOU3 for QAT GEN4 2023-10-27 18:04:27 +08:00
adf_gen4_timer.c crypto: qat - move admin api 2023-10-27 18:04:28 +08:00
adf_gen4_timer.h crypto: qat - add internal timer for qat 4xxx 2023-07-20 22:16:01 +12:00
adf_heartbeat.c crypto: qat - move admin api 2023-10-27 18:04:28 +08:00
adf_heartbeat.h crypto: qat - add heartbeat counters check 2023-07-20 22:16:23 +12:00
adf_heartbeat_dbgfs.c crypto: qat - move admin api 2023-10-27 18:04:28 +08:00
adf_heartbeat_dbgfs.h crypto: qat - add heartbeat feature 2023-07-20 22:16:23 +12:00
adf_hw_arbiter.c
adf_init.c crypto: qat - add rate limiting feature to qat_4xxx 2023-10-27 18:04:28 +08:00
adf_isr.c crypto: qat - add infrastructure for error reporting 2023-10-27 18:04:27 +08:00
adf_pfvf_msg.h
adf_pfvf_pf_msg.c
adf_pfvf_pf_msg.h
adf_pfvf_pf_proto.c
adf_pfvf_pf_proto.h
adf_pfvf_utils.c
adf_pfvf_utils.h
adf_pfvf_vf_msg.c
adf_pfvf_vf_msg.h
adf_pfvf_vf_proto.c
adf_pfvf_vf_proto.h
adf_pm_dbgfs.c crypto: qat - add pm_status debugfs file 2023-10-13 18:31:07 +08:00
adf_pm_dbgfs.h crypto: qat - add pm_status debugfs file 2023-10-13 18:31:07 +08:00
adf_rl.c crypto: qat - add rate limiting sysfs interface 2023-10-27 18:04:28 +08:00
adf_rl.h crypto: qat - add rate limiting sysfs interface 2023-10-27 18:04:28 +08:00
adf_rl_admin.c crypto: qat - add rate limiting feature to qat_4xxx 2023-10-27 18:04:28 +08:00
adf_rl_admin.h crypto: qat - add rate limiting feature to qat_4xxx 2023-10-27 18:04:28 +08:00
adf_sriov.c
adf_sysfs.c crypto: qat - add num_rps sysfs attribute 2023-10-27 18:04:28 +08:00
adf_sysfs_ras_counters.c crypto: qat - add error counters 2023-10-27 18:04:27 +08:00
adf_sysfs_ras_counters.h crypto: qat - add error counters 2023-10-27 18:04:27 +08:00
adf_sysfs_rl.c crypto: qat - add rate limiting sysfs interface 2023-10-27 18:04:28 +08:00
adf_sysfs_rl.h crypto: qat - add rate limiting sysfs interface 2023-10-27 18:04:28 +08:00
adf_transport.c
adf_transport.h
adf_transport_access_macros.h
adf_transport_debug.c crypto: qat - increase size of buffers 2023-10-01 16:28:15 +08:00
adf_transport_internal.h
adf_vf_isr.c
icp_qat_fw.h
icp_qat_fw_comp.h
icp_qat_fw_init_admin.h crypto: qat - add rate limiting feature to qat_4xxx 2023-10-27 18:04:28 +08:00
icp_qat_fw_la.h
icp_qat_fw_loader_handle.h
icp_qat_fw_pke.h
icp_qat_hal.h
icp_qat_hw.h crypto: qat - add bits.h to icp_qat_hw.h 2023-10-27 18:04:28 +08:00
icp_qat_hw_20_comp.h
icp_qat_hw_20_comp_defs.h
icp_qat_uclo.h
qat_algs.c crypto: qat - move returns to default case 2023-06-16 20:30:35 +08:00
qat_algs_send.c crypto: qat - fix deadlock in backlog processing 2023-10-27 18:04:28 +08:00
qat_algs_send.h
qat_asym_algs.c crypto: qat - unmap buffers before free for RSA 2023-06-16 20:30:35 +08:00
qat_bl.c
qat_bl.h
qat_comp_algs.c crypto: qat - Remove zlib-deflate 2023-10-12 21:59:32 +08:00
qat_comp_req.h
qat_compression.c crypto: qat - use kfree_sensitive instead of memset/kfree() 2023-08-11 19:19:27 +08:00
qat_compression.h
qat_crypto.c
qat_crypto.h
qat_hal.c
qat_uclo.c crypto: qat - refactor deprecated strncpy 2023-09-20 13:15:29 +08:00