llvm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: James Morse <james.morse@arm.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: [morse:mpam/snapshot/v6.12-rc1 81/132] drivers/platform/arm64/mpam/mpam_devices.c:767:4: warning: variable 'hw_managed' is used uninitialized whenever 'if' condition is true
Date: Tue, 8 Oct 2024 11:44:07 +0800	[thread overview]
Message-ID: <202410081111.TZ8q7ksz-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git mpam/snapshot/v6.12-rc1
head:   4d17b37b670795954fd7a70c8ec83fb705a5e2ad
commit: ece606c59b5b8e95457696ebb299295f19c583a8 [81/132] arm_mpam: Probe the hardware features resctrl supports
config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20241008/202410081111.TZ8q7ksz-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/20241008/202410081111.TZ8q7ksz-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/202410081111.TZ8q7ksz-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from drivers/platform/arm64/mpam/mpam_devices.c:6:
   In file included from include/linux/acpi.h:39:
   In file included from include/acpi/acpi_io.h:7:
   In file included from arch/arm64/include/asm/acpi.h:14:
   In file included from include/linux/memblock.h:12:
   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/platform/arm64/mpam/mpam_devices.c:473:17: warning: result of comparison of constant 18446744073709551615 with expression of type 'u32' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]
     473 |                         if (cache_id == ~0UL) {
         |                             ~~~~~~~~ ^  ~~~~
>> drivers/platform/arm64/mpam/mpam_devices.c:767:4: warning: variable 'hw_managed' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
     767 |                         mpam_ris_hw_probe_hw_nrdy(ris, MBWU, hw_managed);
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/platform/arm64/mpam/mpam_devices.c:670:6: note: expanded from macro 'mpam_ris_hw_probe_hw_nrdy'
     670 |         if (WARN_ON_ONCE(!mpam_mon_sel_inner_lock(msc)))                        \
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bug.h:110:33: note: expanded from macro 'WARN_ON_ONCE'
     110 | #define WARN_ON_ONCE(condition) ({                              \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     111 |         int __ret_warn_on = !!(condition);                      \
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     112 |         if (unlikely(__ret_warn_on))                            \
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     113 |                 __WARN_FLAGS(BUGFLAG_ONCE |                     \
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     114 |                              BUGFLAG_TAINT(TAINT_WARN));        \
         |                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     115 |         unlikely(__ret_warn_on);                                \
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     116 | })
         | ~~
   drivers/platform/arm64/mpam/mpam_devices.c:768:8: note: uninitialized use occurs here
     768 |                         if (hw_managed)
         |                             ^~~~~~~~~~
   drivers/platform/arm64/mpam/mpam_devices.c:767:4: note: remove the 'if' if its condition is always false
     767 |                         mpam_ris_hw_probe_hw_nrdy(ris, MBWU, hw_managed);
         |                         ^
   drivers/platform/arm64/mpam/mpam_devices.c:670:2: note: expanded from macro 'mpam_ris_hw_probe_hw_nrdy'
     670 |         if (WARN_ON_ONCE(!mpam_mon_sel_inner_lock(msc)))                        \
         |         ^
   drivers/platform/arm64/mpam/mpam_devices.c:756:19: note: initialize the variable 'hw_managed' to silence this warning
     756 |                         bool hw_managed;
         |                                        ^
         |                                         = 0
   6 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 +767 drivers/platform/arm64/mpam/mpam_devices.c

   687	
   688	static void mpam_ris_hw_probe(struct mpam_msc_ris *ris)
   689	{
   690		int err;
   691		struct mpam_msc *msc = ris->vmsc->msc;
   692		struct mpam_props *props = &ris->props;
   693	
   694		lockdep_assert_held(&msc->probe_lock);
   695		lockdep_assert_held(&msc->part_sel_lock);
   696	
   697		mpam_mon_sel_outer_lock(msc);
   698	
   699		/* Cache Portion partitioning */
   700		if (FIELD_GET(MPAMF_IDR_HAS_CPOR_PART, ris->idr)) {
   701			u32 cpor_features = mpam_read_partsel_reg(msc, CPOR_IDR);
   702	
   703			props->cpbm_wd = FIELD_GET(MPAMF_CPOR_IDR_CPBM_WD, cpor_features);
   704			if (props->cpbm_wd)
   705				mpam_set_feature(mpam_feat_cpor_part, props);
   706		}
   707	
   708		/* Memory bandwidth partitioning */
   709		if (FIELD_GET(MPAMF_IDR_HAS_MBW_PART, ris->idr)) {
   710			u32 mbw_features = mpam_read_partsel_reg(msc, MBW_IDR);
   711	
   712			/* portion bitmap resolution */
   713			props->mbw_pbm_bits = FIELD_GET(MPAMF_MBW_IDR_BWPBM_WD, mbw_features);
   714			if (props->mbw_pbm_bits &&
   715			    FIELD_GET(MPAMF_MBW_IDR_HAS_PBM, mbw_features))
   716				mpam_set_feature(mpam_feat_mbw_part, props);
   717	
   718			props->bwa_wd = FIELD_GET(MPAMF_MBW_IDR_BWA_WD, mbw_features);
   719			if (props->bwa_wd && FIELD_GET(MPAMF_MBW_IDR_HAS_MAX, mbw_features))
   720				mpam_set_feature(mpam_feat_mbw_max, props);
   721		}
   722	
   723		/* Performance Monitoring */
   724		if (FIELD_GET(MPAMF_IDR_HAS_MSMON, ris->idr)) {
   725			u32 msmon_features = mpam_read_partsel_reg(msc, MSMON_IDR);
   726	
   727			if (FIELD_GET(MPAMF_MSMON_IDR_MSMON_CSU, msmon_features)) {
   728				u32 csumonidr;
   729	
   730				/*
   731				 * If the firmware max-nrdy-us property is missing, the
   732				 * CSU counters can't be used. Should we wait forever?
   733				 */
   734				err = device_property_read_u32(&msc->pdev->dev,
   735							       "arm,not-ready-us",
   736							       &msc->nrdy_usec);
   737	
   738				csumonidr = mpam_read_partsel_reg(msc, CSUMON_IDR);
   739				props->num_csu_mon = FIELD_GET(MPAMF_CSUMON_IDR_NUM_MON, csumonidr);
   740				if (props->num_csu_mon && !err) {
   741					bool hw_managed = true;
   742	
   743					mpam_set_feature(mpam_feat_msmon_csu, props);
   744	
   745					/* Is NRDY hardware managed? */
   746					mpam_ris_hw_probe_hw_nrdy(ris, CSU, hw_managed);
   747					if (hw_managed)
   748						mpam_set_feature(mpam_feat_msmon_csu_hw_nrdy, props);
   749				}
   750	
   751				if (err && mpam_has_feature(mpam_feat_msmon_csu_hw_nrdy, props)) {
   752					pr_err_once("Counters are not usable because not-ready timeout was not provided by firmware.");
   753				}
   754			}
   755			if (FIELD_GET(MPAMF_MSMON_IDR_MSMON_MBWU, msmon_features)) {
   756				bool hw_managed;
   757				u32 mbwumonidr = mpam_read_partsel_reg(msc, MBWUMON_IDR);
   758	
   759				props->num_mbwu_mon = FIELD_GET(MPAMF_MBWUMON_IDR_NUM_MON, mbwumonidr);
   760				if (props->num_mbwu_mon)
   761					mpam_set_feature(mpam_feat_msmon_mbwu, props);
   762	
   763				if (FIELD_GET(MPAMF_MBWUMON_IDR_HAS_RWBW, mbwumonidr))
   764					mpam_set_feature(mpam_feat_msmon_mbwu_rwbw, props);
   765	
   766				/* Is NRDY hardware managed? */
 > 767				mpam_ris_hw_probe_hw_nrdy(ris, MBWU, hw_managed);
   768				if (hw_managed)
   769					mpam_set_feature(mpam_feat_msmon_mbwu_hw_nrdy, props);
   770	
   771			}
   772		}
   773	
   774		mpam_mon_sel_outer_unlock(msc);
   775	}
   776	

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

                 reply	other threads:[~2024-10-08  3:44 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=202410081111.TZ8q7ksz-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=james.morse@arm.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;
as well as URLs for NNTP newsgroup(s).