Skip to content

Commit bb54422

Browse files
Xingui Yangmartinkpetersen
authored andcommitted
scsi: hisi_sas: Handle NCQ error when IPTT is valid
If an NCQ error occurs when the IPTT is valid and slot->abort flag is set in completion path, sas_task_abort() will be called to abort only one NCQ command now, and the host would be set to SHOST_RECOVERY state. But this may not kick-off EH Immediately until other outstanding QCs timeouts. As a result, the host may remain in the SHOST_RECOVERY state for up to 30 seconds, such as follows: [7972317.645234] hisi_sas_v3_hw 0000:74:04.0: erroneous completion iptt=3264 task=00000000466116b8 dev id=2 sas_addr=0x5000000000000502 CQ hdr: 0x1883 0x20cc0 0x40000 0x20420000 Error info: 0x0 0x0 0x200000 0x0 [7972341.508264] sas: Enter sas_scsi_recover_host busy: 32 failed: 32 [7972341.984731] sas: --- Exit sas_scsi_recover_host: busy: 0 failed: 32 tries: 1 All NCQ commands that are in the queue should be aborted when an NCQ error occurs in this scenario. Fixes: 05d91b5 ("scsi: hisi_sas: Directly trigger SCSI error handling for completion errors") Signed-off-by: Xingui Yang <yangxingui@huawei.com> Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com> Link: https://lore.kernel.org/r/1679283265-115066-3-git-send-email-chenxiang66@hisilicon.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 71fb36b commit bb54422

3 files changed

Lines changed: 15 additions & 3 deletions

File tree

drivers/scsi/hisi_sas/hisi_sas_v1_hw.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1258,7 +1258,11 @@ static void slot_complete_v1_hw(struct hisi_hba *hisi_hba,
12581258

12591259
slot_err_v1_hw(hisi_hba, task, slot);
12601260
if (unlikely(slot->abort)) {
1261-
sas_task_abort(task);
1261+
if (dev_is_sata(device) && task->ata_task.use_ncq)
1262+
sas_ata_device_link_abort(device, true);
1263+
else
1264+
sas_task_abort(task);
1265+
12621266
return;
12631267
}
12641268
goto out;

drivers/scsi/hisi_sas/hisi_sas_v2_hw.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2404,7 +2404,11 @@ static void slot_complete_v2_hw(struct hisi_hba *hisi_hba,
24042404
error_info[2], error_info[3]);
24052405

24062406
if (unlikely(slot->abort)) {
2407-
sas_task_abort(task);
2407+
if (dev_is_sata(device) && task->ata_task.use_ncq)
2408+
sas_ata_device_link_abort(device, true);
2409+
else
2410+
sas_task_abort(task);
2411+
24082412
return;
24092413
}
24102414
goto out;

drivers/scsi/hisi_sas/hisi_sas_v3_hw.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2327,7 +2327,11 @@ static void slot_complete_v3_hw(struct hisi_hba *hisi_hba,
23272327
error_info[0], error_info[1],
23282328
error_info[2], error_info[3]);
23292329
if (unlikely(slot->abort)) {
2330-
sas_task_abort(task);
2330+
if (dev_is_sata(device) && task->ata_task.use_ncq)
2331+
sas_ata_device_link_abort(device, true);
2332+
else
2333+
sas_task_abort(task);
2334+
23312335
return;
23322336
}
23332337
goto out;

0 commit comments

Comments
 (0)