Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp454502rwe; Thu, 1 Sep 2022 02:18:52 -0700 (PDT) X-Google-Smtp-Source: AA6agR5fUwtS0NPqk7T0Dobe2IRnF+HPxYo0wzJL9oJpE6VTnIsd3Rxw3eew3FV+CDGPeJnkiOOr X-Received: by 2002:a63:41c5:0:b0:42c:6b7f:6d95 with SMTP id o188-20020a6341c5000000b0042c6b7f6d95mr12300294pga.175.1662023932000; Thu, 01 Sep 2022 02:18:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662023931; cv=none; d=google.com; s=arc-20160816; b=OxOQuyoKjWwAghNLxrVI3ARs70mE0MrdVvGX2FPclLd/ob6IRsxv7zPx4Gq2ZvHtek jJsn2nCvd7aUybKIURCT5Q5Fk18XjRVmIGPaP0Ci5t2GT8nqwUvN1zPS+0vwhugWXoRA 3iwrI3g4tKreHKZMMQ1eMcjwR3rZQx781cc3pq8uZn1QyIdATwhkLHsHFt32OB0cSbk+ cvnMxG/++qlFgV8OQAy8rDvJck+PH0P+A+OtpYXfQUlYCMhSwFvAGtToxwY+zemwMIHj SLWRva3ajQadyZwtJGz97eAg8AKTR0j1yGrLSRZ7m/sqm1AEuqwdNp29MAN2zLWQ9Yuf FnbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature; bh=Z6ag4bKWdZSgH1KJS0M8aqtbFgZvMF+Dd3fE1Fhurzc=; b=Rrg/MO07v+ABvdFdyLkgMhxHhpkQlSwPp42br4g8Mn4b3cf7QRrNhetYzaHKVsOGLa aB6S9I1QtVF6pMXN2ylBrP9jv5zTpT2x/XYPY26NMT0XF/vI2hVloOkvrLNLcRbXyHD3 tB3ksMHS9Rrm683KOyqX7fqLqlFJV3kALOeUzDQ3x8kninjVrmWcJ6l1qC1rOnanTFR7 +s/W65NZybI+NgZENe9x1JfHQuXevVeiyYPrfPlCm68cC12tqzr1m9uCKXYLWJrJpb6p 8QW0ZQ6Fwecdr+OV+DHof4Ap2oJusb/ulaDUlhJhqQe5ms/zR0OsKjdtRUzgcR3Hpbbc vFAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=GrlE3kXJ; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=ITWjpwic; 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 oc8-20020a17090b1c0800b001fabad2f85asi4673860pjb.120.2022.09.01.02.18.26; Thu, 01 Sep 2022 02:18:51 -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=@suse.cz header.s=susede2_rsa header.b=GrlE3kXJ; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=ITWjpwic; 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 S233368AbiIAIED (ORCPT + 99 others); Thu, 1 Sep 2022 04:04:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233689AbiIAIDk (ORCPT ); Thu, 1 Sep 2022 04:03:40 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B80C121424; Thu, 1 Sep 2022 01:03:39 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 21DFB1FABC; Thu, 1 Sep 2022 08:03:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1662019418; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Z6ag4bKWdZSgH1KJS0M8aqtbFgZvMF+Dd3fE1Fhurzc=; b=GrlE3kXJK5XaNztXjiol8xhRWnO/q2oNokQBJ5Dki9U07tlkHKvk6FKpCUQ+rm57Yh1mcO rPfrYHLsQj60xRPJjvy1SZiTjcLR5nPYxrM9PiRyAJdjnewfd4iPoHJzqsFJtSLV4ohhaF E/bS2ph8ASkTszpxnmOECp3QcDjWhP8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1662019418; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Z6ag4bKWdZSgH1KJS0M8aqtbFgZvMF+Dd3fE1Fhurzc=; b=ITWjpwicbodxcb7+REkcNfh/SvExwUF38cvSBjNhhFZaUL8HxU9rqcO9HIwRhlclMsEebo pfb1borYwHbg7rCQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 0C4EE13A89; Thu, 1 Sep 2022 08:03:38 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 8PP4AlpnEGPJHwAAMHmgww (envelope-from ); Thu, 01 Sep 2022 08:03:38 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id D6D7CA067C; Thu, 1 Sep 2022 10:03:36 +0200 (CEST) Date: Thu, 1 Sep 2022 10:03:36 +0200 From: Jan Kara To: Yu Kuai Cc: Ming Lei , Chris Murphy , Jan Kara , Nikolay Borisov , Jens Axboe , Paolo Valente , Btrfs BTRFS , Linux-RAID , linux-block , linux-kernel , Josef Bacik , "yukuai (C)" Subject: Re: stalling IO regression since linux 5.12, through 5.18 Message-ID: <20220901080336.glpv4i3hyae2zkpk@quack3> References: <568465de-5c3b-4d94-a74b-5b83ce2f942f@www.fastmail.com> <9f2f608a-cd5f-4736-9e6d-07ccc2eca12c@www.fastmail.com> <5426d0f9-6539-477d-8feb-2b49136b960f@www.fastmail.com> <0f731b0a-fbd5-4e7b-a3df-0ed63360c1e0@www.fastmail.com> <297cbb87-87aa-2e1d-1fc3-8e96c241f28f@huaweicloud.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <297cbb87-87aa-2e1d-1fc3-8e96c241f28f@huaweicloud.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On Thu 01-09-22 15:02:03, Yu Kuai wrote: > Hi, Chris > > 在 2022/08/20 15:00, Ming Lei 写道: > > On Fri, Aug 19, 2022 at 03:20:25PM -0400, Chris Murphy wrote: > > > > > > > > > On Thu, Aug 18, 2022, at 1:24 AM, Ming Lei wrote: > > > > On Thu, Aug 18, 2022 at 12:27:04AM -0400, Chris Murphy wrote: > > > > > > > > > > > > > > > On Thu, Aug 18, 2022, at 12:18 AM, Chris Murphy wrote: > > > > > > On Thu, Aug 18, 2022, at 12:12 AM, Chris Murphy wrote: > > > > > > > On Wed, Aug 17, 2022, at 11:41 PM, Ming Lei wrote: > > > > > > > > > > > > > > > OK, can you post the blk-mq debugfs log after you trigger it on v5.17? > > > > > > > > > > Same boot, 3rd log. But the load is above 300 so I kinda need to sysrq+b soon. > > > > > > > > > > https://drive.google.com/file/d/1375H558kqPTdng439rvG6LuXXWPXLToo/view?usp=sharing > > > > > > > > > > > > > Also please test the following one too: > > > > > > > > > > > > diff --git a/block/blk-mq.c b/block/blk-mq.c > > > > index 5ee62b95f3e5..d01c64be08e2 100644 > > > > --- a/block/blk-mq.c > > > > +++ b/block/blk-mq.c > > > > @@ -1991,7 +1991,8 @@ bool blk_mq_dispatch_rq_list(struct blk_mq_hw_ctx > > > > *hctx, struct list_head *list, > > > > if (!needs_restart || > > > > (no_tag && list_empty_careful(&hctx->dispatch_wait.entry))) > > > > blk_mq_run_hw_queue(hctx, true); > > > > - else if (needs_restart && needs_resource) > > > > + else if (needs_restart && (needs_resource || > > > > + blk_mq_is_shared_tags(hctx->flags))) > > > > blk_mq_delay_run_hw_queue(hctx, BLK_MQ_RESOURCE_DELAY); > > > > > > > > blk_mq_update_dispatch_busy(hctx, true); > > > > > > > > > > > > > With just this patch on top of 5.17.0, it still hangs. I've captured block debugfs log: > > > https://drive.google.com/file/d/1ic4YHxoL9RrCdy_5FNdGfh_q_J3d_Ft0/view?usp=sharing > > > > The log is similar with before, and the only difference is RESTART not > > set. > > > > Also follows another patch merged to v5.18 and it fixes io stall too, feel free to test it: > > > > 8f5fea65b06d blk-mq: avoid extending delays of active hctx from blk_mq_delay_run_hw_queues > > Have you tried this patch? > > We meet a similar problem in our test, and I'm pretty sure about the > situation at the scene, > > Our test environment:nvme with bfq ioscheduler, > > How io is stalled: > > 1. hctx1 dispatch rq from bfq in service queue, bfqq becomes empty, > dispatch somehow fails and rq is inserted to hctx1->dispatch, new run > work is queued. > > 2. other hctx tries to dispatch rq, however, in service bfqq is > empty, bfq_dispatch_request return NULL, thus > blk_mq_delay_run_hw_queues is called. > > 3. for the problem described in above patch,run work from "hctx1" > can be stalled. > > Above patch should fix this io stall, however, it seems to me bfq do > have some problems that in service bfqq doesn't expire under following > situation: > > 1. dispatched rqs don't complete > 2. no new rq is issued to bfq And I guess: 3. there are requests queued in other bfqqs ? Otherwise I don't see a point in expiring current bfqq because there's nothing bfq could do anyway. But under normal circumstances the request completion should not take so long so I don't think it would be really worth it to implement some special mechanism for this in bfq. Honza -- Jan Kara SUSE Labs, CR