Skip to content

Commit c2304e1

Browse files
dmuszynsherbertx
authored andcommitted
crypto: qat - change SLAs cleanup flow at shutdown
The implementation of the Rate Limiting (RL) feature includes the cleanup of all SLAs during device shutdown. For each SLA, the firmware is notified of the removal through an admin message, the data structures that take into account the budgets are updated and the memory is freed. However, this explicit cleanup is not necessary as (1) the device is reset, and the firmware state is lost and (2) all RL data structures are freed anyway. In addition, if the device is unresponsive, for example after a PCI AER error is detected, the admin interface might not be available. This might slow down the shutdown sequence and cause a timeout in the recovery flows which in turn makes the driver believe that the device is not recoverable. Fix by replacing the explicit SLAs removal with just a free of the SLA data structures. Fixes: d9fb840 ("crypto: qat - add rate limiting feature to qat_4xxx") Cc: <stable@vger.kernel.org> Signed-off-by: Damian Muszynski <damian.muszynski@intel.com> Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 3ee2cee commit c2304e1

File tree

1 file changed

+19
-1
lines changed
  • drivers/crypto/intel/qat/qat_common

1 file changed

+19
-1
lines changed

drivers/crypto/intel/qat/qat_common/adf_rl.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,24 @@ static void clear_sla(struct adf_rl *rl_data, struct rl_sla *sla)
788788
sla_type_arr[node_id] = NULL;
789789
}
790790

791+
static void free_all_sla(struct adf_accel_dev *accel_dev)
792+
{
793+
struct adf_rl *rl_data = accel_dev->rate_limiting;
794+
int sla_id;
795+
796+
mutex_lock(&rl_data->rl_lock);
797+
798+
for (sla_id = 0; sla_id < RL_NODES_CNT_MAX; sla_id++) {
799+
if (!rl_data->sla[sla_id])
800+
continue;
801+
802+
kfree(rl_data->sla[sla_id]);
803+
rl_data->sla[sla_id] = NULL;
804+
}
805+
806+
mutex_unlock(&rl_data->rl_lock);
807+
}
808+
791809
/**
792810
* add_update_sla() - handles the creation and the update of an SLA
793811
* @accel_dev: pointer to acceleration device structure
@@ -1155,7 +1173,7 @@ void adf_rl_stop(struct adf_accel_dev *accel_dev)
11551173
return;
11561174

11571175
adf_sysfs_rl_rm(accel_dev);
1158-
adf_rl_remove_sla_all(accel_dev, true);
1176+
free_all_sla(accel_dev);
11591177
}
11601178

11611179
void adf_rl_exit(struct adf_accel_dev *accel_dev)

0 commit comments

Comments
 (0)