Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp81537imn; Thu, 28 Jul 2022 23:42:27 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vJ68PJObkbXwkFHhDTgIW3LxCae1OcLjkEFceLZxRSzBEfgPYxKhgflp6HVxk/TWtygwmq X-Received: by 2002:a63:5620:0:b0:41a:4c1e:a821 with SMTP id k32-20020a635620000000b0041a4c1ea821mr1799383pgb.611.1659076946823; Thu, 28 Jul 2022 23:42:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659076946; cv=none; d=google.com; s=arc-20160816; b=bG2OINbkgtgXY7XAWWMsdgEI8KaQyl8CHcltdnbB/Dwsgs6y/6jmD/rXo9Cmt5YfKK OGPyiPBoa3F81GZ+BULmSQ5WTEOrqsuKd0IwbX0R2/6hapdQjBW/e8SpCdoj5loyFVbu XIff6+tUijRR+gemFToXmnBSlQ90NSWKbxaut1R2QriTozT0SH1gtGbPn/ni/Hkrsy2O hFTpN9MMz1OkC8RFvrNZatWU9vMA6LZXqSkkv2YX0Ayee7oYOEB1R28+R8lZyDyaMFaW MB5IhGVkppG0CTpSJQ9JmB5I8OHPLpMWhw8rrrRzXkKTTKgl8i5iumjIkmFI22Tfx13u ykEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=f5U9O5lDOyzgLw4qbaaIw/gFsQUdaQ/fU3IgxmqGAjA=; b=qnavjVPCvCOAQ+9a0uhhELiv/uw2Rx/67JgLGKrJiS8p7mRD7gZeBHlBng2f1HNARz tAT8hZGhHNr1E69snHqYSVhmT318fRklift/KrHCwlSq0mlVzFCpWUEAb9oQVbmUWLfJ TGc3TQ4wP4Y+RA5+QwFy8x2X2cMMJtA+UJKTT9FAQuf6rTzy+diL36yWVf1pOKrFCYpq 2Eam+fKqYiTNrlQzAcK4Nd6GTeV06QRC0UDlPNXYQwFVQhU69FfKj0R8K37/yGRAvvBQ GmSIhyFLaTW120Gtqb04+PyQFc2FacpmMvrJQJMLHmolG6ocOrXztf21GsPlc1Yr3JWV MWJA== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l70-20020a638849000000b0041a911f6f4bsi3045821pgd.461.2022.07.28.23.42.11; Thu, 28 Jul 2022 23:42:26 -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 S234988AbiG2GgU (ORCPT + 99 others); Fri, 29 Jul 2022 02:36:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235245AbiG2GgH (ORCPT ); Fri, 29 Jul 2022 02:36:07 -0400 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F37980F6D; Thu, 28 Jul 2022 23:35:50 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4LvHn23bXWzl405; Fri, 29 Jul 2022 14:34:46 +0800 (CST) Received: from [10.174.176.73] (unknown [10.174.176.73]) by APP3 (Coremail) with SMTP id _Ch0CgDn79PDf+NiMlVHBQ--.51285S3; Fri, 29 Jul 2022 14:35:48 +0800 (CST) Subject: Re: [PATCH v3] blk-mq: fix io hung due to missing commit_rqs To: axboe@kernel.dk Cc: Ming Lei , Yu Kuai , osandov@fb.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, yi.zhang@huawei.com, "yukuai (C)" References: <20220726122224.1790882-1-yukuai1@huaweicloud.com> From: Yu Kuai Message-ID: <1ca6db8a-5780-45c6-064d-dd72c9f274c3@huaweicloud.com> Date: Fri, 29 Jul 2022 14:35:47 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID: _Ch0CgDn79PDf+NiMlVHBQ--.51285S3 X-Coremail-Antispam: 1UD129KBjvJXoW7WFyfuF4UtF48Xr47uFWDtwb_yoW8urW8pF 4xK3Wayan5tr4Utrn7XFW7ZFyFg39xX3y7GryfKw43ZayDKrW0qrs3tw13WFyIkFs5uwnF gF4Dur9Ygw1kArJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkC14x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWUuVWrJwAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_JrI_JrylYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvEwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lc7I2V7IY0VAS07AlzVAY IcxG8wCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14 v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkG c2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6Fyj6rWUJwCI42IY6I8E87Iv67AKxVWUJVW8 JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjfUF9a9DU UUU X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, 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: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Jens Can you please consider this patch for v5.20? Thanks, Kuai ?? 2022/07/27 11:08, Ming Lei ะด??: > On Tue, Jul 26, 2022 at 08:22:24PM +0800, Yu Kuai wrote: >> From: Yu Kuai >> >> Currently, in virtio_scsi, if 'bd->last' is not set to true while >> dispatching request, such io will stay in driver's queue, and driver >> will wait for block layer to dispatch more rqs. However, if block >> layer failed to dispatch more rq, it should trigger commit_rqs to >> inform driver. >> >> There is a problem in blk_mq_try_issue_list_directly() that commit_rqs >> won't be called: >> >> // assume that queue_depth is set to 1, list contains two rq >> blk_mq_try_issue_list_directly >> blk_mq_request_issue_directly >> // dispatch first rq >> // last is false >> __blk_mq_try_issue_directly >> blk_mq_get_dispatch_budget >> // succeed to get first budget >> __blk_mq_issue_directly >> scsi_queue_rq >> cmd->flags |= SCMD_LAST >> virtscsi_queuecommand >> kick = (sc->flags & SCMD_LAST) != 0 >> // kick is false, first rq won't issue to disk >> queued++ >> >> blk_mq_request_issue_directly >> // dispatch second rq >> __blk_mq_try_issue_directly >> blk_mq_get_dispatch_budget >> // failed to get second budget >> ret == BLK_STS_RESOURCE >> blk_mq_request_bypass_insert >> // errors is still 0 >> >> if (!list_empty(list) || errors && ...) >> // won't pass, commit_rqs won't be called >> >> In this situation, first rq relied on second rq to dispatch, while >> second rq relied on first rq to complete, thus they will both hung. >> >> Fix the problem by also treat 'BLK_STS_*RESOURCE' as 'errors' since >> it means that request is not queued successfully. >> >> Same problem exists in blk_mq_dispatch_rq_list(), 'BLK_STS_*RESOURCE' >> can't be treated as 'errors' here, fix the problem by calling >> commit_rqs if queue_rq return 'BLK_STS_*RESOURCE'. >> >> Fixes: d666ba98f849 ("blk-mq: add mq_ops->commit_rqs()") >> Signed-off-by: Yu Kuai > > Reviewed-by: Ming Lei > > Thanks, > Ming > > . >