Received: by 10.223.185.116 with SMTP id b49csp2393872wrg; Mon, 12 Feb 2018 08:52:27 -0800 (PST) X-Google-Smtp-Source: AH8x227XLk5DqX2mHuZJ2YHi+GGYlBMstbCsMP7UwMds7dpxVqa1Ks0gclZUN3IZ4yDeaDdkSMHL X-Received: by 2002:a17:902:9306:: with SMTP id bc6-v6mr11124794plb.29.1518454347278; Mon, 12 Feb 2018 08:52:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518454347; cv=none; d=google.com; s=arc-20160816; b=PshUSmAYGElW8DYrTRkswHcmxaJ8KQBzU78FU5EjpnkFM/lhBNTKVCLH1V9PpCKEXx 3Lya1CjX4XIAINyYDrud3eQ57SyBOpqzToBPg2IIdaI5JVlAL6rN/W/3smqUcSIOUQMZ eEWEqiEfrM/2F1V0w6YRUk4uQJxVEtAHNxgpIMfZQ3HMHTQiEHUsJeAgVUDIn3RtjLxb 7cTb/ADrp7i5uG9IwUZj+crIfSspC4w0Zq0p0R6DFk3tb/B3o/C7rnJoxF+CjNwoYV8C AOkLmbKO4rs+2ixqq9RsWPSh7G5KdbK2jpOnl9Qul15TIe6v9TTB/q3vlqdg8kZRFh10 rGXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=WS5kxn9fwWWGYWEmCl2SyJYc+vt2VNlR3cZxmO6ra1c=; b=yCHFK76uJGBViGZnUZQgMON/g8cljJO/LZw62ejWnOloI+inNcFZ7+U76Pxn1zZAf4 dzLTQKJoayna8BSAIxb2WixcrPKAWuT9XR6Gu4/JO3Hx8A09sQf5KQOWL5lqAMGU+m5F m7VUUHSMwIwT+fDcR1DTkkYSlPP/UGe+z2XAgXkQBflNcLu9WVy0OOA4DCwlgDkXJJuU JFKv3k4oGdUEGp07fFPwtSDc6h+hr68ZhjAc6b8axw5K1BmyIKu6eVuQ7qrH7jxZvNV3 QQmjbhR9ji9QetnJdCBXlrKyKiD9vmzlAKLC7aQTwsjWDRHtNIkDGulPWLIY0wHv9Yma EgSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=Y6+FaoyJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b90-v6si4017187plb.429.2018.02.12.08.52.12; Mon, 12 Feb 2018 08:52:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=Y6+FaoyJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935092AbeBLM6G (ORCPT + 99 others); Mon, 12 Feb 2018 07:58:06 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:57022 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934935AbeBLM6A (ORCPT ); Mon, 12 Feb 2018 07:58:00 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w1CCvOVN109853; Mon, 12 Feb 2018 12:57:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2017-10-26; bh=WS5kxn9fwWWGYWEmCl2SyJYc+vt2VNlR3cZxmO6ra1c=; b=Y6+FaoyJYPJ9xWWxKnEO8j5/Yagn9bbauIH8T4p6uxX//TBRchZWaapcaNMMFhmQhR6a M2atpPvrRKFUP1cvBbvjXf90axNeoNyLhsqO/dnnCyj3qA557WRfM1nj7Ecwoy3rU2PP 0UI0vAQNYS5YJrN57fzAs3xcb7nwTy+NCbK6kbM91clGH8gowGN1VR/9uqBzoAayQi15 eQKUnqRvmsTh5KZVNzOB94bXNdVYvMsEWwzUGhGJBC9erEkZKP+Li55IG47m7IELcaaO O1quoXIrsvMtozxh9jt9plU6ZBG3JZQXdJAcVBv9dD4smNGaWOEyz+zHY9Cqa02fqibs yg== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2120.oracle.com with ESMTP id 2g3ahv87a2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Feb 2018 12:57:29 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w1CCvF2Q008612 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 12 Feb 2018 12:57:15 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w1CCvFhl004174; Mon, 12 Feb 2018 12:57:15 GMT Received: from will-ThinkCentre-M910s.cn.oracle.com (/10.182.70.254) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 12 Feb 2018 04:57:15 -0800 From: Jianchao Wang To: keith.busch@intel.com, axboe@fb.com, hch@lst.de, sagi@grimberg.me Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] nvme-pci: quiesce IO queues prior to disabling device HMB accesses Date: Mon, 12 Feb 2018 20:57:24 +0800 Message-Id: <1518440244-696-1-git-send-email-jianchao.w.wang@oracle.com> X-Mailer: git-send-email 2.7.4 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8802 signatures=668668 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802120168 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quiesce IO queues prior to disabling device HMB accesses. A controller using HMB may relay on it to efficiently complete IO commands. Reviewed-by: Keith Busch Reviewed-by: Sagi Grimberg Signed-off-by: Jianchao Wang --- drivers/nvme/host/pci.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index ab9c195..4a7c420 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -2186,7 +2186,11 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown) if (!dead) { if (shutdown) nvme_wait_freeze_timeout(&dev->ctrl, NVME_IO_TIMEOUT); + } + + nvme_stop_queues(&dev->ctrl); + if (!dead) { /* * If the controller is still alive tell it to stop using the * host memory buffer. In theory the shutdown / reset should @@ -2195,11 +2199,6 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown) */ if (dev->host_mem_descs) nvme_set_host_mem(dev, 0); - - } - nvme_stop_queues(&dev->ctrl); - - if (!dead) { nvme_disable_io_queues(dev); nvme_disable_admin_queue(dev, shutdown); } -- 2.7.4