nvme-tcp: initialize the mq_map to NULL
PATCH 1/2 nvme-tcp: initialize the mq_map to NULL
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]
--- drivers/nvme/host/tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/tcp.c +1 -1
@@ -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)
Signature · 1 line
2.40.0
PATCH 2/2 nvme-tcp: remove unused variable
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.
--- drivers/nvme/host/tcp.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/nvme/host/tcp.c +5 -9
@@ -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;
Signature · 1 line
2.40.0
Re: [PATCH 2/2] nvme-tcp: remove unused variable
Quoted 6 lines · Chaitanya Kulkarni
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 onio_cpuandmq_maplocal 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:
Quoted 19 lines · Chaitanya Kulkarni
Initialize the local variable
mq_mapto 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 <[email protected]>Signed-off-by Chaitanya Kulkarni <[email protected]>--- drivers/nvme/host/tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/nvme/host/tcp.c +0
-0
drivers/nvme/host/tcp.c static void nvme_tcp_set_queue_io_cpu(struct nvme_tcp_queue *queue) · line 1584
Quoted 8 lines
drivers/nvme/host/tcp.c +1
-1@@ -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.
Sagi Grimberg
maintainerQuoted 10 lines · Chaitanya Kulkarni
Initialize the local variable
mq_mapto 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 <[email protected]>Signed-off-by Chaitanya Kulkarni <[email protected]>
We should probably just fold both this and the next one to the original patch.
Keith Busch
maintainerQuoted 10 lines · Sagi Grimberg
Quoted 6 lines · Chaitanya Kulkarni
Initialize the local variable
mq_mapto 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]
Quoted 7 lines
Quoted 4 lines
Fixes bd0f5c103101 ("nvme-tcp: Fix I/O queue cpu spreading for multiple controllers")Reported-by kernel test robot <[email protected]>Signed-off-by Chaitanya Kulkarni <[email protected]>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.