From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751320AbeAEFgv (ORCPT + 1 other); Fri, 5 Jan 2018 00:36:51 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:37108 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751220AbeAEFgu (ORCPT ); Fri, 5 Jan 2018 00:36:50 -0500 Subject: Re: [PATCH] nvme-pci: fix the timeout case when reset is ongoing To: Christoph Hellwig Cc: keith.busch@intel.com, axboe@fb.com, sagi@grimberg.me, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org References: <1514932304-29936-1-git-send-email-jianchao.w.wang@oracle.com> <20180104103546.GA5109@lst.de> From: "jianchao.wang" Message-ID: <496ee23f-2dd2-9c7b-17a2-23fe02ec00e2@oracle.com> Date: Fri, 5 Jan 2018 13:36:11 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20180104103546.GA5109@lst.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8764 signatures=668651 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=844 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1801050072 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: Hi Christoph Many thanks for your kindly response. On 01/04/2018 06:35 PM, Christoph Hellwig wrote: > On Wed, Jan 03, 2018 at 06:31:44AM +0800, Jianchao Wang wrote: >> NVME_CTRL_RESETTING used to indicate the range of nvme initializing >> strictly in fd634f41(nvme: merge probe_work and reset_work), but it >> is not now. The NVME_CTRL_RESETTING is set before queue the >> reset_work, there could be a big gap before the reset work handles >> the outstanding requests. So when the NVME_CTRL_RESETTING is set, >> nvme_timeout will not only meet the admin requests from the >> initializing procedure, but also the IO and admin requests from >> previous work before nvme_dev_disable is invoked. >> >> To fix it, introduce a flag NVME_DEV_FLAG_INITIALIZING to mark the >> range of initializing. When this flag is not set, handle the expried >> requests as nvme_cancel_request. Otherwise, the requests should be >> from the initializing procedure. Handle them as before. Because the >> nvme_reset_work will see the error and disable the dev itself, so >> discard the nvme_dev_disable here. > > Instead of a parallel set of states we'll need to split > NVME_CTRL_RESET into NVME_CTRL_RESET_SCHEDULED and NVME_CTRL_RESETTING. > > And if my memory doesn't fail me we were already considering that a while > ago. > Yes, it is indeed more reasonable to split current NVME_CTRL_RESETTING into two states, but the nvme_dev_disable() in nvme_reset_work() should be the boundary. After that, all the in-flight requests are requeued and request queue is quiesced, the nvme driver is clear. So the new state maybe something like NEW_CTRL_RESET_PREPARE.:) Thanks Jianchao