All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ed Tsai <ed.tsai@mediatek.com>
To: <axboe@kernel.dk>
Cc: <kbusch@kernel.org>, <liusong@linux.alibaba.com>,
	<linux-block@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-mediatek@lists.infradead.org>, <wsd_upstream@mediatek.com>,
	<peter.wang@mediatek.com>, <stanley.chu@mediatek.com>,
	<powen.kao@mediatek.com>, <alice.chao@mediatek.com>,
	<naomi.chu@mediatek.com>, Ed Tsai <ed.tsai@mediatek.com>
Subject: [PATCH v2] blk-mq: check on cpu id when there is only one ctx mapping
Date: Wed, 31 May 2023 16:38:29 +0800	[thread overview]
Message-ID: <20230531083828.8009-2-ed.tsai@mediatek.com> (raw)
In-Reply-To: <20230531083828.8009-1-ed.tsai@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


WARNING: multiple messages have this Message-ID (diff)
From: Ed Tsai <ed.tsai@mediatek.com>
To: <axboe@kernel.dk>
Cc: <kbusch@kernel.org>, <liusong@linux.alibaba.com>,
	<linux-block@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-mediatek@lists.infradead.org>, <wsd_upstream@mediatek.com>,
	<peter.wang@mediatek.com>, <stanley.chu@mediatek.com>,
	<powen.kao@mediatek.com>, <alice.chao@mediatek.com>,
	<naomi.chu@mediatek.com>, Ed Tsai <ed.tsai@mediatek.com>
Subject: [PATCH v2] blk-mq: check on cpu id when there is only one ctx mapping
Date: Wed, 31 May 2023 16:38:29 +0800	[thread overview]
Message-ID: <20230531083828.8009-2-ed.tsai@mediatek.com> (raw)
In-Reply-To: <20230531083828.8009-1-ed.tsai@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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-05-31  8:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-31  8:38 blk-mq: check on cpu id when there is only one ctx mapping Ed Tsai
2023-05-31  8:38 ` Ed Tsai
2023-05-31  8:38 ` Ed Tsai [this message]
2023-05-31  8:38   ` [PATCH v2] " Ed Tsai
2023-05-31  9:40   ` Alexandre Mergnat
2023-05-31  9:40     ` Alexandre Mergnat
2023-05-31  9:04 ` Stanley Chu
2023-05-31  9:04   ` Stanley Chu
2023-06-11 15:21 ` Bart Van Assche

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230531083828.8009-2-ed.tsai@mediatek.com \
    --to=ed.tsai@mediatek.com \
    --cc=alice.chao@mediatek.com \
    --cc=axboe@kernel.dk \
    --cc=kbusch@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=liusong@linux.alibaba.com \
    --cc=naomi.chu@mediatek.com \
    --cc=peter.wang@mediatek.com \
    --cc=powen.kao@mediatek.com \
    --cc=stanley.chu@mediatek.com \
    --cc=wsd_upstream@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.