2021-08-15 08:39:38

by kernel test robot

[permalink] [raw]
Subject: [tip:x86/urgent] BUILD SUCCESS WITH WARNING 064855a69003c24bd6b473b367d364e418c57625

tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/urgent
branch HEAD: 064855a69003c24bd6b473b367d364e418c57625 x86/resctrl: Fix default monitoring groups reporting

possible Warning in current branch:

arch/x86/kernel/cpu/resctrl/monitor.c:310 __mon_event_count() error: uninitialized symbol 'm'.
arch/x86/kernel/cpu/resctrl/monitor.c:315 __mon_event_count() error: potentially dereferencing uninitialized 'm'.

Warning ids grouped by kconfigs:

gcc_recent_errors
`-- i386-randconfig-m021-20210812
|-- arch-x86-kernel-cpu-resctrl-monitor.c-__mon_event_count()-error:potentially-dereferencing-uninitialized-m-.
`-- arch-x86-kernel-cpu-resctrl-monitor.c-__mon_event_count()-error:uninitialized-symbol-m-.

elapsed time: 3699m

configs tested: 236
configs skipped: 69

gcc tested configs:
arm defconfig
arm64 allyesconfig
arm64 defconfig
arm allyesconfig
arm allmodconfig
i386 randconfig-c001-20210814
i386 randconfig-c001-20210812
i386 randconfig-c001-20210813
powerpc tqm8541_defconfig
m68k amiga_defconfig
mips bcm47xx_defconfig
xtensa alldefconfig
sh ul2_defconfig
powerpc mpc8540_ads_defconfig
ia64 defconfig
arm imx_v6_v7_defconfig
mips rs90_defconfig
parisc generic-32bit_defconfig
arm am200epdkit_defconfig
openrisc or1klitex_defconfig
m68k m5407c3_defconfig
powerpc klondike_defconfig
mips loongson1c_defconfig
arm ep93xx_defconfig
arm iop32x_defconfig
mips maltasmvp_eva_defconfig
mips bigsur_defconfig
powerpc64 defconfig
powerpc cell_defconfig
arm davinci_all_defconfig
mips workpad_defconfig
arm omap2plus_defconfig
powerpc pq2fads_defconfig
h8300 alldefconfig
mips cavium_octeon_defconfig
nds32 defconfig
parisc alldefconfig
arm tct_hammer_defconfig
powerpc obs600_defconfig
powerpc makalu_defconfig
powerpc tqm5200_defconfig
powerpc walnut_defconfig
mips bmips_stb_defconfig
sh se7619_defconfig
arm orion5x_defconfig
arm shannon_defconfig
arm clps711x_defconfig
powerpc ppc64e_defconfig
xtensa allyesconfig
arm imx_v4_v5_defconfig
powerpc ep88xc_defconfig
powerpc rainier_defconfig
sh shmin_defconfig
h8300 defconfig
powerpc mpc834x_itxgp_defconfig
mips maltaup_defconfig
mips ip22_defconfig
sh se7721_defconfig
sh rsk7269_defconfig
ia64 tiger_defconfig
arm rpc_defconfig
powerpc ppc40x_defconfig
arm simpad_defconfig
powerpc ppc6xx_defconfig
powerpc mpc837x_mds_defconfig
ia64 alldefconfig
sh edosk7705_defconfig
sh se7750_defconfig
powerpc socrates_defconfig
riscv allnoconfig
powerpc ksi8560_defconfig
powerpc mpc837x_rdb_defconfig
powerpc maple_defconfig
powerpc wii_defconfig
h8300 allyesconfig
h8300 h8s-sim_defconfig
arm aspeed_g4_defconfig
sh sh7785lcr_32bit_defconfig
mips lemote2f_defconfig
mips rm200_defconfig
arm stm32_defconfig
powerpc ppc64_defconfig
xtensa audio_kc705_defconfig
mips loongson3_defconfig
mips ath79_defconfig
arc haps_hs_smp_defconfig
sh se7712_defconfig
powerpc microwatt_defconfig
sh urquell_defconfig
mips decstation_defconfig
arm exynos_defconfig
sh r7780mp_defconfig
arm cns3420vb_defconfig
mips ath25_defconfig
m68k allyesconfig
powerpc amigaone_defconfig
arm s5pv210_defconfig
arm viper_defconfig
sh lboxre2_defconfig
powerpc redwood_defconfig
mips tb0226_defconfig
arm jornada720_defconfig
mips ip27_defconfig
m68k bvme6000_defconfig
mips cu1830-neo_defconfig
powerpc asp8347_defconfig
xtensa iss_defconfig
powerpc canyonlands_defconfig
microblaze mmu_defconfig
arm nhk8815_defconfig
powerpc powernv_defconfig
arm magician_defconfig
powerpc eiger_defconfig
ia64 bigsur_defconfig
powerpc64 alldefconfig
powerpc ge_imp3a_defconfig
xtensa virt_defconfig
arm mmp2_defconfig
m68k mvme147_defconfig
openrisc simple_smp_defconfig
x86_64 allnoconfig
ia64 allmodconfig
ia64 allyesconfig
m68k allmodconfig
m68k defconfig
nios2 defconfig
arc allyesconfig
nds32 allnoconfig
nios2 allyesconfig
csky defconfig
alpha defconfig
alpha allyesconfig
arc defconfig
sh allmodconfig
parisc defconfig
s390 allyesconfig
s390 allmodconfig
parisc allyesconfig
s390 defconfig
i386 allyesconfig
sparc allyesconfig
sparc defconfig
i386 defconfig
mips allyesconfig
mips allmodconfig
powerpc allyesconfig
powerpc allmodconfig
powerpc allnoconfig
x86_64 randconfig-a004-20210814
x86_64 randconfig-a006-20210814
x86_64 randconfig-a003-20210814
x86_64 randconfig-a001-20210814
x86_64 randconfig-a005-20210814
x86_64 randconfig-a002-20210814
x86_64 randconfig-a006-20210812
x86_64 randconfig-a004-20210812
x86_64 randconfig-a003-20210812
x86_64 randconfig-a005-20210812
x86_64 randconfig-a002-20210812
x86_64 randconfig-a001-20210812
i386 randconfig-a004-20210812
i386 randconfig-a003-20210812
i386 randconfig-a002-20210812
i386 randconfig-a001-20210812
i386 randconfig-a006-20210812
i386 randconfig-a005-20210812
i386 randconfig-a004-20210814
i386 randconfig-a002-20210814
i386 randconfig-a001-20210814
i386 randconfig-a003-20210814
i386 randconfig-a006-20210814
i386 randconfig-a005-20210814
i386 randconfig-a004-20210813
i386 randconfig-a003-20210813
i386 randconfig-a001-20210813
i386 randconfig-a002-20210813
i386 randconfig-a006-20210813
i386 randconfig-a005-20210813
x86_64 randconfig-a011-20210813
x86_64 randconfig-a013-20210813
x86_64 randconfig-a012-20210813
x86_64 randconfig-a016-20210813
x86_64 randconfig-a015-20210813
x86_64 randconfig-a014-20210813
i386 randconfig-a011-20210814
i386 randconfig-a015-20210814
i386 randconfig-a013-20210814
i386 randconfig-a014-20210814
i386 randconfig-a016-20210814
i386 randconfig-a012-20210814
i386 randconfig-a011-20210812
i386 randconfig-a015-20210812
i386 randconfig-a013-20210812
i386 randconfig-a014-20210812
i386 randconfig-a016-20210812
i386 randconfig-a012-20210812
i386 randconfig-a011-20210813
i386 randconfig-a015-20210813
i386 randconfig-a014-20210813
i386 randconfig-a013-20210813
i386 randconfig-a016-20210813
i386 randconfig-a012-20210813
riscv nommu_k210_defconfig
riscv allyesconfig
riscv nommu_virt_defconfig
riscv defconfig
riscv rv32_defconfig
riscv allmodconfig
x86_64 rhel-8.3-kselftests
um x86_64_defconfig
um i386_defconfig
x86_64 allyesconfig
x86_64 defconfig
x86_64 rhel-8.3
x86_64 kexec

clang tested configs:
x86_64 randconfig-c001-20210812
x86_64 randconfig-c001-20210813
x86_64 randconfig-c001-20210814
x86_64 randconfig-a006-20210813
x86_64 randconfig-a004-20210813
x86_64 randconfig-a003-20210813
x86_64 randconfig-a002-20210813
x86_64 randconfig-a005-20210813
x86_64 randconfig-a001-20210813
x86_64 randconfig-a011-20210812
x86_64 randconfig-a013-20210812
x86_64 randconfig-a012-20210812
x86_64 randconfig-a016-20210812
x86_64 randconfig-a015-20210812
x86_64 randconfig-a014-20210812
x86_64 randconfig-a013-20210814
x86_64 randconfig-a011-20210814
x86_64 randconfig-a016-20210814
x86_64 randconfig-a012-20210814
x86_64 randconfig-a014-20210814
x86_64 randconfig-a015-20210814

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


2021-08-15 08:46:19

by Borislav Petkov

[permalink] [raw]
Subject: Re: [tip:x86/urgent] BUILD SUCCESS WITH WARNING 064855a69003c24bd6b473b367d364e418c57625

Hi,

On Sun, Aug 15, 2021 at 04:36:40PM +0800, kernel test robot wrote:
> tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/urgent
> branch HEAD: 064855a69003c24bd6b473b367d364e418c57625 x86/resctrl: Fix default monitoring groups reporting
>
> possible Warning in current branch:
>
> arch/x86/kernel/cpu/resctrl/monitor.c:310 __mon_event_count() error: uninitialized symbol 'm'.
> arch/x86/kernel/cpu/resctrl/monitor.c:315 __mon_event_count() error: potentially dereferencing uninitialized 'm'.
>
> Warning ids grouped by kconfigs:
>
> gcc_recent_errors
> `-- i386-randconfig-m021-20210812
> |-- arch-x86-kernel-cpu-resctrl-monitor.c-__mon_event_count()-error:potentially-dereferencing-uninitialized-m-.
> `-- arch-x86-kernel-cpu-resctrl-monitor.c-__mon_event_count()-error:uninitialized-symbol-m-.

AFAIR, I had already asked you guys to make those reports more useful
as, for example, adding a link to that randconfig above or even
attaching it so that a person - not a machine - reading it, can
*actually* act upon it.

But that hasn't happened.

Until it happens, I'm going to ignore all those reports from you.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette

2021-08-15 10:33:15

by Philip Li

[permalink] [raw]
Subject: Re: [tip:x86/urgent] BUILD SUCCESS WITH WARNING 064855a69003c24bd6b473b367d364e418c57625

On Sun, Aug 15, 2021 at 10:42:58AM +0200, Borislav Petkov wrote:
> Hi,
>
> On Sun, Aug 15, 2021 at 04:36:40PM +0800, kernel test robot wrote:
> > tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/urgent
> > branch HEAD: 064855a69003c24bd6b473b367d364e418c57625 x86/resctrl: Fix default monitoring groups reporting
> >
> > possible Warning in current branch:
> >
> > arch/x86/kernel/cpu/resctrl/monitor.c:310 __mon_event_count() error: uninitialized symbol 'm'.
> > arch/x86/kernel/cpu/resctrl/monitor.c:315 __mon_event_count() error: potentially dereferencing uninitialized 'm'.
> >
> > Warning ids grouped by kconfigs:
> >
> > gcc_recent_errors
> > `-- i386-randconfig-m021-20210812
> > |-- arch-x86-kernel-cpu-resctrl-monitor.c-__mon_event_count()-error:potentially-dereferencing-uninitialized-m-.
> > `-- arch-x86-kernel-cpu-resctrl-monitor.c-__mon_event_count()-error:uninitialized-symbol-m-.
>
> AFAIR, I had already asked you guys to make those reports more useful
> as, for example, adding a link to that randconfig above or even
> attaching it so that a person - not a machine - reading it, can
> *actually* act upon it.
>
> But that hasn't happened.
Sorry Boris, we actually followed this suggestion to enable such logic, and
it is supposed to show the report link like below in the summary report in case
the user doesn't receive the standalone issue report.

We will check what happened here and look for resolving it soon.

tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git 20210813-sysfs-fixes-v8
branch HEAD: f5b8aadeca76656caad8bccc795bfe7b0730230a zram: use ATTRIBUTE_GROUPS to fix sysfs deadlock module removal

Error/Warning reports:

https://lore.kernel.org/lkml/[email protected]
https://lore.kernel.org/lkml/[email protected]
https://lore.kernel.org/lkml/[email protected]
https://lore.kernel.org/lkml/[email protected]
https://lore.kernel.org/lkml/[email protected]
https://lore.kernel.org/lkml/[email protected]

Error/Warning in current branch:

arch/x86/kernel/cpu/resctrl/rdtgroup.c:210:7: error: too few arguments to function '__kernfs_create_file'
arch/x86/kernel/cpu/resctrl/rdtgroup.c:212:13: warning: passing argument 7 of '__kernfs_create_file' makes integer from pointer without a cast [-Wint-conversion]
arch/x86/kernel/cpu/resctrl/rdtgroup.c:212:23: error: passing argument 8 of '__kernfs_create_file' from incompatible pointer type [-Werror=incompatible-pointer-types]
arch/x86/kernel/cpu/resctrl/rdtgroup.c:212:38: error: too few arguments to function call, expected 11, have 10

Thanks

>
> Until it happens, I'm going to ignore all those reports from you.
>
> --
> Regards/Gruss,
> Boris.
>
> https://people.kernel.org/tglx/notes-about-netiquette

2021-08-19 06:17:35

by Chen, Rong A

[permalink] [raw]
Subject: Re: [tip:x86/urgent] BUILD SUCCESS WITH WARNING 064855a69003c24bd6b473b367d364e418c57625



On 8/15/2021 4:42 PM, Borislav Petkov wrote:
> Hi,
>
> On Sun, Aug 15, 2021 at 04:36:40PM +0800, kernel test robot wrote:
>> tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/urgent
>> branch HEAD: 064855a69003c24bd6b473b367d364e418c57625 x86/resctrl: Fix default monitoring groups reporting
>>
>> possible Warning in current branch:
>>
>> arch/x86/kernel/cpu/resctrl/monitor.c:310 __mon_event_count() error: uninitialized symbol 'm'.
>> arch/x86/kernel/cpu/resctrl/monitor.c:315 __mon_event_count() error: potentially dereferencing uninitialized 'm'.
>>
>> Warning ids grouped by kconfigs:
>>
>> gcc_recent_errors
>> `-- i386-randconfig-m021-20210812
>> |-- arch-x86-kernel-cpu-resctrl-monitor.c-__mon_event_count()-error:potentially-dereferencing-uninitialized-m-.
>> `-- arch-x86-kernel-cpu-resctrl-monitor.c-__mon_event_count()-error:uninitialized-symbol-m-.
>
> AFAIR, I had already asked you guys to make those reports more useful
> as, for example, adding a link to that randconfig above or even
> attaching it so that a person - not a machine - reading it, can
> *actually* act upon it.
>
> But that hasn't happened.
>
> Until it happens, I'm going to ignore all those reports from you.
>

Hi Borislav,

Sorry about it, the actual link is at
https://lists.01.org/hyperkitty/list/[email protected]/thread/PZVMY3VJU4QY4HQXHK3MLPQ2KZ5CNAYH/,
and it's still an internal report that the robot don't know whether it's
a false positive or not, we'll update the mail contents to avoid
misunderstanding.

Best Regards,
Rong Chen

2021-08-19 09:03:25

by Borislav Petkov

[permalink] [raw]
Subject: Re: [tip:x86/urgent] BUILD SUCCESS WITH WARNING 064855a69003c24bd6b473b367d364e418c57625

On Thu, Aug 19, 2021 at 02:15:16PM +0800, Chen, Rong A wrote:
>
>
> On 8/15/2021 4:42 PM, Borislav Petkov wrote:
> > Hi,
> >
> > On Sun, Aug 15, 2021 at 04:36:40PM +0800, kernel test robot wrote:
> > > tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/urgent
> > > branch HEAD: 064855a69003c24bd6b473b367d364e418c57625 x86/resctrl: Fix default monitoring groups reporting
> > >
> > > possible Warning in current branch:
> > >
> > > arch/x86/kernel/cpu/resctrl/monitor.c:310 __mon_event_count() error: uninitialized symbol 'm'.
> > > arch/x86/kernel/cpu/resctrl/monitor.c:315 __mon_event_count() error: potentially dereferencing uninitialized 'm'.
> > >
> > > Warning ids grouped by kconfigs:
> > >
> > > gcc_recent_errors
> > > `-- i386-randconfig-m021-20210812
> > > |-- arch-x86-kernel-cpu-resctrl-monitor.c-__mon_event_count()-error:potentially-dereferencing-uninitialized-m-.
> > > `-- arch-x86-kernel-cpu-resctrl-monitor.c-__mon_event_count()-error:uninitialized-symbol-m-.
> >
> > AFAIR, I had already asked you guys to make those reports more useful
> > as, for example, adding a link to that randconfig above or even
> > attaching it so that a person - not a machine - reading it, can
> > *actually* act upon it.
> >
> > But that hasn't happened.
> >
> > Until it happens, I'm going to ignore all those reports from you.
> >
>
> Hi Borislav,
>
> Sorry about it, the actual link is at https://lists.01.org/hyperkitty/list/[email protected]/thread/PZVMY3VJU4QY4HQXHK3MLPQ2KZ5CNAYH/,
> and it's still an internal report that the robot don't know whether it's a
> false positive or not, we'll update the mail contents to avoid
> misunderstanding.

Aha, ok, smatch thinks that m might not be initialized because

064855a69003 ("x86/resctrl: Fix default monitoring groups reporting")

removed the default case:

- default:
- /*
- * Code would never reach here because
- * an invalid event id would fail the __rmid_read.
- */
- return -EINVAL;

I'm guessing that comment which got removed too, explains why that's ok.

Adding folks to Cc.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette

2021-08-19 20:41:51

by Reinette Chatre

[permalink] [raw]
Subject: Re: [tip:x86/urgent] BUILD SUCCESS WITH WARNING 064855a69003c24bd6b473b367d364e418c57625

Hi Borislav and Babu,

On 8/19/2021 2:00 AM, Borislav Petkov wrote:
> On Thu, Aug 19, 2021 at 02:15:16PM +0800, Chen, Rong A wrote:
>>
>>
>> On 8/15/2021 4:42 PM, Borislav Petkov wrote:
>>> Hi,
>>>
>>> On Sun, Aug 15, 2021 at 04:36:40PM +0800, kernel test robot wrote:
>>>> tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/urgent
>>>> branch HEAD: 064855a69003c24bd6b473b367d364e418c57625 x86/resctrl: Fix default monitoring groups reporting
>>>>
>>>> possible Warning in current branch:
>>>>
>>>> arch/x86/kernel/cpu/resctrl/monitor.c:310 __mon_event_count() error: uninitialized symbol 'm'.
>>>> arch/x86/kernel/cpu/resctrl/monitor.c:315 __mon_event_count() error: potentially dereferencing uninitialized 'm'.
>>>>
>>>> Warning ids grouped by kconfigs:
>>>>
>>>> gcc_recent_errors
>>>> `-- i386-randconfig-m021-20210812
>>>> |-- arch-x86-kernel-cpu-resctrl-monitor.c-__mon_event_count()-error:potentially-dereferencing-uninitialized-m-.
>>>> `-- arch-x86-kernel-cpu-resctrl-monitor.c-__mon_event_count()-error:uninitialized-symbol-m-.
>>>
>>> AFAIR, I had already asked you guys to make those reports more useful
>>> as, for example, adding a link to that randconfig above or even
>>> attaching it so that a person - not a machine - reading it, can
>>> *actually* act upon it.
>>>
>>> But that hasn't happened.
>>>
>>> Until it happens, I'm going to ignore all those reports from you.
>>>
>>
>> Hi Borislav,
>>
>> Sorry about it, the actual link is at https://lists.01.org/hyperkitty/list/[email protected]/thread/PZVMY3VJU4QY4HQXHK3MLPQ2KZ5CNAYH/,
>> and it's still an internal report that the robot don't know whether it's a
>> false positive or not, we'll update the mail contents to avoid
>> misunderstanding.
>
> Aha, ok, smatch thinks that m might not be initialized because
>
> 064855a69003 ("x86/resctrl: Fix default monitoring groups reporting")
>
> removed the default case:
>
> - default:
> - /*
> - * Code would never reach here because
> - * an invalid event id would fail the __rmid_read.
> - */
> - return -EINVAL;
>
> I'm guessing that comment which got removed too, explains why that's ok.
>
> Adding folks to Cc.

I can confirm that the removed comment explains why m would be
initialized when used in the code that follows.

How would you prefer to address this? We could add just the comment back
in support of future reports or perhaps by adding the default case back
with the same error that would be returned earlier when there is an
invalid EVENT_ID. Something like:

---8<---
diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c
b/arch/x86/kernel/cpu/resctrl/monitor.c
index 57e4bb695ff9..05b99e4d621c 100644
--- a/arch/x86/kernel/cpu/resctrl/monitor.c
+++ b/arch/x86/kernel/cpu/resctrl/monitor.c
@@ -304,6 +304,12 @@ static u64 __mon_event_count(u32 rmid, struct
rmid_read *rr)
case QOS_L3_MBM_LOCAL_EVENT_ID:
m = &rr->d->mbm_local[rmid];
break;
+ default:
+ /*
+ * Code would never reach here because
+ * an invalid event id would fail the __rmid_read.
+ */
+ return RMID_VAL_ERROR;
}

if (rr->first) {



2021-08-19 21:07:20

by Borislav Petkov

[permalink] [raw]
Subject: Re: [tip:x86/urgent] BUILD SUCCESS WITH WARNING 064855a69003c24bd6b473b367d364e418c57625

On Thu, Aug 19, 2021 at 01:39:46PM -0700, Reinette Chatre wrote:
> I can confirm that the removed comment explains why m would be initialized
> when used in the code that follows.
>
> How would you prefer to address this? We could add just the comment back in
> support of future reports or perhaps by adding the default case back with
> the same error that would be returned earlier when there is an invalid
> EVENT_ID. Something like:
>
> ---8<---
> diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c
> b/arch/x86/kernel/cpu/resctrl/monitor.c
> index 57e4bb695ff9..05b99e4d621c 100644
> --- a/arch/x86/kernel/cpu/resctrl/monitor.c
> +++ b/arch/x86/kernel/cpu/resctrl/monitor.c
> @@ -304,6 +304,12 @@ static u64 __mon_event_count(u32 rmid, struct rmid_read
> *rr)
> case QOS_L3_MBM_LOCAL_EVENT_ID:
> m = &rr->d->mbm_local[rmid];
> break;
> + default:
> + /*
> + * Code would never reach here because
> + * an invalid event id would fail the __rmid_read.
> + */
> + return RMID_VAL_ERROR;
> }
>
> if (rr->first) {

Right, I would normally not take a patch just to fix a tool because it
cannot see it correctly.

But Babu has another use case which breaks the build so I guess that's
serious enough to make an exception.

Babu, can you please explain?

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette

2021-08-20 14:44:40

by Reinette Chatre

[permalink] [raw]
Subject: Re: [tip:x86/urgent] BUILD SUCCESS WITH WARNING 064855a69003c24bd6b473b367d364e418c57625

Hi Babu,

On 8/20/2021 7:16 AM, Babu Moger wrote:
>
>
> On 8/19/21 4:05 PM, Borislav Petkov wrote:
>> On Thu, Aug 19, 2021 at 01:39:46PM -0700, Reinette Chatre wrote:
>>> I can confirm that the removed comment explains why m would be initialized
>>> when used in the code that follows.
>>>
>>> How would you prefer to address this? We could add just the comment back in
>>> support of future reports or perhaps by adding the default case back with
>>> the same error that would be returned earlier when there is an invalid
>>> EVENT_ID. Something like:
>>>
>>> ---8<---
>>> diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c
>>> b/arch/x86/kernel/cpu/resctrl/monitor.c
>>> index 57e4bb695ff9..05b99e4d621c 100644
>>> --- a/arch/x86/kernel/cpu/resctrl/monitor.c
>>> +++ b/arch/x86/kernel/cpu/resctrl/monitor.c
>>> @@ -304,6 +304,12 @@ static u64 __mon_event_count(u32 rmid, struct rmid_read
>>> *rr)
>>> case QOS_L3_MBM_LOCAL_EVENT_ID:
>>> m = &rr->d->mbm_local[rmid];
>>> break;
>>> + default:
>>> + /*
>>> + * Code would never reach here because
>>> + * an invalid event id would fail the __rmid_read.
>>> + */
>>> + return RMID_VAL_ERROR;
>>> }
>>>
>>> if (rr->first) {
>>
>> Right, I would normally not take a patch just to fix a tool because it
>> cannot see it correctly.
>>
>> But Babu has another use case which breaks the build so I guess that's
>> serious enough to make an exception.
>>
>> Babu, can you please explain?
>
> Details:
>
> The patch applies cleanly to RHEL8.5 tree but the build fails with an
> uninitialized variable warning treated as an error. The RHEL8.5 Makefile
> uses '-Werror=maybe-uninitialized' to force uninitialized variable
> warnings to be treated as errors. The build error was found while using
> the redhat/configs/kernel-x86_64.config kernel config. BTW, the 5.14-rc6
> build passes and it does not build using '-Werror=maybe-uninitialized'.
> The error from the build is below:
>
> arch/x86/kernel/cpu/resctrl/monitor.c: In function ‘__mon_event_count’:
> arch/x86/kernel/cpu/resctrl/monitor.c:261:12: error: ‘m’ may be used
> uninitialized in this function [-Werror=maybe-uninitialized]
> m->chunks += chunks;
> ^~
>
> The following patch fixes the problem.
>
> diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c
> b/arch/x86/kernel/cpu/resctrl/monitor.c
> index 57e4bb695ff9..553cc6410442 100644
> --- a/arch/x86/kernel/cpu/resctrl/monitor.c
> +++ b/arch/x86/kernel/cpu/resctrl/monitor.c
> @@ -304,6 +304,8 @@ static u64 __mon_event_count(u32 rmid, struct
> rmid_read *rr)
> case QOS_L3_MBM_LOCAL_EVENT_ID:
> m = &rr->d->mbm_local[rmid];
> break;
> + default:
> + return RMID_VAL_ERROR;
> }
>
> if (rr->first) {
>
>
> Reinette,
> Are you going to send the official patch or let me know I will send. You
> can add signoff from me after adding above details. We probably need Fixes
> and Cc: [email protected].
>

Could you please go ahead and send a patch with these details you
collected?

Thank you very much

Reinette

2021-08-20 14:57:35

by Moger, Babu

[permalink] [raw]
Subject: Re: [tip:x86/urgent] BUILD SUCCESS WITH WARNING 064855a69003c24bd6b473b367d364e418c57625



On 8/19/21 4:05 PM, Borislav Petkov wrote:
> On Thu, Aug 19, 2021 at 01:39:46PM -0700, Reinette Chatre wrote:
>> I can confirm that the removed comment explains why m would be initialized
>> when used in the code that follows.
>>
>> How would you prefer to address this? We could add just the comment back in
>> support of future reports or perhaps by adding the default case back with
>> the same error that would be returned earlier when there is an invalid
>> EVENT_ID. Something like:
>>
>> ---8<---
>> diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c
>> b/arch/x86/kernel/cpu/resctrl/monitor.c
>> index 57e4bb695ff9..05b99e4d621c 100644
>> --- a/arch/x86/kernel/cpu/resctrl/monitor.c
>> +++ b/arch/x86/kernel/cpu/resctrl/monitor.c
>> @@ -304,6 +304,12 @@ static u64 __mon_event_count(u32 rmid, struct rmid_read
>> *rr)
>> case QOS_L3_MBM_LOCAL_EVENT_ID:
>> m = &rr->d->mbm_local[rmid];
>> break;
>> + default:
>> + /*
>> + * Code would never reach here because
>> + * an invalid event id would fail the __rmid_read.
>> + */
>> + return RMID_VAL_ERROR;
>> }
>>
>> if (rr->first) {
>
> Right, I would normally not take a patch just to fix a tool because it
> cannot see it correctly.
>
> But Babu has another use case which breaks the build so I guess that's
> serious enough to make an exception.
>
> Babu, can you please explain?

Details:

The patch applies cleanly to RHEL8.5 tree but the build fails with an
uninitialized variable warning treated as an error. The RHEL8.5 Makefile
uses '-Werror=maybe-uninitialized' to force uninitialized variable
warnings to be treated as errors. The build error was found while using
the redhat/configs/kernel-x86_64.config kernel config. BTW, the 5.14-rc6
build passes and it does not build using '-Werror=maybe-uninitialized'.
The error from the build is below:

arch/x86/kernel/cpu/resctrl/monitor.c: In function ‘__mon_event_count’:
arch/x86/kernel/cpu/resctrl/monitor.c:261:12: error: ‘m’ may be used
uninitialized in this function [-Werror=maybe-uninitialized]
m->chunks += chunks;
^~

The following patch fixes the problem.

diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c
b/arch/x86/kernel/cpu/resctrl/monitor.c
index 57e4bb695ff9..553cc6410442 100644
--- a/arch/x86/kernel/cpu/resctrl/monitor.c
+++ b/arch/x86/kernel/cpu/resctrl/monitor.c
@@ -304,6 +304,8 @@ static u64 __mon_event_count(u32 rmid, struct
rmid_read *rr)
case QOS_L3_MBM_LOCAL_EVENT_ID:
m = &rr->d->mbm_local[rmid];
break;
+ default:
+ return RMID_VAL_ERROR;
}

if (rr->first) {


Reinette,
Are you going to send the official patch or let me know I will send. You
can add signoff from me after adding above details. We probably need Fixes
and Cc: [email protected].

thanks
Babu