Skip to content

Commit 2b9bc9e

Browse files
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.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 parents f1aa643 + f9242f1 commit 2b9bc9e

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

drivers/scsi/hisi_sas/hisi_sas_main.c

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,7 +1507,12 @@ void hisi_sas_controller_reset_prepare(struct hisi_hba *hisi_hba)
15071507
scsi_block_requests(shost);
15081508
hisi_hba->hw->wait_cmds_complete_timeout(hisi_hba, 100, 5000);
15091509

1510-
del_timer_sync(&hisi_hba->timer);
1510+
/*
1511+
* hisi_hba->timer is only used for v1/v2 hw, and check hw->sht
1512+
* which is also only used for v1/v2 hw to skip it for v3 hw
1513+
*/
1514+
if (hisi_hba->hw->sht)
1515+
del_timer_sync(&hisi_hba->timer);
15111516

15121517
set_bit(HISI_SAS_REJECT_CMD_BIT, &hisi_hba->flags);
15131518
}
@@ -1573,7 +1578,7 @@ static int hisi_sas_controller_prereset(struct hisi_hba *hisi_hba)
15731578
return -EPERM;
15741579
}
15751580

1576-
if (hisi_sas_debugfs_enable && hisi_hba->debugfs_itct[0].itct)
1581+
if (hisi_sas_debugfs_enable)
15771582
hisi_hba->hw->debugfs_snapshot_regs(hisi_hba);
15781583

15791584
return 0;
@@ -1961,10 +1966,18 @@ static bool hisi_sas_internal_abort_timeout(struct sas_task *task,
19611966
struct hisi_hba *hisi_hba = dev_to_hisi_hba(device);
19621967
struct hisi_sas_internal_abort_data *timeout = data;
19631968

1964-
if (hisi_sas_debugfs_enable && hisi_hba->debugfs_itct[0].itct) {
1965-
down(&hisi_hba->sem);
1969+
if (hisi_sas_debugfs_enable) {
1970+
/*
1971+
* If timeout occurs in device gone scenario, to avoid
1972+
* circular dependency like:
1973+
* hisi_sas_dev_gone() -> down() -> ... ->
1974+
* hisi_sas_internal_abort_timeout() -> down().
1975+
*/
1976+
if (!timeout->rst_ha_timeout)
1977+
down(&hisi_hba->sem);
19661978
hisi_hba->hw->debugfs_snapshot_regs(hisi_hba);
1967-
up(&hisi_hba->sem);
1979+
if (!timeout->rst_ha_timeout)
1980+
up(&hisi_hba->sem);
19681981
}
19691982

19701983
if (task->task_state_flags & SAS_TASK_STATE_DONE) {
@@ -2617,7 +2630,8 @@ static __exit void hisi_sas_exit(void)
26172630
{
26182631
sas_release_transport(hisi_sas_stt);
26192632

2620-
debugfs_remove(hisi_sas_debugfs_dir);
2633+
if (hisi_sas_debugfs_enable)
2634+
debugfs_remove(hisi_sas_debugfs_dir);
26212635
}
26222636

26232637
module_init(hisi_sas_init);

drivers/scsi/hisi_sas/hisi_sas_v3_hw.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4902,7 +4902,8 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id)
49024902
err_out_remove_host:
49034903
scsi_remove_host(shost);
49044904
err_out_undo_debugfs:
4905-
debugfs_exit_v3_hw(hisi_hba);
4905+
if (hisi_sas_debugfs_enable)
4906+
debugfs_exit_v3_hw(hisi_hba);
49064907
err_out_free_host:
49074908
hisi_sas_free(hisi_hba);
49084909
scsi_host_put(shost);
@@ -4934,15 +4935,16 @@ static void hisi_sas_v3_remove(struct pci_dev *pdev)
49344935
struct Scsi_Host *shost = sha->shost;
49354936

49364937
pm_runtime_get_noresume(dev);
4937-
del_timer_sync(&hisi_hba->timer);
49384938

49394939
sas_unregister_ha(sha);
49404940
flush_workqueue(hisi_hba->wq);
49414941
sas_remove_host(shost);
49424942

49434943
hisi_sas_v3_destroy_irqs(pdev, hisi_hba);
49444944
hisi_sas_free(hisi_hba);
4945-
debugfs_exit_v3_hw(hisi_hba);
4945+
if (hisi_sas_debugfs_enable)
4946+
debugfs_exit_v3_hw(hisi_hba);
4947+
49464948
scsi_host_put(shost);
49474949
}
49484950

0 commit comments

Comments
 (0)