From nobody Fri Dec 19 17:19:26 2025 Received: from canpmsgout01.his.huawei.com (canpmsgout01.his.huawei.com [113.46.200.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3A6962288C6; Tue, 14 Oct 2025 02:28:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.216 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760408934; cv=none; b=ltXmKShts+NRIyHg1J+x8EQpoNC2b3zl2wI98hLcvGaIT/UPUxEhZuKWiPaPVe7sGVRXJnnJj5kSEmi+5/QPKL81DV7XH92CPZDlgdNo7ZGkh+7f+mFQI/MeVqS2I7Gx2zhH4YXz12Ewqu+L+waTZMmypUgLs//JQ9qDTEdE0EA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760408934; c=relaxed/simple; bh=Noa5rH2LMOKH3rYhMMEz3fMEyP2sjiInFZH2zhJnaJ0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Ocxr4VKogUV5VqAVC6AS2G9MsHwXIjByyip9XVgDDsQBsMsV6/dy1vVTcRjOhdhawQ/R1lbM4VU1QzelNrYTxSbm8EPtikXuRULgAjwqtRDEJqsJWcJJnBOZS0phmO8tpED4+yJ9psUO+dcpYAwJxB3U1FMzJ1FQWzCEZOS5hwM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=KywnTYG0; arc=none smtp.client-ip=113.46.200.216 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="KywnTYG0" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=v5SelAZTA6HduxeSjnW9mQ7hqiKYzrwTzJhzF5+cQiM=; b=KywnTYG0O4BVotFgVEToELJ+Q1MRgdN8KuZcHHKGfnPnSIayuslvgyfwjJeVpz1y+ixNyhDKS Uso9iJEMAOAvSaTK86GgypO2K2DXj82mEEam4RPD2NrjswRTps5XUBHcIIqGxyxmBgfdhHRCoEe K2HSBn2vgVIXIDbPHGGDoRM= Received: from mail.maildlp.com (unknown [172.19.163.48]) by canpmsgout01.his.huawei.com (SkyGuard) with ESMTPS id 4clyn14Hywz1T4Gl; Tue, 14 Oct 2025 10:28:05 +0800 (CST) Received: from kwepemk500007.china.huawei.com (unknown [7.202.194.92]) by mail.maildlp.com (Postfix) with ESMTPS id 4CECB18006C; Tue, 14 Oct 2025 10:28:48 +0800 (CST) Received: from huawei.com (10.50.87.129) by kwepemk500007.china.huawei.com (7.202.194.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 14 Oct 2025 10:28:47 +0800 From: Yu Kuai To: , , , , CC: , , , , , , , Subject: [PATCH 1/4] blk-mq-debugfs: warn about possible deadlock Date: Tue, 14 Oct 2025 10:21:46 +0800 Message-ID: <20251014022149.947800-2-yukuai3@huawei.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20251014022149.947800-1-yukuai3@huawei.com> References: <20251014022149.947800-1-yukuai3@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems100002.china.huawei.com (7.221.188.206) To kwepemk500007.china.huawei.com (7.202.194.92) Content-Type: text/plain; charset="utf-8" Creating new debugfs entries can trigger fs reclaim, hence we can't do this with queue freezed, meanwhile, other locks that can be held while queue is freezed should not be held as well. Signed-off-by: Yu Kuai --- block/blk-mq-debugfs.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c index 4896525b1c05..66864ed0b77f 100644 --- a/block/blk-mq-debugfs.c +++ b/block/blk-mq-debugfs.c @@ -608,9 +608,23 @@ static const struct blk_mq_debugfs_attr blk_mq_debugfs= _ctx_attrs[] =3D { {}, }; =20 -static void debugfs_create_files(struct dentry *parent, void *data, +static void debugfs_create_files(struct request_queue *q, struct dentry *p= arent, + void *data, const struct blk_mq_debugfs_attr *attr) { + /* + * Creating new debugfs entries with queue freezed has the rist of + * deadlock. + */ + WARN_ON_ONCE(q->mq_freeze_depth !=3D 0); + /* + * debugfs_mutex should not be nested under other locks that can be + * grabbed while queue is freezed. + */ + lockdep_assert_not_held(&q->elevator_lock); + lockdep_assert_not_held(&q->rq_qos_mutex); + lockdep_assert_not_held(&q->blkcg_mutex); + if (IS_ERR_OR_NULL(parent)) return; =20 @@ -624,7 +638,7 @@ void blk_mq_debugfs_register(struct request_queue *q) struct blk_mq_hw_ctx *hctx; unsigned long i; =20 - debugfs_create_files(q->debugfs_dir, q, blk_mq_debugfs_queue_attrs); + debugfs_create_files(q, q->debugfs_dir, q, blk_mq_debugfs_queue_attrs); =20 queue_for_each_hw_ctx(q, hctx, i) { if (!hctx->debugfs_dir) @@ -650,7 +664,8 @@ static void blk_mq_debugfs_register_ctx(struct blk_mq_h= w_ctx *hctx, snprintf(name, sizeof(name), "cpu%u", ctx->cpu); ctx_dir =3D debugfs_create_dir(name, hctx->debugfs_dir); =20 - debugfs_create_files(ctx_dir, ctx, blk_mq_debugfs_ctx_attrs); + debugfs_create_files(hctx->queue, ctx_dir, ctx, + blk_mq_debugfs_ctx_attrs); } =20 void blk_mq_debugfs_register_hctx(struct request_queue *q, @@ -666,7 +681,8 @@ void blk_mq_debugfs_register_hctx(struct request_queue = *q, snprintf(name, sizeof(name), "hctx%u", hctx->queue_num); hctx->debugfs_dir =3D debugfs_create_dir(name, q->debugfs_dir); =20 - debugfs_create_files(hctx->debugfs_dir, hctx, blk_mq_debugfs_hctx_attrs); + debugfs_create_files(q, hctx->debugfs_dir, hctx, + blk_mq_debugfs_hctx_attrs); =20 hctx_for_each_ctx(hctx, ctx, i) blk_mq_debugfs_register_ctx(hctx, ctx); @@ -717,7 +733,7 @@ void blk_mq_debugfs_register_sched(struct request_queue= *q) =20 q->sched_debugfs_dir =3D debugfs_create_dir("sched", q->debugfs_dir); =20 - debugfs_create_files(q->sched_debugfs_dir, q, e->queue_debugfs_attrs); + debugfs_create_files(q, q->sched_debugfs_dir, q, e->queue_debugfs_attrs); } =20 void blk_mq_debugfs_unregister_sched(struct request_queue *q) @@ -766,7 +782,8 @@ void blk_mq_debugfs_register_rqos(struct rq_qos *rqos) q->debugfs_dir); =20 rqos->debugfs_dir =3D debugfs_create_dir(dir_name, q->rqos_debugfs_dir); - debugfs_create_files(rqos->debugfs_dir, rqos, rqos->ops->debugfs_attrs); + debugfs_create_files(q, rqos->debugfs_dir, rqos, + rqos->ops->debugfs_attrs); } =20 void blk_mq_debugfs_register_sched_hctx(struct request_queue *q, @@ -789,7 +806,7 @@ void blk_mq_debugfs_register_sched_hctx(struct request_= queue *q, =20 hctx->sched_debugfs_dir =3D debugfs_create_dir("sched", hctx->debugfs_dir); - debugfs_create_files(hctx->sched_debugfs_dir, hctx, + debugfs_create_files(q, hctx->sched_debugfs_dir, hctx, e->hctx_debugfs_attrs); } =20 --=20 2.39.2 From nobody Fri Dec 19 17:19:26 2025 Received: from canpmsgout06.his.huawei.com (canpmsgout06.his.huawei.com [113.46.200.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 896D4304BC1; Tue, 14 Oct 2025 02:28:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.221 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760408938; cv=none; b=lAnF8MH/eG+O9GATJjVAEExGxWlJ21n+IIn20nMH+e/Lns1RKKg6lA7GqfPN0WfdHws2jiQcgny+tfBdvN08zjL5RpQ/xVA6xpZQWUQrREOHzmiaYTfoTH9qrgCupake51eDRPRO/S5uTCaQeGYyeWlPbtI0kNBDXwZOz9VsvAk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760408938; c=relaxed/simple; bh=pDgBsjcnO4PnoDSdWUg8hLSZaLLNuu6oc+5r6/FtMtw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Yq4JWa6fmIzxDsN7OOGt1IyBA9GWLBbw+oX2ddoqrNoVrv9fqhq7VppQg2eqY0ewD2RRaSte4hJgEhYVHQOR1nxk7wRv2JtYUK4vqP75/8IA7Dfttt9wcO6+BXzPnrnN/JunnS7/a7AYbkR8gpSeaLQohuc+D2Ffdo1jhyFevuk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=QJjqvb51; arc=none smtp.client-ip=113.46.200.221 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="QJjqvb51" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=YNcTBLxNG3SN4ulnOBC7R6JQgBkk1lAYrEhvD/MrSlI=; b=QJjqvb51wkZRnZf2+O8o9/f+GaH76SPXEuHsQCFheLJ1wPJMYsekaYXpZhWTs/Qy1sfDB0HML jzCNY+8SXlBTKTw1MUOdK5OGZhcTwCO57x6zXZflSU7FMlAqEYYEL+gPJ7yH7LKLdCjoaYYvWk0 7lLjHUOL9jiuISR5hJGu+XI= Received: from mail.maildlp.com (unknown [172.19.163.48]) by canpmsgout06.his.huawei.com (SkyGuard) with ESMTPS id 4clynT19KzzRhR0; Tue, 14 Oct 2025 10:28:29 +0800 (CST) Received: from kwepemk500007.china.huawei.com (unknown [7.202.194.92]) by mail.maildlp.com (Postfix) with ESMTPS id CCF3C18006C; Tue, 14 Oct 2025 10:28:48 +0800 (CST) Received: from huawei.com (10.50.87.129) by kwepemk500007.china.huawei.com (7.202.194.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 14 Oct 2025 10:28:48 +0800 From: Yu Kuai To: , , , , CC: , , , , , , , Subject: [PATCH 2/4] blk-mq-debugfs: factor out a helper blk_mq_debugfs_register_rq_qos() Date: Tue, 14 Oct 2025 10:21:47 +0800 Message-ID: <20251014022149.947800-3-yukuai3@huawei.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20251014022149.947800-1-yukuai3@huawei.com> References: <20251014022149.947800-1-yukuai3@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems100002.china.huawei.com (7.221.188.206) To kwepemk500007.china.huawei.com (7.202.194.92) Content-Type: text/plain; charset="utf-8" Prepare to fix possible deadlock to create blk-mq debugfs entries while queue is still freezed. Signed-off-by: Yu Kuai --- block/blk-mq-debugfs.c | 23 +++++++++++++++-------- block/blk-mq-debugfs.h | 5 +++++ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c index 66864ed0b77f..1de9bab7ba80 100644 --- a/block/blk-mq-debugfs.c +++ b/block/blk-mq-debugfs.c @@ -633,6 +633,20 @@ static void debugfs_create_files(struct request_queue = *q, struct dentry *parent, (void *)attr, data, &blk_mq_debugfs_fops); } =20 +void blk_mq_debugfs_register_rq_qos(struct request_queue *q) +{ + lockdep_assert_held(&q->debugfs_mutex); + + if (q->rq_qos) { + struct rq_qos *rqos =3D q->rq_qos; + + while (rqos) { + blk_mq_debugfs_register_rqos(rqos); + rqos =3D rqos->next; + } + } +} + void blk_mq_debugfs_register(struct request_queue *q) { struct blk_mq_hw_ctx *hctx; @@ -645,14 +659,7 @@ void blk_mq_debugfs_register(struct request_queue *q) blk_mq_debugfs_register_hctx(q, hctx); } =20 - if (q->rq_qos) { - struct rq_qos *rqos =3D q->rq_qos; - - while (rqos) { - blk_mq_debugfs_register_rqos(rqos); - rqos =3D rqos->next; - } - } + blk_mq_debugfs_register_rq_qos(q); } =20 static void blk_mq_debugfs_register_ctx(struct blk_mq_hw_ctx *hctx, diff --git a/block/blk-mq-debugfs.h b/block/blk-mq-debugfs.h index c80e453e3014..9f76603792fe 100644 --- a/block/blk-mq-debugfs.h +++ b/block/blk-mq-debugfs.h @@ -34,6 +34,7 @@ void blk_mq_debugfs_register_sched_hctx(struct request_qu= eue *q, void blk_mq_debugfs_unregister_sched_hctx(struct blk_mq_hw_ctx *hctx); =20 void blk_mq_debugfs_register_rqos(struct rq_qos *rqos); +void blk_mq_debugfs_register_rq_qos(struct request_queue *q); void blk_mq_debugfs_unregister_rqos(struct rq_qos *rqos); #else static inline void blk_mq_debugfs_register(struct request_queue *q) @@ -78,6 +79,10 @@ static inline void blk_mq_debugfs_register_rqos(struct r= q_qos *rqos) { } =20 +static inline void blk_mq_debugfs_register_rq_qos(struct request_queue *q) +{ +} + static inline void blk_mq_debugfs_unregister_rqos(struct rq_qos *rqos) { } --=20 2.39.2 From nobody Fri Dec 19 17:19:26 2025 Received: from canpmsgout01.his.huawei.com (canpmsgout01.his.huawei.com [113.46.200.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B7F42E975E; Tue, 14 Oct 2025 02:28:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.216 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760408933; cv=none; b=r0CHAlQpL3r1tQKm6PkmS/sKdzDK36GWgzyXl+qYOfOu1UfbGUMRiITbN2a6H4CJjNwqFm6TDXDkxeHYkTFBgUO7FLCXDzJ/QdJ48LeYVsOkb/Q3uBPhJFI2mbr8BecJCjpPbBeCUZj3Y7eqjObANpVT+zMaclxCvqi8wEGvf5Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760408933; c=relaxed/simple; bh=NPxRRzFtScXdG9auhMZ3j0+iJAE7hIaDhucri088R14=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Ci6yjW9jBj6laJO++oRirE8IaEfaMaQGAhV6NWKKtVfzP4GzdXGZiWLwQ+Q/YbOnVSIlPqw13r0Q3srMZttVACivreF6kzs67WXYstGbdWe1WRwokF2sLEhL+gEEAydysMavrAfm45x/vUne0PYVCSfVCCn+bHBGHwR4V+0/tio= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=DjaLYW3U; arc=none smtp.client-ip=113.46.200.216 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="DjaLYW3U" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=U1hjB0qTtrdjgi/WXA5posceqyaZ4D57rjh6XcurGsw=; b=DjaLYW3UfNLtiO0wkrTsZlMza+8vAf7L/7ez1+ObIkBe4xfIU+dtPLZbs6TNqON815iKa9nKe MCfB0G5zr5pkYilRr6+Cf9rDKdoMTqRNPwLPKKPxk7KW3ajS9dk3VpUEhwOA+oS6OEKHWvJxvV/ x2U3YKqJ1BhlsH+phQv75MA= Received: from mail.maildlp.com (unknown [172.19.88.105]) by canpmsgout01.his.huawei.com (SkyGuard) with ESMTPS id 4clyn246wCz1T4Gl; Tue, 14 Oct 2025 10:28:06 +0800 (CST) Received: from kwepemk500007.china.huawei.com (unknown [7.202.194.92]) by mail.maildlp.com (Postfix) with ESMTPS id 495A51402DA; Tue, 14 Oct 2025 10:28:49 +0800 (CST) Received: from huawei.com (10.50.87.129) by kwepemk500007.china.huawei.com (7.202.194.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 14 Oct 2025 10:28:48 +0800 From: Yu Kuai To: , , , , CC: , , , , , , , Subject: [PATCH 3/4] blk-rq-qos: fix possible deadlock Date: Tue, 14 Oct 2025 10:21:48 +0800 Message-ID: <20251014022149.947800-4-yukuai3@huawei.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20251014022149.947800-1-yukuai3@huawei.com> References: <20251014022149.947800-1-yukuai3@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems100002.china.huawei.com (7.221.188.206) To kwepemk500007.china.huawei.com (7.202.194.92) Content-Type: text/plain; charset="utf-8" Currently rq-qos debugfs entries is created from rq_qos_add(), while rq_qos_add() requires queue to be freezed. This can deadlock because creating new entries can trigger fs reclaim. Fix this problem by delaying creating rq-qos debugfs entries until it's initialization is complete. - For wbt, it can be initialized by default of by blk-sysfs, fix it by calling blk_mq_debugfs_register_rq_qos() after wbt_init; - For other policies, they can only be initialized by blkg configuration, fix it by calling blk_mq_debugfs_register_rq_qos() from blkg_conf_end(); Signed-off-by: Yu Kuai --- block/blk-cgroup.c | 6 ++++++ block/blk-rq-qos.c | 7 ------- block/blk-sysfs.c | 4 ++++ block/blk-wbt.c | 7 ++++++- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index d93654334854..e4ccabf132c0 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -33,6 +33,7 @@ #include "blk-cgroup.h" #include "blk-ioprio.h" #include "blk-throttle.h" +#include "blk-mq-debugfs.h" =20 static void __blkcg_rstat_flush(struct blkcg *blkcg, int cpu); =20 @@ -746,6 +747,11 @@ void blkg_conf_end(struct blkg_conf_ctx *ctx) mutex_unlock(&q->elevator_lock); blk_mq_unfreeze_queue(q, ctx->memflags); blkdev_put_no_open(ctx->bdev); + + mutex_lock(&q->debugfs_mutex); + blk_mq_debugfs_register_rq_qos(q); + mutex_unlock(&q->debugfs_mutex); + } EXPORT_SYMBOL_GPL(blkg_conf_end); =20 diff --git a/block/blk-rq-qos.c b/block/blk-rq-qos.c index 654478dfbc20..d7ce99ce2e80 100644 --- a/block/blk-rq-qos.c +++ b/block/blk-rq-qos.c @@ -347,13 +347,6 @@ int rq_qos_add(struct rq_qos *rqos, struct gendisk *di= sk, enum rq_qos_id id, blk_queue_flag_set(QUEUE_FLAG_QOS_ENABLED, q); =20 blk_mq_unfreeze_queue(q, memflags); - - if (rqos->ops->debugfs_attrs) { - mutex_lock(&q->debugfs_mutex); - blk_mq_debugfs_register_rqos(rqos); - mutex_unlock(&q->debugfs_mutex); - } - return 0; ebusy: blk_mq_unfreeze_queue(q, memflags); diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 76c47fe9b8d6..52bb4db25cf5 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -688,6 +688,10 @@ static ssize_t queue_wb_lat_store(struct gendisk *disk= , const char *page, mutex_unlock(&disk->rqos_state_mutex); =20 blk_mq_unquiesce_queue(q); + + mutex_lock(&q->debugfs_mutex); + blk_mq_debugfs_register_rq_qos(q); + mutex_unlock(&q->debugfs_mutex); out: blk_mq_unfreeze_queue(q, memflags); =20 diff --git a/block/blk-wbt.c b/block/blk-wbt.c index eb8037bae0bd..a120b5ba54db 100644 --- a/block/blk-wbt.c +++ b/block/blk-wbt.c @@ -724,8 +724,13 @@ void wbt_enable_default(struct gendisk *disk) if (!blk_queue_registered(q)) return; =20 - if (queue_is_mq(q) && enable) + if (queue_is_mq(q) && enable) { wbt_init(disk); + + mutex_lock(&q->debugfs_mutex); + blk_mq_debugfs_register_rq_qos(q); + mutex_unlock(&q->debugfs_mutex); + } } EXPORT_SYMBOL_GPL(wbt_enable_default); =20 --=20 2.39.2 From nobody Fri Dec 19 17:19:26 2025 Received: from canpmsgout06.his.huawei.com (canpmsgout06.his.huawei.com [113.46.200.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CCF142288C6; Tue, 14 Oct 2025 02:28:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.221 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760408939; cv=none; b=VSzkeJkvXk1GZRfs4K4/LPaBTj4WWgC6e4nKT8s2UJ+iTl7SPgEU2cU4l0UeUNpL0siPjU4VCwOmgRcE2B7/e5n7nhUe2e4ON1FGYsJ5czW+V56AlnIf5hTrCcL/1NyCx630WsWXr/Dvug4Tycz5xYsh/1cHNE3MLJpy5Qr3R/8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760408939; c=relaxed/simple; bh=t4TmkTnxBxFsPMMgCpLUCqQfV3Ld9evdSq4pBq4ykKg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=XZuN+2YSGqf7N69Uh7krFOWYBo6OO28lbiNTDL/ij/PUxfp/qCie2ChRatr11pbApXHTLvXqWso2zPdMR2FvS9Ct253hymYx5nNEdQEvY7YY4wKjxRKopi3DfF+9z1208j9qjHDzQ79Y2Agl7FoU0ytJRa550odSBQUJf+ovO1E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=dOP6xvqW; arc=none smtp.client-ip=113.46.200.221 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="dOP6xvqW" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=L1Y/dJ23z38rGLpMWBLQrEYtDiYGHHrj1WObdSKChYM=; b=dOP6xvqWwTiLG2O3TkqkahCHEdT60fKJv3t7U06dAwnPUsCh1cbGNi3f50NYAa1AZvwBXu5io lKgcF4rxEB2cZOIs5txAQHmZs3BJ4njib76cWOU0GkvI3tLGV1wdvUan0Qk9g0TZYUIomiwDC3o w4NRyeLlSGyBDGqnjnYBtvg= Received: from mail.maildlp.com (unknown [172.19.88.194]) by canpmsgout06.his.huawei.com (SkyGuard) with ESMTPS id 4clynV0xygzRhR0; Tue, 14 Oct 2025 10:28:30 +0800 (CST) Received: from kwepemk500007.china.huawei.com (unknown [7.202.194.92]) by mail.maildlp.com (Postfix) with ESMTPS id C51F91401E0; Tue, 14 Oct 2025 10:28:49 +0800 (CST) Received: from huawei.com (10.50.87.129) by kwepemk500007.china.huawei.com (7.202.194.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 14 Oct 2025 10:28:49 +0800 From: Yu Kuai To: , , , , CC: , , , , , , , Subject: [PATCH 4/4] blk-mq-debugfs: make blk_mq_debugfs_register_rqos() static Date: Tue, 14 Oct 2025 10:21:49 +0800 Message-ID: <20251014022149.947800-5-yukuai3@huawei.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20251014022149.947800-1-yukuai3@huawei.com> References: <20251014022149.947800-1-yukuai3@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems100002.china.huawei.com (7.221.188.206) To kwepemk500007.china.huawei.com (7.202.194.92) Content-Type: text/plain; charset="utf-8" Because it's only used inside blk-mq-debugfs.c now. Signed-off-by: Yu Kuai --- block/blk-mq-debugfs.c | 4 +++- block/blk-mq-debugfs.h | 5 ----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c index 1de9bab7ba80..919e484aa1b2 100644 --- a/block/blk-mq-debugfs.c +++ b/block/blk-mq-debugfs.c @@ -14,6 +14,8 @@ #include "blk-mq-sched.h" #include "blk-rq-qos.h" =20 +static void blk_mq_debugfs_register_rqos(struct rq_qos *rqos); + static int queue_poll_stat_show(void *data, struct seq_file *m) { return 0; @@ -774,7 +776,7 @@ void blk_mq_debugfs_unregister_rqos(struct rq_qos *rqos) rqos->debugfs_dir =3D NULL; } =20 -void blk_mq_debugfs_register_rqos(struct rq_qos *rqos) +static void blk_mq_debugfs_register_rqos(struct rq_qos *rqos) { struct request_queue *q =3D rqos->disk->queue; const char *dir_name =3D rq_qos_id_to_name(rqos->id); diff --git a/block/blk-mq-debugfs.h b/block/blk-mq-debugfs.h index 9f76603792fe..d94daa66556b 100644 --- a/block/blk-mq-debugfs.h +++ b/block/blk-mq-debugfs.h @@ -33,7 +33,6 @@ void blk_mq_debugfs_register_sched_hctx(struct request_qu= eue *q, struct blk_mq_hw_ctx *hctx); void blk_mq_debugfs_unregister_sched_hctx(struct blk_mq_hw_ctx *hctx); =20 -void blk_mq_debugfs_register_rqos(struct rq_qos *rqos); void blk_mq_debugfs_register_rq_qos(struct request_queue *q); void blk_mq_debugfs_unregister_rqos(struct rq_qos *rqos); #else @@ -75,10 +74,6 @@ static inline void blk_mq_debugfs_unregister_sched_hctx(= struct blk_mq_hw_ctx *hc { } =20 -static inline void blk_mq_debugfs_register_rqos(struct rq_qos *rqos) -{ -} - static inline void blk_mq_debugfs_register_rq_qos(struct request_queue *q) { } --=20 2.39.2