arch/x86/kernel/cpu/resctrl/rdtgroup.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
From: "Borislav Petkov (AMD)" <bp@alien8.de>
clang correctly complains
arch/x86/kernel/cpu/resctrl/rdtgroup.c:1456:6: warning: variable \
'h' set but not used [-Wunused-but-set-variable]
u32 h;
^
but it can't know whether this use is innocuous or really a problem.
There's a reason why those warning switches are behind a W=1 and not
enabled by default - yes, one needs to do:
make W=1 CC=clang HOSTCC=clang arch/x86/kernel/cpu/resctrl/
with clang 14 in order to trigger it.
I would normally not take a silly fix like that but this one is simple
and doesn't make the code uglier so...
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/202301242015.kbzkVteJ-lkp@intel.com
---
arch/x86/kernel/cpu/resctrl/rdtgroup.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
index 5990589f8a21..e2c1599d1b37 100644
--- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
+++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
@@ -1453,17 +1453,17 @@ static void mon_event_config_read(void *info)
{
struct mon_config_info *mon_info = info;
unsigned int index;
- u32 h;
+ u64 msrval;
index = mon_event_config_index_get(mon_info->evtid);
if (index == INVALID_CONFIG_INDEX) {
pr_warn_once("Invalid event id %d\n", mon_info->evtid);
return;
}
- rdmsr(MSR_IA32_EVT_CFG_BASE + index, mon_info->mon_config, h);
+ rdmsrl(MSR_IA32_EVT_CFG_BASE + index, msrval);
/* Report only the valid event configuration bits */
- mon_info->mon_config &= MAX_EVT_CONFIG_BITS;
+ mon_info->mon_config = msrval & MAX_EVT_CONFIG_BITS;
}
static void mondata_config_read(struct rdt_domain *d, struct mon_config_info *mon_info)
--
2.35.1
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Boris, Thanks for the fix. Tested-by: Babu Moger <babu.moger@amd.com> On 1/24/23 12:13, Borislav Petkov wrote: > From: "Borislav Petkov (AMD)" <bp@alien8.de> > > clang correctly complains > > arch/x86/kernel/cpu/resctrl/rdtgroup.c:1456:6: warning: variable \ > 'h' set but not used [-Wunused-but-set-variable] > u32 h; > ^ > > but it can't know whether this use is innocuous or really a problem. > There's a reason why those warning switches are behind a W=1 and not > enabled by default - yes, one needs to do: > > make W=1 CC=clang HOSTCC=clang arch/x86/kernel/cpu/resctrl/ > > with clang 14 in order to trigger it. > > I would normally not take a silly fix like that but this one is simple > and doesn't make the code uglier so... > > Reported-by: kernel test robot <lkp@intel.com> > Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> > Link: https://lore.kernel.org/r/202301242015.kbzkVteJ-lkp@intel.com > --- > arch/x86/kernel/cpu/resctrl/rdtgroup.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c > index 5990589f8a21..e2c1599d1b37 100644 > --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c > +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c > @@ -1453,17 +1453,17 @@ static void mon_event_config_read(void *info) > { > struct mon_config_info *mon_info = info; > unsigned int index; > - u32 h; > + u64 msrval; > > index = mon_event_config_index_get(mon_info->evtid); > if (index == INVALID_CONFIG_INDEX) { > pr_warn_once("Invalid event id %d\n", mon_info->evtid); > return; > } > - rdmsr(MSR_IA32_EVT_CFG_BASE + index, mon_info->mon_config, h); > + rdmsrl(MSR_IA32_EVT_CFG_BASE + index, msrval); > > /* Report only the valid event configuration bits */ > - mon_info->mon_config &= MAX_EVT_CONFIG_BITS; > + mon_info->mon_config = msrval & MAX_EVT_CONFIG_BITS; > } > > static void mondata_config_read(struct rdt_domain *d, struct mon_config_info *mon_info) -- Thanks Babu Moger
Hi Boris, On 1/24/2023 10:13 AM, Borislav Petkov wrote: > From: "Borislav Petkov (AMD)" <bp@alien8.de> > > clang correctly complains > > arch/x86/kernel/cpu/resctrl/rdtgroup.c:1456:6: warning: variable \ > 'h' set but not used [-Wunused-but-set-variable] > u32 h; > ^ > > but it can't know whether this use is innocuous or really a problem. > There's a reason why those warning switches are behind a W=1 and not > enabled by default - yes, one needs to do: > > make W=1 CC=clang HOSTCC=clang arch/x86/kernel/cpu/resctrl/ > > with clang 14 in order to trigger it. > > I would normally not take a silly fix like that but this one is simple > and doesn't make the code uglier so... > > Reported-by: kernel test robot <lkp@intel.com> > Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> > Link: https://lore.kernel.org/r/202301242015.kbzkVteJ-lkp@intel.com > --- Thank you very much. Acked-by: Reinette Chatre <reinette.chatre@intel.com> Reinette
© 2016 - 2025 Red Hat, Inc.