linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nvme-core: don't initlialize ctrl->cntlid twice
@ 2019-01-08  3:08 Andrey Smirnov
  2019-01-08  8:00 ` Sagi Grimberg
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Andrey Smirnov @ 2019-01-08  3:08 UTC (permalink / raw)
  To: linux-nvme
  Cc: Andrey Smirnov, Keith Busch, Jens Axboe, Christoph Hellwig,
	Sagi Grimberg, linux-kernel

ctrl->cntlid will already be initialized from id->cntlid for
non-NVME_F_FABRICS controllers few lines below. For NVME_F_FABRICS
controllers this field should already be initialized, otherwise the
check

	if (ctrl->cntlid != le16_to_cpu(id->cntlid))

below will always be a no-op.

Cc: Keith Busch <keith.busch@intel.com>
Cc: Jens Axboe <axboe@fb.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: linux-nvme@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---

I created this patch just from readying NVMe code. Appologies for the
noise if I misread/misinterpreted things and this assignment is
actually necessary.

Thanks,
Andrey Smirnov

 drivers/nvme/host/core.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 2e65be8b1387..1ec87b30fad1 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2397,7 +2397,6 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
 	ctrl->oaes = le32_to_cpu(id->oaes);
 	atomic_set(&ctrl->abort_limit, id->acl + 1);
 	ctrl->vwc = id->vwc;
-	ctrl->cntlid = le16_to_cpup(&id->cntlid);
 	if (id->mdts)
 		max_hw_sectors = 1 << (id->mdts + page_shift - 9);
 	else
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] nvme-core: don't initlialize ctrl->cntlid twice
  2019-01-08  3:08 [PATCH] nvme-core: don't initlialize ctrl->cntlid twice Andrey Smirnov
@ 2019-01-08  8:00 ` Sagi Grimberg
  2019-01-08 15:39 ` Keith Busch
  2019-01-09 18:49 ` Christoph Hellwig
  2 siblings, 0 replies; 4+ messages in thread
From: Sagi Grimberg @ 2019-01-08  8:00 UTC (permalink / raw)
  To: Andrey Smirnov, linux-nvme
  Cc: Keith Busch, Jens Axboe, Christoph Hellwig, linux-kernel

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] nvme-core: don't initlialize ctrl->cntlid twice
  2019-01-08  3:08 [PATCH] nvme-core: don't initlialize ctrl->cntlid twice Andrey Smirnov
  2019-01-08  8:00 ` Sagi Grimberg
@ 2019-01-08 15:39 ` Keith Busch
  2019-01-09 18:49 ` Christoph Hellwig
  2 siblings, 0 replies; 4+ messages in thread
From: Keith Busch @ 2019-01-08 15:39 UTC (permalink / raw)
  To: Andrey Smirnov
  Cc: linux-nvme, Jens Axboe, Christoph Hellwig, Sagi Grimberg, linux-kernel

On Mon, Jan 07, 2019 at 07:08:49PM -0800, Andrey Smirnov wrote:
> ctrl->cntlid will already be initialized from id->cntlid for
> non-NVME_F_FABRICS controllers few lines below. For NVME_F_FABRICS
> controllers this field should already be initialized, otherwise the
> check
> 
> 	if (ctrl->cntlid != le16_to_cpu(id->cntlid))
> 
> below will always be a no-op.

Yeah, this bug defeats the fabrics sanity check. Good catch.

Reviewed-by: Keith Busch <keith.busch@intel.com>

> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 2e65be8b1387..1ec87b30fad1 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -2397,7 +2397,6 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
>  	ctrl->oaes = le32_to_cpu(id->oaes);
>  	atomic_set(&ctrl->abort_limit, id->acl + 1);
>  	ctrl->vwc = id->vwc;
> -	ctrl->cntlid = le16_to_cpup(&id->cntlid);
>  	if (id->mdts)
>  		max_hw_sectors = 1 << (id->mdts + page_shift - 9);
>  	else
> -- 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] nvme-core: don't initlialize ctrl->cntlid twice
  2019-01-08  3:08 [PATCH] nvme-core: don't initlialize ctrl->cntlid twice Andrey Smirnov
  2019-01-08  8:00 ` Sagi Grimberg
  2019-01-08 15:39 ` Keith Busch
@ 2019-01-09 18:49 ` Christoph Hellwig
  2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2019-01-09 18:49 UTC (permalink / raw)
  To: Andrey Smirnov
  Cc: linux-nvme, Keith Busch, Jens Axboe, Christoph Hellwig,
	Sagi Grimberg, linux-kernel

Thanks,

applied to nvme-4.21.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-01-09 18:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-08  3:08 [PATCH] nvme-core: don't initlialize ctrl->cntlid twice Andrey Smirnov
2019-01-08  8:00 ` Sagi Grimberg
2019-01-08 15:39 ` Keith Busch
2019-01-09 18:49 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).