Received: by 10.223.148.5 with SMTP id 5csp7201517wrq; Thu, 18 Jan 2018 02:15:55 -0800 (PST) X-Google-Smtp-Source: ACJfBov6GZYHeGv81Empc1vcnsEj3c1yTHeNsZC/Ckdj9Sbu0F8g7CWX7uW0X0/yHjZ+IUcPRytO X-Received: by 10.159.194.138 with SMTP id y10mr24735783pln.341.1516270555440; Thu, 18 Jan 2018 02:15:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516270555; cv=none; d=google.com; s=arc-20160816; b=BbxCXupudifRlBdujxgAqfDkxyMHwi/tSoWggHPcdcPwsMieDbuKm4ABazwmIuLBOn N0C6V8SUIdNrCLjhd6SYLu+NYU4MzvF1miOucLMFw2FZJme6S8FDcK7D8olw4tM86GcU AiD/mFyFIaO8/R4EGQAuAd1Pr/U7vAMVstBO3c9UhssyZ9z52q8qMeB8MrfF3LvZodMz KMg70lVOJ5B8Mhj7mKHk6JU4aS4lhibufbOMwTJ+n7G3sGHfUhxKJknNjZj3SBTYjwXy bFQOAUxEOMkrPS8agJ1V4+alGU4NHAQFlA+ZEgVCLl8ug2wtJOlEvmTKs5qiH1DaF5PM 8LvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=cdP1flLoz8Kci09c32SpuG35Raobsa670DtimR568iU=; b=moHnPE5fOZ19THj3W/sVRbHgWAQxJYl/gacDCRYVfmp3iM/Pt3M7yG8j/H2jMj9UyQ iOIa1Ahaz5zBfxxkh4Jf+hbUsBVrSL/4URfJJWzdVWnKRml2rNRmDLDLHvvLqBRnHH5G wrITvCMoqbZNzduoN7QPuiqAkCOYlf/IDPch3Ow2xUG93sUmfUx2aFDU1NqG/jjeQ/cH 9Tnmjen+w6ZNOBIooW1Y2vJnk/A+q6gL1CTCIpyIU2VboJIIGrenJqhQi0ZWMIH7gNLA WhSWmU2eOqvTjSHFoF91TSrTGiPfgDK8ced6LZlNeQ7Qnbo/4DmHL47GagbOh6WVtkbx l5ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=t7NGJUkL; 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 n127si1643787pga.376.2018.01.18.02.15.41; Thu, 18 Jan 2018 02:15:55 -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=t7NGJUkL; 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 S1755595AbeARKLL (ORCPT + 99 others); Thu, 18 Jan 2018 05:11:11 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:56026 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755271AbeARKLH (ORCPT ); Thu, 18 Jan 2018 05:11:07 -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 w0IA8C1R158274; Thu, 18 Jan 2018 10:10:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=cdP1flLoz8Kci09c32SpuG35Raobsa670DtimR568iU=; b=t7NGJUkLUqxPBtmn3/YL4C9LY5BeVPliSaBDgAH/2hNHN/NGur7ITYK19qSvvSJROErQ /3HNUENnJXbyAvoneICHP40aT2W179yNiUvLJh56nDNVln5erJcAG5nd8eqUbXZB8TYW KjoRTvhLpiRKYzkZpYphfFHQ5kH05QjRJqlJjPiZiW/4i90rbFDT+atXD68KwPBPvBZw /VpVQzjJL+Hjv08U/8IM+BXinJ0oRYLvRf0eDLh8dwqoeiphPJ6hj/yAs5Ah/mkfxlED +td283CfwI1p1/Ix86G8R5N1zaUq6f/OjPL6hO0+mosmuu6J04BQFmzbXVKP79ru2mUY rg== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2120.oracle.com with ESMTP id 2fjsjj80dj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 18 Jan 2018 10:10:26 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w0IAAPQl011489 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 18 Jan 2018 10:10:25 GMT Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w0IAAOFC001129; Thu, 18 Jan 2018 10:10:24 GMT Received: from will-ThinkCentre-M910s.cn.oracle.com (/10.182.70.254) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 18 Jan 2018 02:10:24 -0800 From: Jianchao Wang To: keith.busch@intel.com, axboe@fb.com, hch@lst.de, sagi@grimberg.me, maxg@mellanox.com, james.smart@broadcom.com Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V5 1/2] nvme-pci: introduce RECONNECTING state to mark initializing procedure Date: Thu, 18 Jan 2018 18:10:01 +0800 Message-Id: <1516270202-8051-2-git-send-email-jianchao.w.wang@oracle.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516270202-8051-1-git-send-email-jianchao.w.wang@oracle.com> References: <1516270202-8051-1-git-send-email-jianchao.w.wang@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8777 signatures=668653 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-1801180144 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org After Sagi's commit (nvme-rdma: fix concurrent reset and reconnect), both nvme-fc/rdma have following pattern: RESETTING - quiesce blk-mq queues, teardown and delete queues/ connections, clear out outstanding IO requests... RECONNECTING - establish new queues/connections and some other initializing things. Introduce RECONNECTING to nvme-pci transport to do the same mark. Then we get a coherent state definition among nvme pci/rdma/fc transports. Suggested-by: James Smart Signed-off-by: Jianchao Wang --- drivers/nvme/host/core.c | 2 +- drivers/nvme/host/pci.c | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 230cc09..23b3e53 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -242,7 +242,7 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl, switch (new_state) { case NVME_CTRL_ADMIN_ONLY: switch (old_state) { - case NVME_CTRL_RESETTING: + case NVME_CTRL_RECONNECTING: changed = true; /* FALLTHRU */ default: diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 45f843d..05344be 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -1138,9 +1138,14 @@ static bool nvme_should_reset(struct nvme_dev *dev, u32 csts) */ bool nssro = dev->subsystem && (csts & NVME_CSTS_NSSRO); - /* If there is a reset ongoing, we shouldn't reset again. */ - if (dev->ctrl.state == NVME_CTRL_RESETTING) + /* If there is a reset/reinit ongoing, we shouldn't reset again. */ + switch (dev->ctrl.state) { + case NVME_CTRL_RESETTING: + case NVME_CTRL_RECONNECTING: return false; + default: + break; + } /* We shouldn't reset unless the controller is on fatal error state * _or_ if we lost the communication with it. @@ -2304,6 +2309,16 @@ static void nvme_reset_work(struct work_struct *work) if (dev->ctrl.ctrl_config & NVME_CC_ENABLE) nvme_dev_disable(dev, false); + /* + * Introduce RECONNECTING state from nvme-fc/rdma transports to mark the + * initializing procedure here. + */ + if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_RECONNECTING)) { + dev_warn(dev->ctrl.device, + "failed to mark controller RECONNECTING\n"); + goto out; + } + result = nvme_pci_enable(dev); if (result) goto out; -- 2.7.4