Received: by 10.223.176.46 with SMTP id f43csp1523985wra; Wed, 24 Jan 2018 18:47:04 -0800 (PST) X-Google-Smtp-Source: AH8x2271gu468EqU8piPjWGiu8zvsZGLxk3ziQxRwy9HUtKEM46qsLcku096Bm2hLs8Ptr1c7Xsd X-Received: by 10.99.125.72 with SMTP id m8mr12142125pgn.146.1516848424878; Wed, 24 Jan 2018 18:47:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516848424; cv=none; d=google.com; s=arc-20160816; b=IvPgc4FNG2rdD9oHu8b0LB95I3JD5FymDh/ompcKwkNi1my0YCOrycvAvStYb7xuyJ hIgtCk1ulVnyAB+Lt+cX6cqxEVpOW992e0susWc5rYN6qsvcY50lLbrAEkYF8IdKsOZ7 HW3YH6RMh0SWDpHRgPubDo2/Qh1z7nX+JaB77LE3TVBBAKf43odxWzzbyyfXApmfJlek agUrF9eiYylQ5Nv+Qw/VPxvWPGdrBt+9wVU6XzXG4AoLM3d8CCPwntjnn30bSIRypZcj thibCKhk7MCBvCu8P6aGjrA391R3UlxgJkSG6NoX1oGfQViJ91H/L2XjE90Jsd4n3Wvi VtFA== 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=MbKY39lEA/JoWQ6tzVFOUc78J3vMI3BtLCW2Juyhgk0=; b=sH6aGtDjQ/yazc+pL+0yLGiR/l3NIDVFnj4x0/4FzT7p+07A5kN2bXSIsc0AKfnyh7 12+/JTPm0a0KG15u6KLIYCml6Hxr13+ZjZu2o8k34Z6rSrlkQaF694IPYU/KfY6kQWvQ Zio2xpAY9Vw5GMA7pHKGXJVb7MntibLrKmeQzRY7/ujHLdvmjsv5TpNjo1Axt3dmUPu2 mySQ3QF1PmFGAjExHFKpZ8oHjHuqh76oi1ivB7QjIkOZ40p7g8dN70ZMuh25v93Qw1ll tXTe6qWtr+LwVttTtnkt85lpkdvkMCQ3oStjpQerlUO1zpSqmUWWrANIM1QguamdVvs6 /l0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=tuBoVhBZ; 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 e2si3779353pff.231.2018.01.24.18.46.50; Wed, 24 Jan 2018 18:47:04 -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=tuBoVhBZ; 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 S932928AbeAYCp4 (ORCPT + 99 others); Wed, 24 Jan 2018 21:45:56 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:50788 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751762AbeAYCpz (ORCPT ); Wed, 24 Jan 2018 21:45:55 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w0P2aTiZ139953; Thu, 25 Jan 2018 02:38:42 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=MbKY39lEA/JoWQ6tzVFOUc78J3vMI3BtLCW2Juyhgk0=; b=tuBoVhBZQnwVErIAJIuU15yXZ8gDkT8F+g+ENVxRYXc9mTBldCXAdMqwLGXblPLrunlJ ZVpMcoUOPsXwAj467CngztnH+j2DVBpSw/nFOgrXv1jVcci87QL0p47z0uDNY4cqoXJ7 uo2jKEYWEKF75jhJ1cb3trj3WIoHCOXKAKfW0vmNi9gopKIyb4M0lFqRh35Kn0Ngyl3/ nT9GSWs+ziYep20aNC0AqqqDYgyvuh6enjxxu2Ll9RsH91tsEgPAY2lw5pi3g/613QZP Wm30pvqZjvrg5aTamgOYiYvYX5CM1lxr7srd4RAD1ccT3Kb/K3VCwaHBVOmtlONSj2// dQ== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2120.oracle.com with ESMTP id 2fq6k680fm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 25 Jan 2018 02:38:42 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w0P2XfoB019930 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 25 Jan 2018 02:33:41 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w0P2XcuZ021475; Thu, 25 Jan 2018 02:33:39 GMT Received: from [10.182.70.180] (/10.182.70.180) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 24 Jan 2018 18:33:38 -0800 Subject: Re: [PATCH RESENT] nvme-pci: introduce RECONNECTING state to mark initializing procedure To: keith.busch@intel.com, axboe@fb.com, hch@lst.de, sagi@grimberg.me, maxg@mellanox.com, james.smart@broadcom.com Cc: linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org References: <1516629796-2919-1-git-send-email-jianchao.w.wang@oracle.com> From: "jianchao.wang" Message-ID: <73d8d789-b7af-85b1-0c5e-7cbc002c1c43@oracle.com> Date: Thu, 25 Jan 2018 10:33:41 +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: <1516629796-2919-1-git-send-email-jianchao.w.wang@oracle.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8784 signatures=668655 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-1801250033 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Keith If you have time, can have a look at this. That's really appreciated and thanks in advance. :) Jianchao On 01/22/2018 10:03 PM, Jianchao Wang wrote: > 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 > Reviewed-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; >