Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Yunsheng Lin <linyunsheng@huawei.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: [linyunsheng:mpmc 1/1] mm/page_frag_test.c:448:46: warning: variable 'start' is uninitialized when used here
Date: Mon, 28 Oct 2024 05:28:29 +0800	[thread overview]
Message-ID: <202410280506.sLOvwhVO-lkp@intel.com> (raw)

tree:   https://github.com/gestionlin/linux.git mpmc
head:   ec46c0c4fe8ec793a5b918d5996fca2097581589
commit: ec46c0c4fe8ec793a5b918d5996fca2097581589 [1/1] mm: page_frag: add a test module for page_frag
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20241028/202410280506.sLOvwhVO-lkp@intel.com/config)
compiler: clang version 19.1.2 (https://github.com/llvm/llvm-project 7ba7d8e2f7b6445b60679da826210cdde29eaf8b)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241028/202410280506.sLOvwhVO-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/202410280506.sLOvwhVO-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from mm/page_frag_test.c:9:
   In file included from include/linux/mm.h:2213:
   include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     504 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     505 |                            item];
         |                            ~~~~
   include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     511 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     512 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
   include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     524 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     525 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
>> mm/page_frag_test.c:448:46: warning: variable 'start' is uninitialized when used here [-Wuninitialized]
     448 |         duration = (u64)ktime_us_delta(ktime_get(), start);
         |                                                     ^~~~~
   mm/page_frag_test.c:390:15: note: initialize the variable 'start' to silence this warning
     390 |         ktime_t start;
         |                      ^
         |                       = 0
   5 warnings generated.

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for MODVERSIONS
   Depends on [n]: MODULES [=y] && !COMPILE_TEST [=y]
   Selected by [y]:
   - RANDSTRUCT_FULL [=y] && (CC_HAS_RANDSTRUCT [=y] || GCC_PLUGINS [=n]) && MODULES [=y]


vim +/start +448 mm/page_frag_test.c

   386	
   387	static int __init page_frag_test_init(void)
   388	{
   389		struct task_struct *tsk;
   390		ktime_t start;
   391		u64 duration;
   392		int cpu, ret;
   393	
   394		if (!cpumask_available(pop_cpumask)) {
   395			if (!alloc_cpumask_var(&pop_cpumask, GFP_KERNEL)) {
   396				ret = -ENOMEM;
   397				goto err_cpumask;
   398			}
   399	
   400			cpumask_copy(pop_cpumask, cpu_online_mask);
   401		}
   402	
   403		if (!cpumask_available(push_cpumask)) {
   404			if (!alloc_cpumask_var(&push_cpumask, GFP_KERNEL)) {
   405				ret = -ENOMEM;
   406				goto err_cpumask;
   407			}
   408	
   409			cpumask_copy(push_cpumask, cpu_online_mask);
   410		}
   411	
   412		if (!cpumask_subset(pop_cpumask, cpu_online_mask) ||
   413		    !cpumask_subset(push_cpumask, cpu_online_mask)) {
   414			ret = -EINVAL;
   415			goto err_cpumask;
   416		}
   417	
   418		ret = objpool_init(&ptr_pool, nr_objs, GFP_KERNEL);
   419		if (ret)
   420			goto err_cpumask;
   421	
   422		atomic_set(&nthreads, 0);
   423		init_completion(&wait);
   424	
   425		for_each_cpu(cpu, push_cpumask) {
   426			tsk = kthread_create_on_cpu(page_frag_push_thread, &ptr_pool,
   427						    cpu, "push.*%u");
   428			if (IS_ERR(tsk))
   429				break;
   430	
   431			wake_up_process(tsk);
   432			atomic_inc(&nthreads);
   433		}
   434	
   435		for_each_cpu(cpu, pop_cpumask) {
   436			tsk = kthread_create_on_cpu(page_frag_pop_thread, &ptr_pool,
   437						    cpu, "pop.*%u");
   438			if (IS_ERR(tsk))
   439				break;
   440	
   441			wake_up_process(tsk);
   442			atomic_inc(&nthreads);
   443		}
   444	
   445		pr_info("waiting for test to complete\n");
   446		wait_for_completion(&wait);
   447	
 > 448		duration = (u64)ktime_us_delta(ktime_get(), start);
   449		pr_info("%d of iterations for testing took: %lluus\n", nr_test,
   450			duration);
   451	
   452		objpool_free(&ptr_pool);
   453		return -EAGAIN;
   454	
   455	err_cpumask:
   456		if (cpumask_available(pop_cpumask))
   457			free_cpumask_var(pop_cpumask);
   458	
   459		if (cpumask_available(push_cpumask))
   460			free_cpumask_var(push_cpumask);
   461	
   462		return ret;
   463	}
   464	

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

                 reply	other threads:[~2024-10-27 21:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202410280506.sLOvwhVO-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=linyunsheng@huawei.com \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    /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