llvm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [mark:arm64/brbe 8/12] drivers/perf/arm_brbe.c:638:4: warning: variable 'sample_type' is uninitialized when used here
@ 2024-10-05 18:38 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-10-05 18:38 UTC (permalink / raw)
  To: Anshuman Khandual; +Cc: llvm, oe-kbuild-all, Mark Rutland

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git arm64/brbe
head:   cf9093b9f04351e28510d5c82217f884944d69b2
commit: 33c019c78f221ccf89473199c5c13015dec40953 [8/12] WIP: drivers/perf: arm_pmuv3: Enable branch stack sampling via FEAT_BRBE
config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20241006/202410060233.AZ9FVSLw-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project fef3566a25ff0e34fb87339ba5e13eca17cec00f)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241006/202410060233.AZ9FVSLw-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/202410060233.AZ9FVSLw-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from drivers/perf/arm_brbe.c:9:
   In file included from drivers/perf/arm_pmuv3_branch.h:9:
   In file included from include/linux/perf/arm_pmu.h:12:
   In file included from include/linux/perf_event.h:50:
   In file included from include/linux/pid_namespace.h:7:
   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 +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
>> drivers/perf/arm_brbe.c:638:4: warning: variable 'sample_type' is uninitialized when used here [-Wuninitialized]
     638 |                         sample_type |= event->attr.branch_sample_type;
         |                         ^~~~~~~~~~~
   drivers/perf/arm_brbe.c:630:17: note: initialize the variable 'sample_type' to silence this warning
     630 |         u64 sample_type;
         |                        ^
         |                         = 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 +/sample_type +638 drivers/perf/arm_brbe.c

   625	
   626	void armv8pmu_branch_enable(struct arm_pmu *arm_pmu)
   627	{
   628		struct pmu_hw_events *cpuc = this_cpu_ptr(arm_pmu->hw_events);
   629		u64 brbfcr, brbcr;
   630		u64 sample_type;
   631	
   632		/*
   633		 * Merge the permitted branch filters of all events.
   634		 */
   635		for (int i = 0; i < ARMPMU_MAX_HWEVENTS; i++) {
   636			struct perf_event *event = cpuc->events[i];
   637			if (event && has_branch_stack(event))
 > 638				sample_type |= event->attr.branch_sample_type;
   639		}
   640	
   641		/*
   642		 * BRBE gets configured with a new mismatched branch sample
   643		 * type request, overriding any previous branch filters.
   644		 */
   645		brbfcr = read_sysreg_s(SYS_BRBFCR_EL1);
   646		brbfcr &= ~BRBFCR_EL1_CONFIG_MASK;
   647		brbfcr |= branch_type_to_brbfcr(sample_type);
   648		write_sysreg_s(brbfcr, SYS_BRBFCR_EL1);
   649		isb();
   650	
   651		brbcr = read_sysreg_s(SYS_BRBCR_EL1);
   652		brbcr &= ~BRBCR_ELx_CONFIG_MASK;
   653		brbcr |= branch_type_to_brbcr(sample_type);
   654		write_sysreg_s(brbcr, SYS_BRBCR_EL1);
   655		isb();
   656	}
   657	

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-10-05 18:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-05 18:38 [mark:arm64/brbe 8/12] drivers/perf/arm_brbe.c:638:4: warning: variable 'sample_type' is uninitialized when used here kernel test robot

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).