Message ID | 20221018014326.467842-3-yukuai1@huaweicloud.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1723960wrs; Mon, 17 Oct 2022 18:25:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7zpEjHEUVsEeZc88nwuZ6oV9EqCKHj16JYSS+p/cmkV3m/FtONFP6geADZYNwoUYUJRg0U X-Received: by 2002:a17:902:ec91:b0:182:8eca:ade2 with SMTP id x17-20020a170902ec9100b001828ecaade2mr488700plg.12.1666056304145; Mon, 17 Oct 2022 18:25:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666056304; cv=none; d=google.com; s=arc-20160816; b=cvzBKngaJWxJyl5huYz0002Xvur4keECC9j8YPmZHt2tKAvGXg3Rztmb3qgAVk2AMn v+foqsGFFxrOanb34fdkE4sME27k2YFhcf7jwvq0yWYH3Ppqqz2xlAzVlnP44X/gUAeQ TKb3LW9+k4IhyxNP/Wsx4gvE6YX7I/Je1lSxuj1C9hNiQ4D99P1JIPoAZnmzGgZLZm6W xyfDx4dfA0Btpt7+IqiqdFComtIEMOizh2/znGfow0NiPh8Ycc/sMAvgph8bPmnBD/+C AIzEQ+npcEjgSF/aUtljj5/6GWqbDktlViz2lRyxxDOT6Bga84WSkluZq+IwkG8x113o lnew== 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=E7yJtNx653LqU0oGFGnN24ny0qjGj6ZxXFWnO+yinKg=; b=eWSxZUS76ZGvKj95oFqpqMv5fO9GSg9i1chJeFTErdsTUTgCRyP4YcZTFMBbvaDLk8 xdcLnQb2LU3bVwMFQUbhB/GHmEtlIy+XVGAnEMIQMjnAg9TzsbTrRlLHHcif63H4DV3T nQoVtcO9ibHZkCalSBvpQ24CDy/2NJ61/187+Mb2T3MuDYEcHKGzB36TE6dp5Z6rnFjS 5GLg8KcMt5YhXYG9GOW0h49SrPxTCc0em2kH/wCfKPMb7/gfGCi587c5xpb3o0Z0vAh2 UEFfCsH5ra/BPEHwgODM6OG4wzm6xIlSSMYhPggSFXlVtbv9PalBOP/Hh/s+GawgjJae CW2w== 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 s140-20020a632c92000000b0042b5035d717si13604449pgs.44.2022.10.17.18.24.51; Mon, 17 Oct 2022 18:25:04 -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; 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 S230170AbiJRBVk (ORCPT <rfc822;carlos.wei.hk@gmail.com> + 99 others); Mon, 17 Oct 2022 21:21:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230107AbiJRBVd (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 17 Oct 2022 21:21:33 -0400 Received: from dggsgout12.his.huawei.com (unknown [45.249.212.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1B5A7EFEB; Mon, 17 Oct 2022 18:21:28 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4MrwxQ0n7Nz6R63t; Tue, 18 Oct 2022 09:19:06 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.127.227]) by APP4 (Coremail) with SMTP id gCh0CgAXCzKR_01jxSkfAA--.17823S6; Tue, 18 Oct 2022 09:21:23 +0800 (CST) From: Yu Kuai <yukuai1@huaweicloud.com> To: gregkh@linuxfoundation.org, axboe@kernel.dk, yukuai3@huawei.com Cc: stable@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, yukuai1@huaweicloud.com, yi.zhang@hawei.com Subject: [PATCH 5.10 2/3] blk-wbt: call rq_qos_add() after wb_normal is initialized Date: Tue, 18 Oct 2022 09:43:25 +0800 Message-Id: <20221018014326.467842-3-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221018014326.467842-1-yukuai1@huaweicloud.com> References: <20221018014326.467842-1-yukuai1@huaweicloud.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgAXCzKR_01jxSkfAA--.17823S6 X-Coremail-Antispam: 1UD129KBjvJXoWxAFyrWryfZr15ZFWrWFW7urg_yoW5Xr4kpa y2kFW5tr42grs2vF4xJr47ZFW3Kws5Jry7ur43G3yFqr9rKryjvanagF15W34rArWkCF43 tr1FvFZ8GFyUZ37anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUU9m14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_Jryl82xGYIkIc2 x26xkF7I0E14v26r4j6ryUM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2z4x0 Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F4UJw A2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq3wAS 0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2 IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0 Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCF04k20xvY0x0EwIxGrwCFx2 IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v2 6r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67 AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IY s7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr 0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUc6pPUUUUU= X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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?1746986655652766865?= X-GMAIL-MSGID: =?utf-8?q?1746986655652766865?= |
Series |
wbt stable patches
|
|
Commit Message
Yu Kuai
Oct. 18, 2022, 1:43 a.m. UTC
From: Yu Kuai <yukuai3@huawei.com> commit 8c5035dfbb9475b67c82b3fdb7351236525bf52b upstream. Our test found a problem that wbt inflight counter is negative, which will cause io hang(noted that this problem doesn't exist in mainline): t1: device create t2: issue io add_disk blk_register_queue wbt_enable_default wbt_init rq_qos_add // wb_normal is still 0 /* * in mainline, disk can't be opened before * bdev_add(), however, in old kernels, disk * can be opened before blk_register_queue(). */ blkdev_issue_flush // disk size is 0, however, it's not checked submit_bio_wait submit_bio blk_mq_submit_bio rq_qos_throttle wbt_wait bio_to_wbt_flags rwb_enabled // wb_normal is 0, inflight is not increased wbt_queue_depth_changed(&rwb->rqos); wbt_update_limits // wb_normal is initialized rq_qos_track wbt_track rq->wbt_flags |= bio_to_wbt_flags(rwb, bio); // wb_normal is not 0,wbt_flags will be set t3: io completion blk_mq_free_request rq_qos_done wbt_done wbt_is_tracked // return true __wbt_done wbt_rqw_done atomic_dec_return(&rqw->inflight); // inflight is decreased commit 8235b5c1e8c1 ("block: call bdev_add later in device_add_disk") can avoid this problem, however it's better to fix this problem in wbt: 1) Lower kernel can't backport this patch due to lots of refactor. 2) Root cause is that wbt call rq_qos_add() before wb_normal is initialized. Fixes: e34cbd307477 ("blk-wbt: add general throttling mechanism") Cc: <stable@vger.kernel.org> Signed-off-by: Yu Kuai <yukuai3@huawei.com> Link: https://lore.kernel.org/r/20220913105749.3086243-1-yukuai1@huaweicloud.com Signed-off-by: Jens Axboe <axboe@kernel.dk> --- block/blk-wbt.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
Comments
On Tue, Oct 18, 2022 at 09:43:25AM +0800, Yu Kuai wrote: > From: Yu Kuai <yukuai3@huawei.com> > > commit 8c5035dfbb9475b67c82b3fdb7351236525bf52b upstream. I need a 5.15 version of this, and the 3/3 patch in order to be able to apply the 5.10.y version. Can you please send that, and then resend the remaining patches here for 5.10.y? thanks, greg k-h
Hi, 在 2022/10/27 0:47, Greg KH 写道: > On Tue, Oct 18, 2022 at 09:43:25AM +0800, Yu Kuai wrote: >> From: Yu Kuai <yukuai3@huawei.com> >> >> commit 8c5035dfbb9475b67c82b3fdb7351236525bf52b upstream. > > I need a 5.15 version of this, and the 3/3 patch in order to be able to > apply the 5.10.y version. > > Can you please send that, and then resend the remaining patches here for > 5.10.y? Yes, I can do that. By the way, just to confirm: I already saw that patch 2,3 is queued: [PATCH 5.15 122/530] blk-wbt: call rq_qos_add() after wb_normal is initialized [PATCH 5.15 519/530] blk-wbt: fix that rwb->wc is always set to 1 in wbt_init() Do I still need to send a 5.15 version? Thanks, Kuai > > thanks, > > greg k-h > . >
On Thu, Oct 27, 2022 at 07:28:26PM +0800, Yu Kuai wrote: > Hi, > > 在 2022/10/27 0:47, Greg KH 写道: > > On Tue, Oct 18, 2022 at 09:43:25AM +0800, Yu Kuai wrote: > > > From: Yu Kuai <yukuai3@huawei.com> > > > > > > commit 8c5035dfbb9475b67c82b3fdb7351236525bf52b upstream. > > > > I need a 5.15 version of this, and the 3/3 patch in order to be able to > > apply the 5.10.y version. > > > > Can you please send that, and then resend the remaining patches here for > > 5.10.y? > > Yes, I can do that. By the way, just to confirm: > > I already saw that patch 2,3 is queued: > > [PATCH 5.15 122/530] blk-wbt: call rq_qos_add() after wb_normal is > initialized > [PATCH 5.15 519/530] blk-wbt: fix that rwb->wc is always set to 1 in > wbt_init() > > Do I still need to send a 5.15 version? Not if it is already in the tree, no. thanks, greg k-h
diff --git a/block/blk-wbt.c b/block/blk-wbt.c index 4ec0a018a2ad..bafdb8098893 100644 --- a/block/blk-wbt.c +++ b/block/blk-wbt.c @@ -840,6 +840,10 @@ int wbt_init(struct request_queue *q) rwb->enable_state = WBT_STATE_ON_DEFAULT; rwb->wc = 1; rwb->rq_depth.default_depth = RWB_DEF_DEPTH; + rwb->min_lat_nsec = wbt_default_latency_nsec(q); + + wbt_queue_depth_changed(&rwb->rqos); + wbt_set_write_cache(q, test_bit(QUEUE_FLAG_WC, &q->queue_flags)); /* * Assign rwb and add the stats callback. @@ -847,10 +851,5 @@ int wbt_init(struct request_queue *q) rq_qos_add(q, &rwb->rqos); blk_stat_add_callback(q, rwb->cb); - rwb->min_lat_nsec = wbt_default_latency_nsec(q); - - wbt_queue_depth_changed(&rwb->rqos); - wbt_set_write_cache(q, test_bit(QUEUE_FLAG_WC, &q->queue_flags)); - return 0; }