Re: [PATCH] scsi: ufs: mark HPB support as BROKEN

Bart Van Assche
2021-10-27T17:01:45Z

On 10/27/21 9:16 AM, Martin K. Petersen wrote:
> Given that HPB developed over time, I am not sure how simple a revert
> would be. And we only have a couple of days left before release. I
> really want the smallest patch possible that either removes or disables
> the 2.0 support.

How about one of the untested patches below?

The patch below disables support for HPB 2.0 by ignoring the HPB version reported
by the UFS controller:

diff --git a/drivers/scsi/ufs/ufshpb.c b/drivers/scsi/ufs/ufshpb.c
index 66b19500844e..5f9f7139480a 100644
--- a/drivers/scsi/ufs/ufshpb.c
+++ b/drivers/scsi/ufs/ufshpb.c
@@ -2872,8 +2872,8 @@ void ufshpb_get_dev_info(struct ufs_hba *hba, u8 *desc_buf)
return;
}

- if (version == HPB_SUPPORT_LEGACY_VERSION)
- hpb_dev_info->is_legacy = true;
+ /* Do not use HPB 2.0 because of the blk_insert_cloned_request() call. */
+ hpb_dev_info->is_legacy = true;

ret = ufshcd_query_attr_retry(hba, UPIU_QUERY_OPCODE_READ_ATTR,
QUERY_ATTR_IDN_MAX_HPB_SINGLE_CMD, 0, 0, &max_hpb_single_cmd);

The second patch changes the blk_insert_cloned_request() call into a
blk_execute_rq_nowait() call. That should work fine since this function
bypasses the I/O scheduler for passthrough requests:

diff --git a/drivers/scsi/ufs/ufshpb.c b/drivers/scsi/ufs/ufshpb.c
index 66b19500844e..9e16d1321b34 100644
--- a/drivers/scsi/ufs/ufshpb.c
+++ b/drivers/scsi/ufs/ufshpb.c
@@ -547,8 +547,7 @@ static int ufshpb_execute_pre_req(struct ufshpb_lu *hpb, struct scsi_cmnd *cmd,
read_id);
rq->cmd_len = scsi_command_size(rq->cmd);

- if (blk_insert_cloned_request(q, req) != BLK_STS_OK)
- return -EAGAIN;
+ blk_execute_rq_nowait(req->rq_disk, req, true, req->end_io);

hpb->stats.pre_req_cnt++;

Thanks,

Bart.