Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1271043rdb; Wed, 24 Jan 2024 09:44:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IFjRPX1rWG29QvEbNWcW3oPwflYWI12SPG1AMxso/354bcY5xhA4gaY/aZRSHfj7W3fVyXc X-Received: by 2002:a17:90a:d390:b0:290:3e62:92ab with SMTP id q16-20020a17090ad39000b002903e6292abmr4362359pju.29.1706118272260; Wed, 24 Jan 2024 09:44:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706118272; cv=pass; d=google.com; s=arc-20160816; b=SP7nPcUShdh/9kIMl1YjbgxEeLfNiM15qjeqOjO4knh8y22qH7LL3O8T0Rt1uz6pQy 5YW2fgywHFMIfQ9PqfakbDEkxn2Xo0JJE9/jpCGnD+H1uBZWoHz6T7R1U62JJ9KunZrV hhsWmu9gqTvcYDevGoRTRdq5Q2mc3ruXvMqGs4uVFrbUN5DUzVXbjl5iCQLVgqX6PG1G JEiCtDgo+lWP+Nriy634R/1gjv8eribcri2h4C1llQsg+1nlNL7MkonyniRUWOmOmAi7 BwXwEQ1PvNX3wSudCYNe19LwCZnvoW1SxXrH9cdZXpuVTsQtH/eJ18u1/xgJEWuC4P4p QNIA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=4xHf9FtEdRL2opxEv3vR3mU1cioPfDsZiWunTk1Ta3Q=; fh=2oO1CfEupecFEv47TO6xwCJIotGOKXu5t9R8ttPWc7s=; b=G9oEWjILQtQL/GfDEx+RYftdidofsIHpdKYHk9eqXBcesMXEA+PtdY751wLfhuF26L BJSE/dj3o1KH/fl17qYsPyAoh8ziTK8cwW6tZtTJ5U5m0SZKV7+7TAHrldxXmpITCNYt a3WCMXlMzDAVXwL0eNj8EY4ovsVHRfPtlP2Bp8M44GrWV4HW1CeybsGpJ4X9hGH8YhIq TyYSFfs3WkWRuaS+b8Z9dv+g4ZOhSawIpOBeKb7M5nV0ruIXdPiojNfQDBLtTN1N9gFi s3L5kUZYK/JRjbDDqzpkDozgs2tknJ0LTvqOVE/iOxqfsJMQt958Xc9j1oCYXuwciOti qSlQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Hk7GwTob; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-37411-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37411-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id gk4-20020a17090b118400b0028af3016cc4si11990142pjb.37.2024.01.24.09.44.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 09:44:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-37411-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Hk7GwTob; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-37411-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37411-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 81E45B238D8 for ; Wed, 24 Jan 2024 17:17:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8E1D07E77D; Wed, 24 Jan 2024 17:17:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Hk7GwTob" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 9896D7E789; Wed, 24 Jan 2024 17:17:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706116636; cv=none; b=mHE+YB8jWT1SSnX/QpxXGb8Pef4iQfMani8VCRSKvAjbaOGopdD26rU497CZaDunFVILjJMo0ZUlYqwjdwWmfQQpPxIVLrSqmSAtCnG7D4k8UWnVgXjK/thMvOuLIPnPz+YrdD1r6b7NSRj2BrFkysOZBMHUJk/LK+gx7ZC7UV0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706116636; c=relaxed/simple; bh=p0ABOTonvB4mJUph9gKMNiWtDvBfGNCitra/es/MHtA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=l8RKBiVaMMqZX4ESjnrOFdLDVeIam87eGlrniD9gIsDyUhbJtVtrWQFinRlUP2UQLqT/1mDQqBoyQ1+o5QzF8uppJ+0GdrffMY3bqrCgPQ2nBigr8iIUryRLoOoZzAXk5p0zfhIIHXu/lYw8s0diohXRori4FxSHVUS6JVd/X+4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Hk7GwTob; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 209FFC433C7; Wed, 24 Jan 2024 17:17:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706116636; bh=p0ABOTonvB4mJUph9gKMNiWtDvBfGNCitra/es/MHtA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Hk7GwTobXn7xyt7w06YZeO9sMIEa3ZpumgsuZKpZOVyStpMOEPFgGAZBNBxTlsGuA 0+HHeyAyYHDpmcWVykxEooVOrNCmqqlFFkh1j3IqTtJyMV/AZ/y6jv58hGVa/6owrv yEM+RbnRFtxYESZRKBDsxx853WweEjbLlziY7ErXmnICX+BpMOpE2r71qfF9pT7oP7 eYrl9W9nCVVPs/pT80qrjXNBdg4Ua0ZY6hRqkaRxq+VD2aCQLB1jbnoAQm4cbdEM4J mXq5vzM7HJ0Wa0Oy9rrXILAm/IZyZ9CsmgUhHI6vokWYTcUNfL+FYi1QyEbungd4h/ aDayhYE2e3qcg== Date: Wed, 24 Jan 2024 10:17:12 -0700 From: Keith Busch To: yi sun Cc: Yi Sun , axboe@kernel.dk, mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com, pbonzini@redhat.com, stefanha@redhat.com, virtualization@lists.linux.dev, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, zhiguo.niu@unisoc.com, hongyu.jin@unisoc.com Subject: Re: [PATCH 1/2] blk-mq: introduce blk_mq_tagset_wait_request_completed() Message-ID: References: <20240122110722.690223-1-yi.sun@unisoc.com> <20240122110722.690223-2-yi.sun@unisoc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Wed, Jan 24, 2024 at 07:22:21PM +0800, yi sun wrote: > In my case, I want all hw queues owned by this device to be clean. > Because in the virtio device, each hw queue corresponds to a virtqueue, > and all virtqueues will be deleted when vdev suspends. > > The blk_mq_tagset_wait_request_completed() function can ensure that > the device has processed all in_flight requests , and these requests have > become the complete state. I don?t understand the blk_mq_freeze_queue() > function very well. Can the function ensure that all requests have become > complete status? How should I use the function to achieve the same effect? Yeah, just do something like this: --- diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 5bf98fd6a651a..2f69675abdf29 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -1593,14 +1593,14 @@ static int virtblk_freeze(struct virtio_device *vdev) { struct virtio_blk *vblk = vdev->priv; + blk_mq_freeze_queue(vblk->disk->queue); + /* Ensure we don't receive any more interrupts */ virtio_reset_device(vdev); /* Make sure no work handler is accessing the device. */ flush_work(&vblk->config_work); - blk_mq_quiesce_queue(vblk->disk->queue); - vdev->config->del_vqs(vdev); kfree(vblk->vqs); --