block/blk-mq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
commit f168420 ("blk-mq: don't redirect completion for hctx withs only
one ctx mapping") When nvme applies a 1:1 mapping of hctx and ctx, there
will be no remote request.
But for ufs, the submission and completion queues could be asymmetric.
(e.g. Multiple SQs share one CQ) Therefore, 1:1 mapping of hctx and
ctx won't complete request on the submission cpu. In this situation,
this nr_ctx check could violate the QUEUE_FLAG_SAME_FORCE, as a result,
check on cpu id when there is only one ctx mapping.
Signed-off-by: Ed Tsai <ed.tsai@mediatek.com>
Signed-off-by: Po-Wen Kao <powen.kao@mediatek.com>
---
block/blk-mq.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 41f7e2b500bd..ecc30ebe9483 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1176,7 +1176,8 @@ bool blk_mq_complete_request_remote(struct request *rq)
* or a polled request, always complete locally,
* it's pointless to redirect the completion.
*/
- if (rq->mq_hctx->nr_ctx == 1 ||
+ if ((rq->mq_hctx->nr_ctx == 1 &&
+ rq->mq_ctx->cpu == raw_smp_processor_id()) ||
rq->cmd_flags & REQ_POLLED)
return false;
--
2.18.0
On 5/31/23 01:38, Ed Tsai wrote: > commit f168420 ("blk-mq: don't redirect completion for hctx withs only > one ctx mapping") When nvme applies a 1:1 mapping of hctx and ctx, there > will be no remote request. The above sentence is incomprehensible. Please make it comprehensible. > Signed-off-by: Ed Tsai <ed.tsai@mediatek.com> > Signed-off-by: Po-Wen Kao <powen.kao@mediatek.com> This patch comes from Keith Busch. Why has his name not been mentioned? See also https://lore.kernel.org/linux-block/ZHY2TUrKVBj2xGE2@kbusch-mbp.dhcp.thefacebook.com/. Bart.
On Wed, May 31, 2023 at 4:49 PM Ed Tsai <ed.tsai@mediatek.com> wrote: > > commit f168420 ("blk-mq: don't redirect completion for hctx withs only > one ctx mapping") When nvme applies a 1:1 mapping of hctx and ctx, there > will be no remote request. > > But for ufs, the submission and completion queues could be asymmetric. > (e.g. Multiple SQs share one CQ) Therefore, 1:1 mapping of hctx and > ctx won't complete request on the submission cpu. In this situation, > this nr_ctx check could violate the QUEUE_FLAG_SAME_FORCE, as a result, > check on cpu id when there is only one ctx mapping. > > Signed-off-by: Ed Tsai <ed.tsai@mediatek.com> > Signed-off-by: Po-Wen Kao <powen.kao@mediatek.com> Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
commit f168420 ("blk-mq: don't redirect completion for hctx withs only
one ctx mapping") When nvme applies a 1:1 mapping of hctx and ctx, there
will be no remote request.
But for ufs, the submission and completion queues could be asymmetric.
(e.g. Multiple SQs share one CQ) Therefore, 1:1 mapping of hctx and
ctx won't complete request on the submission cpu. In this situation,
this nr_ctx check could violate the QUEUE_FLAG_SAME_FORCE, as a result,
check on cpu id when there is only one ctx mapping.
Signed-off-by: Ed Tsai <ed.tsai@mediatek.com>
Change-Id: I4f95d7538532f72dcb20dacfdd639c97951c2729
---
block/blk-mq.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 41f7e2b500bd..ecc30ebe9483 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1176,7 +1176,8 @@ bool blk_mq_complete_request_remote(struct request *rq)
* or a polled request, always complete locally,
* it's pointless to redirect the completion.
*/
- if (rq->mq_hctx->nr_ctx == 1 ||
+ if ((rq->mq_hctx->nr_ctx == 1 &&
+ rq->mq_ctx->cpu == raw_smp_processor_id()) ||
rq->cmd_flags & REQ_POLLED)
return false;
--
2.18.0
On 31/05/2023 10:38, Ed Tsai wrote: > commit f168420 ("blk-mq: don't redirect completion for hctx withs only > one ctx mapping") When nvme applies a 1:1 mapping of hctx and ctx, there > will be no remote request. > > But for ufs, the submission and completion queues could be asymmetric. > (e.g. Multiple SQs share one CQ) Therefore, 1:1 mapping of hctx and > ctx won't complete request on the submission cpu. In this situation, > this nr_ctx check could violate the QUEUE_FLAG_SAME_FORCE, as a result, > check on cpu id when there is only one ctx mapping. Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com> -- Regards, Alexandre
© 2016 - 2024 Red Hat, Inc.