Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp3458329ybp; Sun, 6 Oct 2019 12:22:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqz13x+xzA+UypSxWJb5xyW3D4ymnrX/e4yzT9RkhftUGKlSsABNukszMY92y3OBQcY0RF1c X-Received: by 2002:a17:906:3443:: with SMTP id d3mr20851812ejb.156.1570389752479; Sun, 06 Oct 2019 12:22:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570389752; cv=none; d=google.com; s=arc-20160816; b=StxTbMCD8TLufXK81XieqGFv2j1Ylv+R882QXvgTAS77Fb0fkD/7PdwzI0rlEwayRD pzV61+gktH+iVJXKnQZ6HEVftaq+xC/r87a8c+e1kj6rd8w7vzIusXzynRIDorG9PFD6 zdo0uubv9cyJ+s8jpZmhsyzCbTjdThGoSOfzD5V0T4r+8UhMhzRLjaAHz1S+rjGswNWT ACmM7ws/05PySUroW4NftVkjC0kDotAYpBTxLknE81na6SKekhnS81knLyEpiKupIBM7 wV4GJPnQfOWkLezqZx9PiG0GJFwGMGuGU7ZUtq/m7iXZK7C++bjJEa+pX3ItIBH3tv+s 8y6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=nJrlld1qkU3powARfkjc3gpgebY2cnHYIchIhK4g4Ag=; b=MJThH3/z57EPFupILKdqCjBSTh4+tME2eY/Wh6xJ9Nd2K6t7+OApV8apumcGhk7WVQ e3NoPtg0Kj5rFQbTUu8oEo+fX9YJ1ZAn/y2/D0qm5MdX+Maa46O2KzelwV8GlG1zBTXv sktJE/94g6yVVXa4+sLqQ6hU3RsGMyZ0kScxTXz0+/3+oQFIqXq7mEzqs0GEBsx9/VHX F28tDgVE/AjVUvcS+R+pLUdemkVXWpIHYqiAExbMYrYTLBPRUEuRerk+Vg7jONllC77x G/J5qvN7pzpPbZOFNbDct34/bsb6mMVP45pJQZZNRizP8+XoxEE79OwNhjOBHailBVbx HqCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pbUwgqDT; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bt13si6996168edb.245.2019.10.06.12.22.08; Sun, 06 Oct 2019 12:22:32 -0700 (PDT) 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=@kernel.org header.s=default header.b=pbUwgqDT; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726828AbfJFTVO (ORCPT + 99 others); Sun, 6 Oct 2019 15:21:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:46614 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726203AbfJFTVO (ORCPT ); Sun, 6 Oct 2019 15:21:14 -0400 Received: from keith-busch (unknown [8.36.226.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id ACA932077B; Sun, 6 Oct 2019 19:21:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570389673; bh=KGQpWyuNGlR6/YpNIjIUQyU5X4xp21pku07dVF1CvyI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pbUwgqDTxshiTN1hHNE6IJ45J+AU1NjVJtVG/2gImJwC0qss9n51PPXbI1TvguH6C rdzxQJ6w5F1LsH2cwsjBtrF76K6AE//N7Lj8qSM8IXbctVFvy+b/DyQU4VVzsjk8Ft Q3ix9/OjqkJZb1Nj7stlJ2uzHLKAgEckfQFoQly4= Date: Sun, 6 Oct 2019 13:21:11 -0600 From: Keith Busch To: Tyler Ramer Cc: Jens Axboe , Christoph Hellwig , Sagi Grimberg , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] nvme-pci: Shutdown when removing dead controller Message-ID: <20191006192109.GA9983@keith-busch> References: <20191003191354.GA4481@Serenity> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 04, 2019 at 11:36:42AM -0400, Tyler Ramer wrote: > Here's a failure we had which represents the issue the patch is > intended to solve: > > Aug 26 15:00:56 testhost kernel: nvme nvme4: async event result 00010300 > Aug 26 15:01:27 testhost kernel: nvme nvme4: controller is down; will > reset: CSTS=0x3, PCI_STATUS=0x10 > Aug 26 15:02:10 testhost kernel: nvme nvme4: Device not ready; aborting reset > Aug 26 15:02:10 testhost kernel: nvme nvme4: Removing after probe > failure status: -19 > > The CSTS warnings comes from nvme_timeout, and is printed by > nvme_warn_reset. A reset then occurs > Controller state should be NVME_CTRL_RESETTING > > Now, in nvme_reset_work, controller is never marked "CONNECTING" at: > > if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_CONNECTING)) > > because several lines above, we can determine that > nvme_pci_configure_admin_queues returns > a bad result, which triggers a goto out_unlock and prints "removing > after probe failure status: -19" > > Because state is never changed to NVME_CTRL_CONNECTING or > NVME_CTRL_DELETING, the > logic added in https://github.com/torvalds/linux/commit/2036f7263d70e67d70a67899a468588cb7356bc9 > should not apply. Nor should it, because there are no IO in flight at this point, there can't be any timeout work to check the state. > We can further validate that dev->ctrl.state == > NVME_CTRL_RESETTING thanks to > the WARN_ON in nvme_reset_work. I'm not sure I see what this is fixing. Setting the shutdown to true is usually just to get the queues flushed, but the nvme_kill_queues() that we call accomplishes the same thing. > On Thu, Oct 3, 2019 at 3:13 PM Tyler Ramer wrote: > > > > Always shutdown the controller when nvme_remove_dead_controller is > > reached. > > > > It's possible for nvme_remove_dead_controller to be called as part of a > > failed reset, when there is a bad NVME_CSTS. The controller won't > > be comming back online, so we should shut it down rather than just > > disabling. > > > > Signed-off-by: Tyler Ramer > > --- > > drivers/nvme/host/pci.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c > > index c0808f9eb8ab..c3f5ba22c625 100644 > > --- a/drivers/nvme/host/pci.c > > +++ b/drivers/nvme/host/pci.c > > @@ -2509,7 +2509,7 @@ static void nvme_pci_free_ctrl(struct nvme_ctrl *ctrl) > > static void nvme_remove_dead_ctrl(struct nvme_dev *dev) > > { > > nvme_get_ctrl(&dev->ctrl); > > - nvme_dev_disable(dev, false); > > + nvme_dev_disable(dev, true); > > nvme_kill_queues(&dev->ctrl); > > if (!queue_work(nvme_wq, &dev->remove_work)) > > nvme_put_ctrl(&dev->ctrl); > > -- > > 2.23.0 > >