scsi: ufs: Unbreak the reset handler
PATCH v2 1/1 scsi: ufs: Unbreak the reset handler
A command tag is passed as the second argument of the __ufshcd_transfer_req_compl() call in ufshcd_eh_device_reset_handler() instead of a bitmask. Fix this by passing a bitmask as argument instead of a command tag.
--- drivers/scsi/ufs/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Changes compared to v1: fixed patch description.
drivers/scsi/ufs/ufshcd.c +1 -1
@@ -6876,7 +6876,7 @@ static int ufshcd_eh_device_reset_handler(struct scsi_cmnd *cmd) err =ufshcd_clear_cmd (hba, pos);if (err)break ; -__ufshcd_transfer_req_compl (hba, pos,/*retry_requests=*/ true); +__ufshcd_transfer_req_compl (hba,1U << pos, false); } }
Quoted 10 lines
A command tag is passed as the second argument of the
__ufshcd_transfer_req_compl()call inufshcd_eh_device_reset_handler()instead of a bitmask. Fix this by passing a bitmask as argument instead of a command tag.Cc Can Guo <[email protected]>Fixes a45f937110fa ("scsi: ufs: Optimize host lock on transfer requestssend/compl paths")
Signed-off-by Bart Van Assche <[email protected]>
Few nits below.
Thanks,
Avri
Quoted 11 lines
--- drivers/scsi/ufs/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Changes compared to v1: fixed patch description.
drivers/scsi/ufs/ufshcd.c index renamed from drivers/scsi/ufs/ufshcd.c +0
-0
3841ab49f556..d1dc52c76847100644
drivers/scsi/ufs/ufshcd.c static int ufshcd_eh_device_reset_handler(struct · line 6882
Quoted 8 lines
drivers/scsi/ufs/ufshcd.c +2
-1@@ -6876,7 +6876,7 @@ static int ufshcd_eh_device_reset_handler(struct scsi_cmnd *cmd) err =ufshcd_clear_cmd (hba, pos);if (err)break ; -__ufshcd_transfer_req_compl (hba, pos, /*retry_requests=*/true); +__ufshcd_transfer_req_compl (hba,1U << pos, + false);
1) Maybe a word in the commit log about changing retry_requests from true to false.
2) Also while at it, maybe change u32 pos to u8 tag?
3) Add an unsigned long pending_reqs, add the tag inside the loop,
And call __ufshcd_transfer_req_compl(hba, pending_reqs, false) one time outside the loop.
Thanks,
Avri
Quoted 2 lines
}
}Quoted 8 lines · Avri Altman
Quoted 4 lines
- __ufshcd_transfer_req_compl(hba, pos,
/*retry_requests=*/true);
+ __ufshcd_transfer_req_compl(hba, 1U << pos,
+ false);1) Maybe a word in the commit log about changing
retry_requestsfrom true to false.
2) Also while at it, maybe change u32 pos to u8 tag?
3) Add an unsigned longpending_reqs, add the tag inside the loop,
And call__ufshcd_transfer_req_compl(hba, pending_reqs, false)one time outside the loop.
Hi Avri,
While working on this patch I realized that commit c11a1ae9b8f6 ("scsi: ufs: Add fault injection support") is not necessary. ufshcd_prepare_req_desc_hdr() initializes the command status to OCS_INVALID_COMMAND_STATUS and ufshcd_transfer_rsp_status() translates that status code into DID_REQUEUE. I'm considering to revert commit c11a1ae9b8f6.
I prefer not to change "u32 pos" into "u8 tag", otherwise backporting this patch would become harder than necessary.
Is (3) important to you? I don't think that calls to ufshcd_eh_device_reset_handler() are that common so performance probably is not that important in this function.
Thanks,
Bart.
Quoted 23 lines · Avri Altman
Quoted 5 lines
Quoted 4 lines
- __ufshcd_transfer_req_compl(hba, pos,
/*retry_requests=*/true);
+ __ufshcd_transfer_req_compl(hba, 1U << pos,
+ false);1) Maybe a word in the commit log about changing
retry_requestsfromtrue to false.
Quoted 3 lines
2) Also while at it, maybe change u32 pos to u8 tag?
3) Add an unsigned longpending_reqs, add the tag inside the loop, And call__ufshcd_transfer_req_compl(hba, pending_reqs, false)one timeoutside the loop.
Hi Avri,
While working on this patch I realized that commit
c11a1ae9b8f6("scsi: ufs: Add fault injection support") is not necessary.ufshcd_prepare_req_desc_hdr()initializes the command status toOCS_INVALID_COMMAND_STATUSandufshcd_transfer_rsp_status()translates that status code intoDID_REQUEUE. I'm considering to revert commitc11a1ae9b8f6.
Quoted 6 lines
I prefer not to change "u32 pos" into "u8 tag", otherwise backporting this patch would become harder than necessary.
Is (3) important to you? I don't think that calls to
ufshcd_eh_device_reset_handler()are that common so performance probably is not that important in this function.
OK.
Thanks,
Avri
Quoted 4 lines
Thanks,
Bart.
Martin K. Petersen
AppliedQuoted 6 lines · Bart Van Assche
A command tag is passed as the second argument of the
__ufshcd_transfer_req_compl()call inufshcd_eh_device_reset_handler()instead of a bitmask. Fix this by passing a bitmask as argument instead of a command tag.
Applied to 5.15/scsi-fixes, thanks!
[1/1] scsi: ufs: Unbreak the reset handler
https://git.kernel.org/mkp/scsi/c/d04a968c3368
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering