llvm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	Mark Rutland <mark.rutland@arm.com>
Subject: [mark:arm64/brbe 8/12] drivers/perf/arm_brbe.c:638:4: warning: variable 'sample_type' is uninitialized when used here
Date: Sun, 6 Oct 2024 02:38:13 +0800	[thread overview]
Message-ID: <202410060233.AZ9FVSLw-lkp@intel.com> (raw)

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

                 reply	other threads:[~2024-10-05 18:38 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=202410060233.AZ9FVSLw-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=anshuman.khandual@arm.com \
    --cc=llvm@lists.linux.dev \
    --cc=mark.rutland@arm.com \
    --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;
as well as URLs for NNTP newsgroup(s).