Received: by 10.223.176.46 with SMTP id f43csp547419wra; Thu, 18 Jan 2018 21:59:25 -0800 (PST) X-Google-Smtp-Source: ACJfBov8NHPCshHhd8/pfwiXe5EQ5o9Xpnx08BgsNuUxxFW9SuKeSFjU2PM+voyQrEiwCWYGFZKw X-Received: by 10.98.67.82 with SMTP id q79mr17175381pfa.144.1516341565727; Thu, 18 Jan 2018 21:59:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516341565; cv=none; d=google.com; s=arc-20160816; b=bx1HSPfvRBgm1UOzZLTCCwD6vWDBsSdOdWQ+Zuh+sUDPrSM5kvhy/sPe64mSTY1o/J 62sSAZl6nn4DBPANZWNsC8Q18Req/4e02TQ6vitvan16I+gQ95qLYGetwD3GbN0oR6wy Wt8gcsCqWzh5kRezGkrpnRzfvuWWWYgk4yubCpJR/dtbm0frBbecwgknslf96gQa3LaY sEArZIsIz2/8uGCS0iNY8JFsWmGmcmxb4HXZ8wnx1jhNWsOR1Frt+7tLkNwi/D9VeMGI JrbGA1JolgYnRFLMrxWcnSuaSK60VLAIZlS40CU8H3cyzw6Ag/gZdLCfyvYSdAkyD5AH 25Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=rfeWMm+A88rcXl9/OJKXiChwU9cRNAyBIjXkKy5SiuQ=; b=FmM1mXCHmuPSIw2IwuzZ/GKP+DrwG2uGRiYCI6RY19o7r75uWOOUwrqZLUhPCejqEs 49/wtGMPG/DgydxzhjgKMyb9UW67n/LEVWsvQ2CpMnrMmS5apj2d9GU6nCfXz5fDacDL G8CVUrjUV1hOVh3jZMhfiKA56mo2uFDDnCJLnRoamU4ViTlKOc62dzrh4aeo/k9/izja LyCIgGeWJYNWwF3rP8dEer0xwTp9IJyjHUnBp19NL+x8OFgzdifrq6kMx0+DRm/yedWl 13oK09k/IhczA7lvNqHd4hICyPqby3ky01GP60j6Adv/UWnwSSsON0GrSjAYlJy07Vhn w2gA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=nZwspB2b; 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 g34-v6si560673pld.328.2018.01.18.21.59.12; Thu, 18 Jan 2018 21:59:25 -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=nZwspB2b; 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 S1753649AbeASF6b (ORCPT + 99 others); Fri, 19 Jan 2018 00:58:31 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:60008 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752100AbeASF6I (ORCPT ); Fri, 19 Jan 2018 00:58:08 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w0J5vad1011064; Fri, 19 Jan 2018 05:57:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=rfeWMm+A88rcXl9/OJKXiChwU9cRNAyBIjXkKy5SiuQ=; b=nZwspB2brEdpJaKBs8A1nHGxperBEh30HqZLyzz6Xrwwv9hdcdgOdJvGH/YKwq6c2ZgH 5A7/DimaGDw7ioTIFBiQiHKIQPROjLyn3PQdNfwJRgftHLF859f7SDFJWlYeCZGfbTuD Xn2+Ubt5AfD27kbJMpHsoGQaN15VpP8TpDEWJeQ3r/pGpl1RwGVec/AM0RfNfcBiai4D GttRZxB8+kOnvzjTD+TazuQPck4KcYmQFbWrUugEcto6Ky24SXm3/AwhRavkZq4Fy4At vN+e4i3//5Nf1yEdfI9OjeTF1IngEzp96OpQ0WtSRG53fTiWEz4jVNaQ4mQI/ISpJgT3 3w== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2120.oracle.com with ESMTP id 2fk8tkr8s8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Jan 2018 05:57:37 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w0J5tacf004057 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 19 Jan 2018 05:55:36 GMT Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w0J5tZfa002108; Fri, 19 Jan 2018 05:55:35 GMT Received: from [10.182.70.180] (/10.182.70.180) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 18 Jan 2018 21:55:35 -0800 Subject: Re: [PATCH V5 2/2] nvme-pci: fixup the timeout case when reset is ongoing To: Keith Busch Cc: axboe@fb.com, hch@lst.de, sagi@grimberg.me, maxg@mellanox.com, james.smart@broadcom.com, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org References: <1516270202-8051-1-git-send-email-jianchao.w.wang@oracle.com> <1516270202-8051-3-git-send-email-jianchao.w.wang@oracle.com> <20180119045944.GC12043@localhost.localdomain> From: "jianchao.wang" Message-ID: <0b74b36d-ecb5-e9e2-2900-6dc9c9699658@oracle.com> Date: Fri, 19 Jan 2018 13:55:29 +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: <20180119045944.GC12043@localhost.localdomain> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8778 signatures=668654 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-1801190074 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Keith Thanks for your kindly response and directive. On 01/19/2018 12:59 PM, Keith Busch wrote: > On Thu, Jan 18, 2018 at 06:10:02PM +0800, Jianchao Wang wrote: >> + * - When the ctrl.state is NVME_CTRL_RESETTING, the expired >> + * request should come from the previous work and we handle >> + * it as nvme_cancel_request. >> + * - When the ctrl.state is NVME_CTRL_RECONNECTING, the expired >> + * request should come from the initializing procedure such as >> + * setup io queues, because all the previous outstanding >> + * requests should have been cancelled. >> */ >> - if (dev->ctrl.state == NVME_CTRL_RESETTING) { >> - dev_warn(dev->ctrl.device, >> - "I/O %d QID %d timeout, disable controller\n", >> - req->tag, nvmeq->qid); >> - nvme_dev_disable(dev, false); >> + switch (dev->ctrl.state) { >> + case NVME_CTRL_RESETTING: >> + nvme_req(req)->status = NVME_SC_ABORT_REQ; >> + return BLK_EH_HANDLED; >> + case NVME_CTRL_RECONNECTING: >> + WARN_ON_ONCE(nvmeq->qid); >> nvme_req(req)->flags |= NVME_REQ_CANCELLED; >> return BLK_EH_HANDLED; >> + default: >> + break; >> } > > The driver may be giving up on the command here, but that doesn't mean > the controller has. We can't just end the request like this because that > will release the memory the controller still owns. We must wait until > after nvme_dev_disable clears bus master because we can't say for sure > the controller isn't going to write to that address right after we end > the request. > Yes, but the controller is going to be reseted or shutdown at the moment, even if the controller accesses a bad address and goes wrong, everything will be ok after reset or shutdown. :) Thanks Jianchao