From patchwork Wed May 31 08:38:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?RWQgVHNhaSAo6JSh5a6X6LuSKQ==?= X-Patchwork-Id: 101276 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2726373vqr; Wed, 31 May 2023 01:47:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7n6F1zahPHUaqFm2696toJE4Pq//jWNZslgmy6qUi287FTF7wQx62cmHC4x4jYLtfDVJu5 X-Received: by 2002:a17:902:c948:b0:1af:e2f2:1cce with SMTP id i8-20020a170902c94800b001afe2f21ccemr6043285pla.38.1685522820337; Wed, 31 May 2023 01:47:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685522820; cv=none; d=google.com; s=arc-20160816; b=agol3Hw1dr5qsGA8cwy81ba3jg3lUVDYHWdB+6otJC2XhSvvaXrzsG23M1BBqYKy1K u0aSbxjBX04Ecp7EqsIJjRHUg944KcqZPW8yegUgjymYR3HCLMoH2wed6S2W6uf5HG8S pBSEMa1kkbVFIcHt7w+wg6lN57uVF6aHD93g3URC2uF53ypquttGFkF+Fu55thq6XBcN 9xx8h9Gt7plw3g23/JjQXC5a/XFDT9WdJnlInB3WlS0j9B31oU2Qh/Y2rMTH2ItANW3s U3qX9avyjaWS04OD6jl/cwIx2NQK101edhkKk/bQZ14JP8PTSPY3yfxcA9VWSIzD/J2S n7Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=0nv3Rl9Ah0Yurqkil5EC4EA2Z4hlg1w19JmuTm7+APQ=; b=LWv51yL8xS+xXXnCrZYigaPfQ2hGRKUHPpSIPX//AQOL0kUbwLXeJj6s2aOFi/ESJA /qL3jxULwrj8Lam1h1YIa89seFrmsrmy+9AtlXj1QIy86CYmtEW1GR2SPzgdXTic/k3z L3jfjRe70N2MRSLUyWdHNUkuFruGSg1FPu9B6yXgZ9ZstgexGjAdYpSgHap9vxGqRliD N1IKH6MW/41wyFEP094eh7LoXmWmForVpTojlh/qa0zKeA9mgK4g5TqD9kDykMJpByYG Ct+LrcnTQLfPWX+9ZEin3tcPHRlixCVd5KwUFHnh11zcdBJyZVwimkRhJQ11W/UgPJ6u lhVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=mtnsGzE7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i12-20020a170902c94c00b001a68d4a42c0si513999pla.560.2023.05.31.01.46.46; Wed, 31 May 2023 01:47:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=mtnsGzE7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234824AbjEaIjP (ORCPT + 99 others); Wed, 31 May 2023 04:39:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234798AbjEaIjM (ORCPT ); Wed, 31 May 2023 04:39:12 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECEFE122; Wed, 31 May 2023 01:39:02 -0700 (PDT) X-UUID: 94cf3336ff8e11ed9cb5633481061a41-20230531 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=0nv3Rl9Ah0Yurqkil5EC4EA2Z4hlg1w19JmuTm7+APQ=; b=mtnsGzE7RinVue+XL2iMRZmrc+bigQKb/3ebA8d+pwbfbCGRagViSmJFStkCGqlPFmsLLj/DKvo8GcR//KFG33M28wuXenoySUKbzsFt9+saHi8/4yaqA17H55qutIJsXjRfIA4MlKlaU44aTScpjEGrHwXeS1NpxE5yRYjU5Rk=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.25,REQID:4553f587-a283-4f76-84c8-c87aef2abf4b,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:100,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:100 X-CID-INFO: VERSION:1.1.25,REQID:4553f587-a283-4f76-84c8-c87aef2abf4b,IP:0,URL :0,TC:0,Content:0,EDM:0,RT:0,SF:100,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTIO N:quarantine,TS:100 X-CID-META: VersionHash:d5b0ae3,CLOUDID:92a7ec3c-de1e-4348-bc35-c96f92f1dcbb,B ulkID:230531163859FAK7U5FV,BulkQuantity:0,Recheck:0,SF:29|28|17|19|48,TC:n il,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OS I:0,OSA:0,AV:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-UUID: 94cf3336ff8e11ed9cb5633481061a41-20230531 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1126539607; Wed, 31 May 2023 16:38:56 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Wed, 31 May 2023 16:38:55 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Wed, 31 May 2023 16:38:55 +0800 From: Ed Tsai To: CC: , , , , , , , , , , , , Ed Tsai Subject: blk-mq: check on cpu id when there is only one ctx mapping Date: Wed, 31 May 2023 16:38:28 +0800 Message-ID: <20230531083828.8009-1-ed.tsai@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAY_BE_FORGED,SPF_HELO_PASS,T_SCC_BODY_TEXT_LINE, T_SPF_TEMPERROR,UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767398776778682308?= X-GMAIL-MSGID: =?utf-8?q?1767398776778682308?= 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 Signed-off-by: Po-Wen Kao Reviewed-by: Stanley Chu --- 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;