Message ID | 20221223125223.1687670-4-shikemeng@huaweicloud.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp138464wrn; Thu, 22 Dec 2022 20:54:58 -0800 (PST) X-Google-Smtp-Source: AMrXdXukbD2bp5iD8DHSPl1vTugtek4CztImZcCqga8m/45H2FGaQD8Fuxk3Fwjte0E3c9WoC7Ql X-Received: by 2002:a05:6300:8109:b0:a5:60d7:fb82 with SMTP id bs9-20020a056300810900b000a560d7fb82mr10628873pzc.60.1671771298497; Thu, 22 Dec 2022 20:54:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671771298; cv=none; d=google.com; s=arc-20160816; b=Hs0ZTASmn2gJPnq7zGXXpBFqyNwUDdkWKMW+o/v874+t0Ld5T2ZvnRIkIUZeu6MRyx A9p7iAlUcg5KBS5fUBff5KBLB99weuMCEsAlA72RlvR0gEyObBfp585wSGmdGn4kSDAa LNTh8vAuRtbfm8RHzNmWLsX/wgivyCyGYP2wdt9MoXA7PlKQwPNHLYBMnUfWzc0n31zV X6/XvuN8IqKL/UZFLXOTPLgb8c7Zs11uo+fb/5FBlHFHCNYZQgh6ASI6F0Pf8mRwQcb0 EC+4oipWegFiwihOq94k3zimkH5FKfrlunP0CJsuVlMSZklX8w3X8ZZPQtlxhbZ/VnAu 4moA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=/czrXMx0+yOWKug1eWTbaeKkELqiS9fL9kORIwNVuck=; b=skINnv5H+ESSkaABOCSaUdY/fmu6hEUxKLhoyOCNzKUzyGaLyPpYrnZ/IIyrqOsLSS pZu1p9FxgkH1fYXIJZDEt9OlOg1SwcbBUdw/q8Gic5B/Boo2S7COq60mAHPEpdDRALQJ t5D54zte+c4bl6zew23IywDTt7N0fdfsYZwTfmoPkU+I/gXTBryUj8jaAmTxmKgh0exZ MkLtzBUNWfTeR7gck+HEvckdz8jC7HW/E0+l1v5UQLuVHH5Rtf3ObbqVQKYOVKtB4Qh6 MH5c9ggXzEnyqGmciEHfVXqejfIiOjPm7Gy6YqaTS7WHHFdvaQOfg1eggc9DlAw61VgR pwMQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c9-20020a630d09000000b0047030c28b16si2519524pgl.184.2022.12.22.20.54.45; Thu, 22 Dec 2022 20:54:58 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235788AbiLWExq (ORCPT <rfc822;pacteraone@gmail.com> + 99 others); Thu, 22 Dec 2022 23:53:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229923AbiLWExd (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 22 Dec 2022 23:53:33 -0500 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52DBC1F2C2; Thu, 22 Dec 2022 20:53:32 -0800 (PST) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4NdZZH0WjKz4f3m6q; Fri, 23 Dec 2022 12:53:27 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP4 (Coremail) with SMTP id gCh0CgDXjbFHNKVjpOduAQ--.93S5; Fri, 23 Dec 2022 12:53:29 +0800 (CST) From: Kemeng Shi <shikemeng@huaweicloud.com> To: axboe@kernel.dk, dwagner@suse.de, hare@suse.de, ming.lei@redhat.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Cc: hch@lst.de, john.garry@huawei.com, shikemeng@huaweicloud.com Subject: [PATCH 03/13] blk-mq: wait on correct sbitmap_queue in blk_mq_mark_tag_wait Date: Fri, 23 Dec 2022 20:52:13 +0800 Message-Id: <20221223125223.1687670-4-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20221223125223.1687670-1-shikemeng@huaweicloud.com> References: <20221223125223.1687670-1-shikemeng@huaweicloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgDXjbFHNKVjpOduAQ--.93S5 X-Coremail-Antispam: 1UD129KBjvJXoW7tF15AF1rKFW7tr4rCFyUWrg_yoW8Xr4DpF 43Cw4jkasaqFWjvFWkta9rC3ZY939xKr93Grs3Cw4Yqr48Grs3XF18uF4UXry0vrs5Ca98 ArWDtryrZw1UX37anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUBK14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2jI8I6cxK62vIxIIY0VWUZVW8XwA2048vs2IY02 0E87I2jVAFwI0_JrWl82xGYIkIc2x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2 F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjx v20xvEc7CjxVAFwI0_Cr0_Gr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E 87Iv6xkF7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64 kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm 72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYx C7MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_ Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUtVW8ZwCIc40Y0x 0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVW8 JVWxJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIx AIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7sRiyCJDUUUUU= = X-CM-SenderInfo: 5vklyvpphqwq5kxd4v5lfo033gof0z/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_00,DATE_IN_FUTURE_06_12, SPF_HELO_NONE,SPF_PASS autolearn=ham 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752979261082366281?= X-GMAIL-MSGID: =?utf-8?q?1752979261082366281?= |
Series |
A few bugfix and cleanup patches for blk-mq
|
|
Commit Message
Kemeng Shi
Dec. 23, 2022, 12:52 p.m. UTC
For shared queues case, we will only wait on bitmap_tags if we fail to get
driver tag. However, rq could be from breserved_tags, then two problems
will occur:
1. io hung if no tag is currently allocated from bitmap_tags.
2. unnecessary wakeup when tag is freed to bitmap_tags while no tag is
freed to breserved_tags.
Wait on the bitmap from which rq from to fix this.
Fixes: f906a6a0f426 ("blk-mq: improve tag waiting setup for non-shared tags")
Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
block/blk-mq.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c index 988812811db9..202975f4d357 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1819,7 +1819,7 @@ static int blk_mq_dispatch_wake(wait_queue_entry_t *wait, unsigned mode, static bool blk_mq_mark_tag_wait(struct blk_mq_hw_ctx *hctx, struct request *rq) { - struct sbitmap_queue *sbq = &hctx->tags->bitmap_tags; + struct sbitmap_queue *sbq; struct wait_queue_head *wq; wait_queue_entry_t *wait; bool ret; @@ -1842,6 +1842,10 @@ static bool blk_mq_mark_tag_wait(struct blk_mq_hw_ctx *hctx, if (!list_empty_careful(&wait->entry)) return false; + if (blk_mq_tag_is_reserved(rq->mq_hctx->sched_tags, rq->internal_tag)) + sbq = &hctx->tags->breserved_tags; + else + sbq = &hctx->tags->bitmap_tags; wq = &bt_wait_ptr(sbq, hctx)->wait; spin_lock_irq(&wq->lock);