From patchwork Tue Jul 4 07:55:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sagi Grimberg X-Patchwork-Id: 9824265 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 87D6360237 for ; Tue, 4 Jul 2017 07:56:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 798642022B for ; Tue, 4 Jul 2017 07:56:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6BA9C2842B; Tue, 4 Jul 2017 07:56:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, URIBL_BLACK autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C5EBC27FB0 for ; Tue, 4 Jul 2017 07:56:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752300AbdGDH4Y (ORCPT ); Tue, 4 Jul 2017 03:56:24 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:52134 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752297AbdGDH4X (ORCPT ); Tue, 4 Jul 2017 03:56:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=qqJrG+uOBrUDgkh4Q9XqRyTmPh07Eg1kCF1pIkqTv3E=; b=lmQ4FULjoWUFCBcZFDjxyyQ+6 WeiK1mLgw1azqJahMUeR7R46T6D8bgTPN00uSWrCqfEqH3mlAGZEs6jTcW2BAxEaaAgRiR8rua0Je SeFFJLfJNKI1h4p5ucCTfyP47URnHEw2Bn9qI+sSGoNJxeT3nEQbgI/bqWIDKHAKJ2t+BE6MxTmup u3HqPLZvz5d6+/WM8fUBiDuaudPyVJZ+O9lA0pBpw0Id57YLSInbJhkqQt6g4Ve0LHpDvhk4vfbl8 T6QXaouRlhUwEKJlIYBQ/crNfZ+ijbP5ca0JnH20vjzmxdWWUl9lnyBMXPVorGb9Xb6hLMABIzDnc Ko8r/wgfg==; Received: from bzq-82-81-101-184.red.bezeqint.net ([82.81.101.184] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.87 #1 (Red Hat Linux)) id 1dSIh2-0001E3-RT; Tue, 04 Jul 2017 07:56:21 +0000 From: Sagi Grimberg To: Jens Axboe , linux-block@vger.kernel.org, linux-nvme@lists.infradead.org Cc: Christoph Hellwig , Keith Busch , "Michael S . Tsirkin" , Jason Wang Subject: [PATCH 7/8] virtio_blk: quiesce/unquiesce live IO when entering PM states Date: Tue, 4 Jul 2017 10:55:11 +0300 Message-Id: <1499154912-10420-8-git-send-email-sagi@grimberg.me> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1499154912-10420-1-git-send-email-sagi@grimberg.me> References: <1499154912-10420-1-git-send-email-sagi@grimberg.me> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We must make sure that no requests are being queued before we iterate delete vqs. quiesce/unquiesce the request queue istead of start/stop hw queues. Cc: Michael S. Tsirkin Cc: Jason Wang Signed-off-by: Sagi Grimberg Reviewed-by: Ming Lei Acked-by: Michael S. Tsirkin --- drivers/block/virtio_blk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 0297ad7c1452..4e02aa5fdac0 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -840,7 +840,7 @@ static int virtblk_freeze(struct virtio_device *vdev) /* Make sure no work handler is accessing the device. */ flush_work(&vblk->config_work); - blk_mq_stop_hw_queues(vblk->disk->queue); + blk_mq_quiesce_queue(vblk->disk->queue); vdev->config->del_vqs(vdev); return 0; @@ -857,7 +857,7 @@ static int virtblk_restore(struct virtio_device *vdev) virtio_device_ready(vdev); - blk_mq_start_stopped_hw_queues(vblk->disk->queue, true); + blk_mq_unquiesce_queue(vblk->disk->queue); return 0; } #endif