Commit 2b9bc9ef authored by Martin K. Petersen's avatar Martin K. Petersen

Merge patch series "scsi: hisi_sas: Minor fixes and cleanups"

chenxiang <chenxiang66@hisilicon.com> says:

This series contains some fixes and cleanups including:

 - Fix a deadlock issue related to automatic debugfs;

 - Remove redundant checks for automatic debugfs;

 - Check whether debugfs is enabled before removing or releasing it;

 - Remove hisi_hba->timer for v3 hw;

Link: https://lore.kernel.org/r/1705904747-62186-1-git-send-email-chenxiang66@hisilicon.comSigned-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parents f1aa6437 f9242f16
...@@ -1507,7 +1507,12 @@ void hisi_sas_controller_reset_prepare(struct hisi_hba *hisi_hba) ...@@ -1507,7 +1507,12 @@ void hisi_sas_controller_reset_prepare(struct hisi_hba *hisi_hba)
scsi_block_requests(shost); scsi_block_requests(shost);
hisi_hba->hw->wait_cmds_complete_timeout(hisi_hba, 100, 5000); hisi_hba->hw->wait_cmds_complete_timeout(hisi_hba, 100, 5000);
del_timer_sync(&hisi_hba->timer); /*
* hisi_hba->timer is only used for v1/v2 hw, and check hw->sht
* which is also only used for v1/v2 hw to skip it for v3 hw
*/
if (hisi_hba->hw->sht)
del_timer_sync(&hisi_hba->timer);
set_bit(HISI_SAS_REJECT_CMD_BIT, &hisi_hba->flags); set_bit(HISI_SAS_REJECT_CMD_BIT, &hisi_hba->flags);
} }
...@@ -1573,7 +1578,7 @@ static int hisi_sas_controller_prereset(struct hisi_hba *hisi_hba) ...@@ -1573,7 +1578,7 @@ static int hisi_sas_controller_prereset(struct hisi_hba *hisi_hba)
return -EPERM; return -EPERM;
} }
if (hisi_sas_debugfs_enable && hisi_hba->debugfs_itct[0].itct) if (hisi_sas_debugfs_enable)
hisi_hba->hw->debugfs_snapshot_regs(hisi_hba); hisi_hba->hw->debugfs_snapshot_regs(hisi_hba);
return 0; return 0;
...@@ -1961,10 +1966,18 @@ static bool hisi_sas_internal_abort_timeout(struct sas_task *task, ...@@ -1961,10 +1966,18 @@ static bool hisi_sas_internal_abort_timeout(struct sas_task *task,
struct hisi_hba *hisi_hba = dev_to_hisi_hba(device); struct hisi_hba *hisi_hba = dev_to_hisi_hba(device);
struct hisi_sas_internal_abort_data *timeout = data; struct hisi_sas_internal_abort_data *timeout = data;
if (hisi_sas_debugfs_enable && hisi_hba->debugfs_itct[0].itct) { if (hisi_sas_debugfs_enable) {
down(&hisi_hba->sem); /*
* If timeout occurs in device gone scenario, to avoid
* circular dependency like:
* hisi_sas_dev_gone() -> down() -> ... ->
* hisi_sas_internal_abort_timeout() -> down().
*/
if (!timeout->rst_ha_timeout)
down(&hisi_hba->sem);
hisi_hba->hw->debugfs_snapshot_regs(hisi_hba); hisi_hba->hw->debugfs_snapshot_regs(hisi_hba);
up(&hisi_hba->sem); if (!timeout->rst_ha_timeout)
up(&hisi_hba->sem);
} }
if (task->task_state_flags & SAS_TASK_STATE_DONE) { if (task->task_state_flags & SAS_TASK_STATE_DONE) {
...@@ -2617,7 +2630,8 @@ static __exit void hisi_sas_exit(void) ...@@ -2617,7 +2630,8 @@ static __exit void hisi_sas_exit(void)
{ {
sas_release_transport(hisi_sas_stt); sas_release_transport(hisi_sas_stt);
debugfs_remove(hisi_sas_debugfs_dir); if (hisi_sas_debugfs_enable)
debugfs_remove(hisi_sas_debugfs_dir);
} }
module_init(hisi_sas_init); module_init(hisi_sas_init);
......
...@@ -4902,7 +4902,8 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -4902,7 +4902,8 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id)
err_out_remove_host: err_out_remove_host:
scsi_remove_host(shost); scsi_remove_host(shost);
err_out_undo_debugfs: err_out_undo_debugfs:
debugfs_exit_v3_hw(hisi_hba); if (hisi_sas_debugfs_enable)
debugfs_exit_v3_hw(hisi_hba);
err_out_free_host: err_out_free_host:
hisi_sas_free(hisi_hba); hisi_sas_free(hisi_hba);
scsi_host_put(shost); scsi_host_put(shost);
...@@ -4934,7 +4935,6 @@ static void hisi_sas_v3_remove(struct pci_dev *pdev) ...@@ -4934,7 +4935,6 @@ static void hisi_sas_v3_remove(struct pci_dev *pdev)
struct Scsi_Host *shost = sha->shost; struct Scsi_Host *shost = sha->shost;
pm_runtime_get_noresume(dev); pm_runtime_get_noresume(dev);
del_timer_sync(&hisi_hba->timer);
sas_unregister_ha(sha); sas_unregister_ha(sha);
flush_workqueue(hisi_hba->wq); flush_workqueue(hisi_hba->wq);
...@@ -4942,7 +4942,9 @@ static void hisi_sas_v3_remove(struct pci_dev *pdev) ...@@ -4942,7 +4942,9 @@ static void hisi_sas_v3_remove(struct pci_dev *pdev)
hisi_sas_v3_destroy_irqs(pdev, hisi_hba); hisi_sas_v3_destroy_irqs(pdev, hisi_hba);
hisi_sas_free(hisi_hba); hisi_sas_free(hisi_hba);
debugfs_exit_v3_hw(hisi_hba); if (hisi_sas_debugfs_enable)
debugfs_exit_v3_hw(hisi_hba);
scsi_host_put(shost); scsi_host_put(shost);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment