public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Chaitanya Kulkarni <chaitanyak@nvidia.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagi@grimberg.me>,
	"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
	"kbusch@kernel.org" <kbusch@kernel.org>
Subject: Re: [PATCH 2/3] nvme-core: don't check non-mdts for disc ctrl
Date: Mon, 11 Apr 2022 12:40:22 +0000	[thread overview]
Message-ID: <63d1842c-35d7-e482-21c6-57cab24ae83f@nvidia.com> (raw)
In-Reply-To: <20220411121209.GA21711@lst.de>

On 4/11/22 05:12, Christoph Hellwig wrote:
> On Mon, Apr 11, 2022 at 12:09:31PM +0000, Chaitanya Kulkarni wrote:
>> -	ret = nvme_init_non_mdts_limits(ctrl);
>> -	if (ret < 0)
>> -		return ret;
>> +	if (ctrl->cntrltype == NVME_CTRL_IO) {
>> +		ret = nvme_init_non_mdts_limits(ctrl);
>> +		if (ret < 0)
>> +			return ret;
>> +	}
> 
> This looks better, but I don't think it will actually work as-is.
> The CNTRLTYPE field is never than discovry controllers.  We
> special case them in nvme_init_subsystem, which should move to
> nvme_init_identify instead so that ctrl->cntrltype is always valid
> after that.
> 

hmmm I think let's keep it simple with following tagset check than 
adding more code to make sure ctrl->cntrltype is valid:-


nvme (nvme-5.18) # cat 
0001-nvme-core-check-non-mdts-only-for-I-O-ctrl.patch
 From ee8439487a88b08e5abb6c6558ca6a902a0e6b1d Mon Sep 17 00:00:00 2001
From: Chaitanya Kulkarni <kch@nvidia.com>
Date: Fri, 8 Apr 2022 15:50:10 -0700
Subject: [PATCH] nvme-core: check non-mdts only for I/O ctrl

Validate ctrl is an I/O ctrl before checking the non mdts limits by
checking the ctrl->tagset member, as ctrl->tagset only allocated for
the I/O queues for the controller from :-

1. nvme_fc_create_io_queues(struct nvme_fc_ctrl *ctrl)
2. nvme_rdma_configure_io_queues(struct nvme_rdma_ctrl *ctrl, bool new)
3. nvme_tcp_configure_io_queues(struct nvme_ctrl *ctrl, bool new)
4. nvme_loop_create_io_queues(struct nvme_loop_ctrl *ctrl)
5. nvme_dev_add()

this also masks the following warning reported by the nvme_log_error()
when running blktest nvme/002: -

[ 2005.155946] run blktests nvme/002 at 2022-04-09 16:57:47
[ 2005.192223] loop: module loaded
[ 2005.196429] nvmet: adding nsid 1 to subsystem blktests-subsystem-0
[ 2005.200334] nvmet: adding nsid 1 to subsystem blktests-subsystem-1

<------------------------------SNIP---------------------------------->

[ 2008.958108] nvmet: adding nsid 1 to subsystem blktests-subsystem-997
[ 2008.962082] nvmet: adding nsid 1 to subsystem blktests-subsystem-998
[ 2008.966102] nvmet: adding nsid 1 to subsystem blktests-subsystem-999
[ 2008.973132] nvmet: creating discovery controller 1 for subsystem 
nqn.2014-08.org.nvmexpress.discovery for NQN testhostnqn.
*[ 2008.973196] nvme1: Identify(0x6), Invalid Field in Command (sct 0x0 
/ sc 0x2) MORE DNR*
[ 2008.974595] nvme nvme1: new ctrl: "nqn.2014-08.org.nvmexpress.discovery"
[ 2009.103248] nvme nvme1: Removing ctrl: NQN 
"nqn.2014-08.org.nvmexpress.discovery"

Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
---
  drivers/nvme/host/core.c | 9 ++++++---
  1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index e8d6a1e52083..2e5779d233f2 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3101,9 +3101,12 @@ int nvme_init_ctrl_finish(struct nvme_ctrl *ctrl)
  	if (ret)
  		return ret;

-	ret = nvme_init_non_mdts_limits(ctrl);
-	if (ret < 0)
-		return ret;
+	/* only check non mdts for the I/O controller */
+	if (ctrl->tagset) {
+		ret = nvme_init_non_mdts_limits(ctrl);
+		if (ret < 0)
+			return ret;
+	}

  	ret = nvme_configure_apst(ctrl);
  	if (ret < 0)
-- 
2.29.0

-ck



  reply	other threads:[~2022-04-11 12:55 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-11  3:12 [PATCH 0/3] nvme: fix internal passthru error messages Chaitanya Kulkarni
2022-04-11  3:12 ` [PATCH 1/3] nvmet: handle admin default command set identifier Chaitanya Kulkarni
2022-04-11  6:18   ` Christoph Hellwig
2022-05-10  6:33     ` Christoph Hellwig
2022-04-11  3:12 ` [PATCH 2/3] nvme-core: don't check non-mdts for disc ctrl Chaitanya Kulkarni
2022-04-11  6:13   ` Christoph Hellwig
2022-04-11 10:27     ` Sagi Grimberg
2022-04-11 10:49       ` Chaitanya Kulkarni
2022-04-11 12:09         ` Chaitanya Kulkarni
2022-04-11 12:12           ` Christoph Hellwig
2022-04-11 12:40             ` Chaitanya Kulkarni [this message]
2022-04-11 14:14               ` Keith Busch
2022-04-11 20:44                 ` Chaitanya Kulkarni
2022-04-11 23:51                   ` Keith Busch
2022-05-10  6:21                   ` Christoph Hellwig
2022-05-11  7:19                     ` Chaitanya Kulkarni
2022-04-11  3:12 ` [PATCH 3/3] nvme-core: mark internal passthru req REQ_QUIET Chaitanya Kulkarni
2022-04-11  6:12   ` Christoph Hellwig
2022-04-11 10:48     ` Chaitanya Kulkarni
2022-04-11 10:28   ` Sagi Grimberg
2022-04-11 10:49     ` Chaitanya Kulkarni
2022-04-13 12:07   ` Yi Zhang
2022-04-15  5:59     ` Chaitanya Kulkarni
2022-04-13 16:48   ` Jonathan Derrick
2022-04-13 16:49   ` Jonathan Derrick
2022-04-13 16:52     ` Christoph Hellwig
2022-04-13 16:57       ` Jonathan Derrick
2022-04-13 17:09         ` Keith Busch
2022-04-13 17:11           ` Jonathan Derrick
2022-04-15  6:01           ` Chaitanya Kulkarni
2022-04-13 16:58   ` Keith Busch
2022-04-13 18:42   ` Alan Adamson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=63d1842c-35d7-e482-21c6-57cab24ae83f@nvidia.com \
    --to=chaitanyak@nvidia.com \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox