mbox series

[0/5] crypto: qat - fix concurrency related issues

Message ID 20230227205545.5796-1-shashank.gupta@intel.com
Headers show
Series crypto: qat - fix concurrency related issues | expand

Message

Shashank Gupta Feb. 27, 2023, 8:55 p.m. UTC
This set fixes issues related to using unprotected QAT device state    
machine functions that might cause concurrency issues at the time of state  
transition.

The first patch fixes the QAT 4XXX device's unexpected behaviour that
might occur if the user changes the device state or configuration via
sysfs while the driver performing device bring-up. The sequence is changed
in the probe function now the sysfs attribute is created after the device
initialization.

The second patch fixes the concurrency issue in the sysfs `state` 
attribute if multiple processes change the state of the qat device in 
parallel. The change introduces the protected wrapper function 
adf_dev_up() and adf_dev_down() that protects the transition of the device
state. These are used in adf_sysfs.c instead of low-level state machine 
functions.

The third patch replaces the use of unsafe low-level device state machine 
function with its protected wrapper functions.

The forth patch refactor device restart logic by moving it into 
adf_dev_restart() which uses safe adf_dev_up() and adf_dev_down().

The fifth patch define state machine functions static as they are unsafe
to use for state transition now performed by safe adf_dev_up() and 
adf_dev_down().

Shashank Gupta (5):
  crypto: qat - delay sysfs initialization
  crypto: qat - fix concurrency issue when device state changes
  crypto: qat - replace state machine calls
  crypto: qat - refactor device restart logic
  crypto: qat - make state machine functions static

 drivers/crypto/qat/qat_4xxx/adf_drv.c             | 21 ++---
 drivers/crypto/qat/qat_c3xxx/adf_drv.c            | 17 +---
 drivers/crypto/qat/qat_c3xxxvf/adf_drv.c          | 13 +--
 drivers/crypto/qat/qat_c62x/adf_drv.c             | 17 +---
 drivers/crypto/qat/qat_c62xvf/adf_drv.c           | 13 +--
 drivers/crypto/qat/qat_common/adf_accel_devices.h |  1 +
 drivers/crypto/qat/qat_common/adf_aer.c           |  4 +-
 drivers/crypto/qat/qat_common/adf_common_drv.h    |  8 +-
 drivers/crypto/qat/qat_common/adf_ctl_drv.c       | 27 +++----
 drivers/crypto/qat/qat_common/adf_dev_mgr.c       |  2 +
 drivers/crypto/qat/qat_common/adf_init.c          | 96 ++++++++++++++++++++---
 drivers/crypto/qat/qat_common/adf_sriov.c         | 10 +--
 drivers/crypto/qat/qat_common/adf_sysfs.c         | 23 +-----
 drivers/crypto/qat/qat_common/adf_vf_isr.c        |  3 +-
 drivers/crypto/qat/qat_dh895xcc/adf_drv.c         | 17 +---
 drivers/crypto/qat/qat_dh895xccvf/adf_drv.c       | 13 +--
 16 files changed, 132 insertions(+), 153 deletions(-)