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

Bart Van Assche
2021-10-26T20:10:55Z

On 10/26/21 11:27 AM, Martin K. Petersen wrote:
>> Agreed, that was my initial proposed solution: get rid of the write
>> buffer optimzation now to fix the API abuse and see if we can add it
>> back in a more acceptable form later.
>
> Doesn't matter to me whether we back out the 2.0 stuff or mark it as
> broken. I merely objected to reverting all of HPB since I don't think
> that would solve anything.
>
> But obviously we'll need a patch to fix 5.15 ASAP...

I do not have access to a test setup that supports HPB.

If blk_insert_cloned_request() is moved into the device mapper then I
think that blk_mq_request_issue_directly() will need to be exported. How
about the (totally untested) patch below for removing the
blk_insert_cloned_request() call from the UFS-HPB code?

Thanks,

Bart.

---
block/blk-mq.c | 1 +
block/blk-mq.h | 1 -
drivers/scsi/ufs/ufshpb.c | 2 +-
include/linux/blkdev.h | 1 +
4 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 108a352051be..186321f450f6 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2084,6 +2084,7 @@ blk_status_t blk_mq_request_issue_directly(struct request *rq, bool last)

return ret;
}
+EXPORT_SYMBOL_GPL(blk_mq_request_issue_directly);

void blk_mq_try_issue_list_directly(struct blk_mq_hw_ctx *hctx,
struct list_head *list)
diff --git a/block/blk-mq.h b/block/blk-mq.h
index d08779f77a26..ffba52189b18 100644
--- a/block/blk-mq.h
+++ b/block/blk-mq.h
@@ -74,7 +74,6 @@ void blk_mq_insert_requests(struct blk_mq_hw_ctx *hctx, struct blk_mq_ctx *ctx,
struct list_head *list);

/* Used by blk_insert_cloned_request() to issue request directly */
-blk_status_t blk_mq_request_issue_directly(struct request *rq, bool last);
void blk_mq_try_issue_list_directly(struct blk_mq_hw_ctx *hctx,
struct list_head *list);

diff --git a/drivers/scsi/ufs/ufshpb.c b/drivers/scsi/ufs/ufshpb.c
index 66b19500844e..458eadcb604f 100644
--- a/drivers/scsi/ufs/ufshpb.c
+++ b/drivers/scsi/ufs/ufshpb.c
@@ -547,7 +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)
+ if (blk_mq_request_issue_directly(req, true) != BLK_STS_OK)
return -EAGAIN;

hpb->stats.pre_req_cnt++;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 12b9dbcc980e..f203c7ea205b 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -867,6 +867,7 @@ extern int blk_rq_prep_clone(struct request *rq, struct request *rq_src,
extern void blk_rq_unprep_clone(struct request *rq);
extern blk_status_t blk_insert_cloned_request(struct request_queue *q,
struct request *rq);
+blk_status_t blk_mq_request_issue_directly(struct request *rq, bool last);
int blk_rq_append_bio(struct request *rq, struct bio *bio);
extern void blk_queue_split(struct bio **);
extern int blk_queue_enter(struct request_queue *q, blk_mq_req_flags_t flags);