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

From: Reinette Chatre
Date: Thu Nov 02 2023 - 18:23:46 EST


Hi Tony,

On 11/2/2023 3:02 PM, Luck, Tony wrote:
>> 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")).
>
> I'm using the default install from Fedora 38:
>
> $ gcc --version
> gcc (GCC) 13.2.1 20230728 (Red Hat 13.2.1-1)
> Copyright (C) 2023 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions. There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Thank you for confirming. I tested with the same version. Strange, I see other
instances of this warning but not the resctrl one:

$ grep "set but not used" ~/t/log | wc -l
20
$ grep resctrl ~/t/log
CC arch/x86/kernel/cpu/resctrl/core.o
CC arch/x86/kernel/cpu/resctrl/rdtgroup.o
CC arch/x86/kernel/cpu/resctrl/monitor.o
CC arch/x86/kernel/cpu/resctrl/ctrlmondata.o
CC arch/x86/kernel/cpu/resctrl/pseudo_lock.o
AR arch/x86/kernel/cpu/resctrl/built-in.a

This does seem a valid issue and my Ack remains. I'm just puzzled why I do not
encounter the same warning.

Reinette