Received: by 10.223.176.5 with SMTP id f5csp3399751wra; Mon, 29 Jan 2018 12:37:38 -0800 (PST) X-Google-Smtp-Source: AH8x225o8X6ZmtDwtzy0o7Lksp9AhzaTbs6499pm8v/X1M5YRCwRsc79Vq2OkXytWkvK5DGjwkVn X-Received: by 2002:a17:902:148:: with SMTP id 66-v6mr14553540plb.266.1517258258206; Mon, 29 Jan 2018 12:37:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517258258; cv=none; d=google.com; s=arc-20160816; b=LogUncb/Trm7ARvFA127vtpvoVxJMbfLWib9TQKfZtneu6baQcS5mKm7Xfh4tk8jQV fKBQIV9HcsvoziyNNPAN8TGbDYSFX6eQcEFbYQoDjIiCP5o6WgzFDvh9UXEmVkz9HpqN YRxcCu4XICwxlPZCZVLTSQQc1IA/Lbwf4zLLckNJmYVrYK+gk0XJIyyBGSlXC8G/+PvR abQi2IB7IeaTjzwBNiEvAuiKkPvSnOS7sMq1B00o4E54PTQFK/Pw3EZOW7MuErPHFUzr FPUDTaXy6HQLUtXwh2tyVJiTmURk9MWKJvPtPPgeoDsgpT/B0EZ8ed6rbf0mRTVmRj8L HzUQ== 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:arc-authentication-results; bh=Tka4uPBUh/hXjcJOdp8J4RtjYdakIIaIeS86w/XDaBs=; b=g6XA2LeCtakcArlDjRRpS5NL12LRg17sWKhnnwOmHejBp5+w+jVkLu+D/rhifAyiD8 02TYIQ/9mWkFP+tEEiLj4oeg6wvJjY6ZHSEXgomJFf7cILRjB95GkfXUE0vtNuA8dF6E z32uZ2wnVw3mAYTQCldL5HyrDQ2qxh//v1sETD0Yw03WFkOROaPTUvSkpnLCyoMPGD5m sarOuVRJhfOrPUYeDC/hMCtFdkDIPOtKNoqoMOTUpefuv4/fGbWE6wmZMG047yaxinUt C7f9dsgKUvMYcfAhWy9vdzsAcbUKECVRn8yzb42pG0FeG2xvRXe0P2DRT8Jtww4ryCKm u0ow== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f9-v6si376556plo.697.2018.01.29.12.37.23; Mon, 29 Jan 2018 12:37:38 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754170AbeA2UNk (ORCPT + 99 others); Mon, 29 Jan 2018 15:13:40 -0500 Received: from mga02.intel.com ([134.134.136.20]:27327 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932150AbeA2UNh (ORCPT ); Mon, 29 Jan 2018 15:13:37 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Jan 2018 12:13:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,432,1511856000"; d="scan'208";a="27252189" Received: from unknown (HELO localhost.localdomain) ([10.232.112.44]) by orsmga001.jf.intel.com with ESMTP; 29 Jan 2018 12:13:35 -0800 Date: Mon, 29 Jan 2018 13:17:16 -0700 From: Keith Busch To: Sagi Grimberg Cc: Jianchao Wang , axboe@fb.com, hch@lst.de, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] nvme-pci: use NOWAIT flag for nvme_set_host_mem Message-ID: <20180129201716.GB25515@localhost.localdomain> References: <1517195255-21832-1-git-send-email-jianchao.w.wang@oracle.com> <20180129160145.GA25515@localhost.localdomain> <1b7d3700-945f-9272-b6aa-d2ebeaf0cb1e@grimberg.me> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1b7d3700-945f-9272-b6aa-d2ebeaf0cb1e@grimberg.me> 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 Mon, Jan 29, 2018 at 09:55:41PM +0200, Sagi Grimberg wrote: > > Thanks for the fix. It looks like we still have a problem, though. > > Commands submitted with the "shutdown_lock" held need to be able to make > > forward progress without relying on a completion, but this one could > > block indefinitely. > > Can you explain to me why is the shutdown_lock needed to synchronize > nvme_dev_disable? More concretely, how is nvme_dev_disable different > from other places where we rely on the ctrl state to serialize stuff? > > The only reason I see would be to protect against completion-after-abort > scenario but I think the block layer should protect against it (checks > if the request timeout timer fired). We can probably find a way to use the state machine for this. Disabling the controller pre-dates the state machine, and the mutex is there to protect against two actors shutting the controller down at the same time, like a hot removal at the same time as a timeout handling reset.