Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] nvme-tcp: initialize the mq_map to NULL
@ 2025-01-09  6:30 Chaitanya Kulkarni
  2025-01-09  6:30 ` [PATCH 2/2] nvme-tcp: remove unused variable Chaitanya Kulkarni
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Chaitanya Kulkarni @ 2025-01-09  6:30 UTC (permalink / raw)
  To: linux-nvme; +Cc: kbusch, hch, sagi, Chaitanya Kulkarni, kernel test robot

Initialize the local variable mq_map to NULL to remove the kernel
test robot warning.

drivers/nvme/host/tcp.c:1594:13: warning: variable 'mq_map' is used
uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]

Fixes: bd0f5c103101 ("nvme-tcp: Fix I/O queue cpu spreading for multiple controllers")  
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202501091328.r4kJ6xhy-lkp@intel.com/
Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
---
 drivers/nvme/host/tcp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index 544d6aa00cc3..d6a40b7dba73 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -1578,7 +1578,7 @@ static void nvme_tcp_set_queue_io_cpu(struct nvme_tcp_queue *queue)
 	struct nvme_tcp_ctrl *ctrl = queue->ctrl;
 	struct blk_mq_tag_set *set = &ctrl->tag_set;
 	int qid = nvme_tcp_queue_id(queue) - 1;
-	unsigned int *mq_map;
+	unsigned int *mq_map = NULL;
 	int cpu, n = 0, min_queues = INT_MAX, io_cpu;
 
 	if (wq_unbound)
-- 
2.40.0



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

* [PATCH 2/2] nvme-tcp: remove unused variable
  2025-01-09  6:30 [PATCH 1/2] nvme-tcp: initialize the mq_map to NULL Chaitanya Kulkarni
@ 2025-01-09  6:30 ` Chaitanya Kulkarni
  2025-01-09 10:59   ` Nilay Shroff
  2025-01-09 10:58 ` [PATCH 1/2] nvme-tcp: initialize the mq_map to NULL Nilay Shroff
  2025-01-10 22:48 ` Sagi Grimberg
  2 siblings, 1 reply; 6+ messages in thread
From: Chaitanya Kulkarni @ 2025-01-09  6:30 UTC (permalink / raw)
  To: linux-nvme; +Cc: kbusch, hch, sagi, Chaitanya Kulkarni, kernel test robot

The variable n declared in nvme_tcp_set_queue_io_cpu() was used in the
original calculation when tcp target was created.

With addtion of commit bd0f5c103101 ("nvme-tcp: Fix I/O queue cpu
spreading for multiple controllers") now all the calculation is based
on io_cpu and mq_map local variable is n is not, resulting in the
kernel test robot warning :-
drivers/nvme/host/tcp.c:1583:18: warning: variable 'n' set but not used [-Wunused-but-set-variable]

Remove the local variable and respective calculations.

Fixes: bd0f5c103101 ("nvme-tcp: Fix I/O queue cpu spreading for multiple controllers")  
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202501090934.Dhw69M6j-lkp@intel.com/
Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
---
 drivers/nvme/host/tcp.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index d6a40b7dba73..e9ff6babc540 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -1579,22 +1579,18 @@ static void nvme_tcp_set_queue_io_cpu(struct nvme_tcp_queue *queue)
 	struct blk_mq_tag_set *set = &ctrl->tag_set;
 	int qid = nvme_tcp_queue_id(queue) - 1;
 	unsigned int *mq_map = NULL;
-	int cpu, n = 0, min_queues = INT_MAX, io_cpu;
+	int cpu, min_queues = INT_MAX, io_cpu;
 
 	if (wq_unbound)
 		goto out;
 
-	if (nvme_tcp_default_queue(queue)) {
+	if (nvme_tcp_default_queue(queue))
 		mq_map = set->map[HCTX_TYPE_DEFAULT].mq_map;
-		n = qid;
-	} else if (nvme_tcp_read_queue(queue)) {
+	else if (nvme_tcp_read_queue(queue))
 		mq_map = set->map[HCTX_TYPE_READ].mq_map;
-		n = qid - ctrl->io_queues[HCTX_TYPE_DEFAULT];
-	} else if (nvme_tcp_poll_queue(queue)) {
+	else if (nvme_tcp_poll_queue(queue))
 		mq_map = set->map[HCTX_TYPE_POLL].mq_map;
-		n = qid - ctrl->io_queues[HCTX_TYPE_DEFAULT] -
-				ctrl->io_queues[HCTX_TYPE_READ];
-	}
+
 	if (WARN_ON(!mq_map))
 		goto out;
 
-- 
2.40.0



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

* Re: [PATCH 1/2] nvme-tcp: initialize the mq_map to NULL
  2025-01-09  6:30 [PATCH 1/2] nvme-tcp: initialize the mq_map to NULL Chaitanya Kulkarni
  2025-01-09  6:30 ` [PATCH 2/2] nvme-tcp: remove unused variable Chaitanya Kulkarni
@ 2025-01-09 10:58 ` Nilay Shroff
  2025-01-10 22:48 ` Sagi Grimberg
  2 siblings, 0 replies; 6+ messages in thread
From: Nilay Shroff @ 2025-01-09 10:58 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-nvme; +Cc: kbusch, hch, sagi, kernel test robot



On 1/9/25 12:00 PM, Chaitanya Kulkarni wrote:
> Initialize the local variable mq_map to NULL to remove the kernel
> test robot warning.
> 
> drivers/nvme/host/tcp.c:1594:13: warning: variable 'mq_map' is used
> uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
> 
> Fixes: bd0f5c103101 ("nvme-tcp: Fix I/O queue cpu spreading for multiple controllers")  
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202501091328.r4kJ6xhy-lkp@intel.com/
> Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
> ---
>  drivers/nvme/host/tcp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
> index 544d6aa00cc3..d6a40b7dba73 100644
> --- a/drivers/nvme/host/tcp.c
> +++ b/drivers/nvme/host/tcp.c
> @@ -1578,7 +1578,7 @@ static void nvme_tcp_set_queue_io_cpu(struct nvme_tcp_queue *queue)
>  	struct nvme_tcp_ctrl *ctrl = queue->ctrl;
>  	struct blk_mq_tag_set *set = &ctrl->tag_set;
>  	int qid = nvme_tcp_queue_id(queue) - 1;
> -	unsigned int *mq_map;
> +	unsigned int *mq_map = NULL;
>  	int cpu, n = 0, min_queues = INT_MAX, io_cpu;
>  
>  	if (wq_unbound)
Looks good.

Reviewed-by: Nilay Shroff <nilay@linux.ibm.com>



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

* Re: [PATCH 2/2] nvme-tcp: remove unused variable
  2025-01-09  6:30 ` [PATCH 2/2] nvme-tcp: remove unused variable Chaitanya Kulkarni
@ 2025-01-09 10:59   ` Nilay Shroff
  0 siblings, 0 replies; 6+ messages in thread
From: Nilay Shroff @ 2025-01-09 10:59 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-nvme; +Cc: kbusch, hch, sagi, kernel test robot



On 1/9/25 12:00 PM, Chaitanya Kulkarni wrote:
> The variable n declared in nvme_tcp_set_queue_io_cpu() was used in the
> original calculation when tcp target was created.
> 
> With addtion of commit bd0f5c103101 ("nvme-tcp: Fix I/O queue cpu
> spreading for multiple controllers") now all the calculation is based
> on io_cpu and mq_map local variable is n is not, resulting in the

Maybe typo: 's/"local variable is n is not,"/", and local variable n is not used,"/g'
Otherwise looks good, please feel free to add:

Reviewed-by: Nilay Shroff <nilay@linux.ibm.com>



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

* Re: [PATCH 1/2] nvme-tcp: initialize the mq_map to NULL
  2025-01-09  6:30 [PATCH 1/2] nvme-tcp: initialize the mq_map to NULL Chaitanya Kulkarni
  2025-01-09  6:30 ` [PATCH 2/2] nvme-tcp: remove unused variable Chaitanya Kulkarni
  2025-01-09 10:58 ` [PATCH 1/2] nvme-tcp: initialize the mq_map to NULL Nilay Shroff
@ 2025-01-10 22:48 ` Sagi Grimberg
  2025-01-11  3:57   ` Keith Busch
  2 siblings, 1 reply; 6+ messages in thread
From: Sagi Grimberg @ 2025-01-10 22:48 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-nvme; +Cc: kbusch, hch, kernel test robot




On 09/01/2025 8:30, Chaitanya Kulkarni wrote:
> Initialize the local variable mq_map to NULL to remove the kernel
> test robot warning.
>
> drivers/nvme/host/tcp.c:1594:13: warning: variable 'mq_map' is used
> uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
>
> Fixes: bd0f5c103101 ("nvme-tcp: Fix I/O queue cpu spreading for multiple controllers")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202501091328.r4kJ6xhy-lkp@intel.com/
> Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>

We should probably just fold both this and the next one to the original 
patch.


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

* Re: [PATCH 1/2] nvme-tcp: initialize the mq_map to NULL
  2025-01-10 22:48 ` Sagi Grimberg
@ 2025-01-11  3:57   ` Keith Busch
  0 siblings, 0 replies; 6+ messages in thread
From: Keith Busch @ 2025-01-11  3:57 UTC (permalink / raw)
  To: Sagi Grimberg; +Cc: Chaitanya Kulkarni, linux-nvme, hch, kernel test robot

On Sat, Jan 11, 2025 at 12:48:04AM +0200, Sagi Grimberg wrote:
> 
> 
> 
> On 09/01/2025 8:30, Chaitanya Kulkarni wrote:
> > Initialize the local variable mq_map to NULL to remove the kernel
> > test robot warning.
> > 
> > drivers/nvme/host/tcp.c:1594:13: warning: variable 'mq_map' is used
> > uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
> > 
> > Fixes: bd0f5c103101 ("nvme-tcp: Fix I/O queue cpu spreading for multiple controllers")
> > Reported-by: kernel test robot <lkp@intel.com>
> > Closes: https://lore.kernel.org/oe-kbuild-all/202501091328.r4kJ6xhy-lkp@intel.com/
> > Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
> 
> We should probably just fold both this and the next one to the original
> patch.

Sure, folded in with an updated commit message to reflect Chaitanya's
changes.


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

end of thread, other threads:[~2025-01-11  3:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-09  6:30 [PATCH 1/2] nvme-tcp: initialize the mq_map to NULL Chaitanya Kulkarni
2025-01-09  6:30 ` [PATCH 2/2] nvme-tcp: remove unused variable Chaitanya Kulkarni
2025-01-09 10:59   ` Nilay Shroff
2025-01-09 10:58 ` [PATCH 1/2] nvme-tcp: initialize the mq_map to NULL Nilay Shroff
2025-01-10 22:48 ` Sagi Grimberg
2025-01-11  3:57   ` Keith Busch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox