oe-kbuild-all.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Souradeep Chakrabarti <schakrabarti@linux.microsoft.com>,
	kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org,
	decui@microsoft.com, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, longli@microsoft.com,
	sharmaajay@microsoft.com, leon@kernel.org, cai.huoqing@linux.dev,
	ssengar@linux.microsoft.com, vkuznets@redhat.com,
	tglx@linutronix.de, linux-hyperv@vger.kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-rdma@vger.kernel.org
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	schakrabarti@microsoft.com, paulros@microsoft.com,
	Souradeep Chakrabarti <schakrabarti@linux.microsoft.com>
Subject: Re: [PATCH V2 net-next] net: mana: Assigning IRQ affinity on HT cores
Date: Wed, 22 Nov 2023 06:51:57 +0800	[thread overview]
Message-ID: <202311220507.k0uewCr0-lkp@intel.com> (raw)
In-Reply-To: <1700574877-6037-1-git-send-email-schakrabarti@linux.microsoft.com>

Hi Souradeep,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Souradeep-Chakrabarti/net-mana-Assigning-IRQ-affinity-on-HT-cores/20231121-215912
base:   net-next/main
patch link:    https://lore.kernel.org/r/1700574877-6037-1-git-send-email-schakrabarti%40linux.microsoft.com
patch subject: [PATCH V2 net-next] net: mana: Assigning IRQ affinity on HT cores
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20231122/202311220507.k0uewCr0-lkp@intel.com/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231122/202311220507.k0uewCr0-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311220507.k0uewCr0-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/net/ethernet/microsoft/mana/gdma_main.c:1253:5: warning: variable 'avail_cpus' is used uninitialized whenever '||' condition is true [-Wsometimes-uninitialized]
           if(!alloc_cpumask_var(&filter_mask, GFP_KERNEL)
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/microsoft/mana/gdma_main.c:1343:19: note: uninitialized use occurs here
           free_cpumask_var(avail_cpus);
                            ^~~~~~~~~~
   drivers/net/ethernet/microsoft/mana/gdma_main.c:1253:5: note: remove the '||' if its condition is always false
           if(!alloc_cpumask_var(&filter_mask, GFP_KERNEL)
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/microsoft/mana/gdma_main.c:1249:39: note: initialize the variable 'avail_cpus' to silence this warning
           cpumask_var_t filter_mask, avail_cpus;
                                                ^
                                                 = NULL
>> drivers/net/ethernet/microsoft/mana/gdma_main.c:1253:5: warning: variable 'core_id_list' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
           if(!alloc_cpumask_var(&filter_mask, GFP_KERNEL)
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/microsoft/mana/gdma_main.c:1344:6: note: uninitialized use occurs here
           if (core_id_list)
               ^~~~~~~~~~~~
   drivers/net/ethernet/microsoft/mana/gdma_main.c:1253:2: note: remove the 'if' if its condition is always false
           if(!alloc_cpumask_var(&filter_mask, GFP_KERNEL)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/microsoft/mana/gdma_main.c:1253:5: warning: variable 'core_id_list' is used uninitialized whenever '||' condition is true [-Wsometimes-uninitialized]
           if(!alloc_cpumask_var(&filter_mask, GFP_KERNEL)
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/microsoft/mana/gdma_main.c:1344:6: note: uninitialized use occurs here
           if (core_id_list)
               ^~~~~~~~~~~~
   drivers/net/ethernet/microsoft/mana/gdma_main.c:1253:5: note: remove the '||' if its condition is always false
           if(!alloc_cpumask_var(&filter_mask, GFP_KERNEL)
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/microsoft/mana/gdma_main.c:1248:28: note: initialize the variable 'core_id_list' to silence this warning
           unsigned int *core_id_list;
                                     ^
                                      = NULL
   3 warnings generated.


vim +1253 drivers/net/ethernet/microsoft/mana/gdma_main.c

  1245	
  1246	static int irq_setup(int *irqs, int nvec, int start_numa_node)
  1247	{
  1248		unsigned int *core_id_list;
  1249		cpumask_var_t filter_mask, avail_cpus;
  1250		int i, core_count = 0, cpu_count = 0, err = 0, node_count = 0;
  1251		unsigned int cpu_first, cpu, irq_start, cores = 0, numa_node = start_numa_node;
  1252	
> 1253		if(!alloc_cpumask_var(&filter_mask, GFP_KERNEL)
  1254				     || !alloc_cpumask_var(&avail_cpus, GFP_KERNEL)) {
  1255			err = -ENOMEM;
  1256			goto free_irq;
  1257		}
  1258		cpumask_copy(filter_mask, cpu_online_mask);
  1259		cpumask_copy(avail_cpus, cpu_online_mask);
  1260		/* count the number of cores
  1261		 */
  1262		for_each_cpu(cpu, filter_mask) {
  1263			cpumask_andnot(filter_mask, filter_mask, topology_sibling_cpumask(cpu));
  1264			cores++;
  1265		}
  1266		core_id_list = kcalloc(cores, sizeof(unsigned int), GFP_KERNEL);
  1267		cpumask_copy(filter_mask, cpu_online_mask);
  1268		/* initialize core_id_list array */
  1269		for_each_cpu(cpu, filter_mask) {
  1270			core_id_list[core_count] = cpu;
  1271			cpumask_andnot(filter_mask, filter_mask, topology_sibling_cpumask(cpu));
  1272			core_count++;
  1273		}
  1274	
  1275		/* if number of cpus are equal to max_queues per port, then
  1276		 * one extra interrupt for the hardware channel communication.
  1277		 */
  1278		if (nvec - 1 == num_online_cpus()) {
  1279			irq_start = 1;
  1280			cpu_first = cpumask_first(cpu_online_mask);
  1281			irq_set_affinity_and_hint(irqs[0], cpumask_of(cpu_first));
  1282		} else {
  1283			irq_start = 0;
  1284		}
  1285	
  1286		/* reset the core_count and num_node to 0.
  1287		 */
  1288		core_count = 0;
  1289	
  1290		/* for each interrupt find the cpu of a particular
  1291		 * sibling set and if it belongs to the specific numa
  1292		 * then assign irq to it and clear the cpu bit from
  1293		 * the corresponding avail_cpus.
  1294		 * Increase the cpu_count for that node.
  1295		 * Once all cpus for a numa node is assigned, then
  1296		 * move to different numa node and continue the same.
  1297		 */
  1298		for (i = irq_start; i < nvec; ) {
  1299	
  1300			/* check if the numa node has cpu or not
  1301			 * to avoid infinite loop.
  1302			 */
  1303			if (cpumask_empty(cpumask_of_node(numa_node))) {
  1304				numa_node++;
  1305				if (++node_count == num_online_nodes()) {
  1306					err = -EAGAIN;
  1307					goto free_irq;
  1308				}
  1309			}
  1310			cpu_first = cpumask_first_and(avail_cpus,
  1311						     topology_sibling_cpumask(core_id_list[core_count]));
  1312			if (cpu_first < nr_cpu_ids && cpu_to_node(cpu_first) == numa_node) {
  1313				irq_set_affinity_and_hint(irqs[i], cpumask_of(cpu_first));
  1314				cpumask_clear_cpu(cpu_first, avail_cpus);
  1315				cpu_count = cpu_count + 1;
  1316				i = i + 1;
  1317	
  1318				/* checking if all the cpus are used from the
  1319				 * particular node.
  1320				 */
  1321				if (cpu_count == nr_cpus_node(numa_node)) {
  1322					numa_node = numa_node + 1;
  1323					if (numa_node == num_online_nodes())
  1324						numa_node = 0;
  1325	
  1326					/* wrap around once numa nodes
  1327					 * are traversed.
  1328					 */
  1329					if (numa_node == start_numa_node) {
  1330						node_count = 0;
  1331						cpumask_copy(avail_cpus, cpu_online_mask);
  1332					}
  1333					cpu_count = 0;
  1334					core_count = 0;
  1335					continue;
  1336				}
  1337			}
  1338			if (++core_count == cores)
  1339				core_count = 0;
  1340		}
  1341	free_irq:
  1342		free_cpumask_var(filter_mask);
  1343		free_cpumask_var(avail_cpus);
  1344		if (core_id_list)
  1345			kfree(core_id_list);
  1346		return err;
  1347	}
  1348	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

           reply	other threads:[~2023-11-21 22:52 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1700574877-6037-1-git-send-email-schakrabarti@linux.microsoft.com>]

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=202311220507.k0uewCr0-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=cai.huoqing@linux.dev \
    --cc=davem@davemloft.net \
    --cc=decui@microsoft.com \
    --cc=edumazet@google.com \
    --cc=haiyangz@microsoft.com \
    --cc=kuba@kernel.org \
    --cc=kys@microsoft.com \
    --cc=leon@kernel.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=longli@microsoft.com \
    --cc=netdev@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=pabeni@redhat.com \
    --cc=paulros@microsoft.com \
    --cc=schakrabarti@linux.microsoft.com \
    --cc=schakrabarti@microsoft.com \
    --cc=sharmaajay@microsoft.com \
    --cc=ssengar@linux.microsoft.com \
    --cc=tglx@linutronix.de \
    --cc=vkuznets@redhat.com \
    --cc=wei.liu@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).