Re: [PATCH v2] x86/resctrl: Fix unused variable warning in cache_alloc_hsw_probe()

From: Reinette Chatre
Date: Thu Nov 02 2023 - 17:34:41 EST


Hi Tony,

On 11/1/2023 2:26 PM, Tony Luck wrote:
> In a "W=1" build gcc throws a warning:

This is strange, I am not able to encounter this warning. Is my gcc perhaps
too old? I know there were some specific versions needed to reproduce similar
warnings with clang (see reference commit 793207bad71c ("x86/resctrl: Fix a silly
-Wunused-but-set-variable warning")).

>
> arch/x86/kernel/cpu/resctrl/core.c: In function ‘cache_alloc_hsw_probe’:
> arch/x86/kernel/cpu/resctrl/core.c:139:16: warning: variable ‘h’ set but not used
>
> Fix by switching from wrmsr_safe() to wrmsrl_safe(), and from rdmsr()
> to rdmsrl() using a single u64 argument for the MSR value instead of
> the pair of u32 for the high and low halves.
>
> Signed-off-by: Tony Luck <tony.luck@xxxxxxxxx>

I do not know if all the text from that reference commit applies here, but
for what it is worth:

Acked-by: Reinette Chatre <reinette.chatre@xxxxxxxxx>

Reinette