Re: [PATCH v2 0/4] Fix perf bench numa, futex and epoll to work with machines having #CPUs > 1K

From: Athira Rajeev
Date: Tue Apr 12 2022 - 12:33:46 EST




> On 09-Apr-2022, at 10:48 PM, Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> wrote:
>
> Em Sat, Apr 09, 2022 at 12:28:01PM -0300, Arnaldo Carvalho de Melo escreveu:
>> Em Wed, Apr 06, 2022 at 11:21:09PM +0530, Athira Rajeev escreveu:
>>> The perf benchmark for collections: numa, futex and epoll
>>> hits failure in system configuration with CPU's more than 1024.
>>> These benchmarks uses "sched_getaffinity" and "sched_setaffinity"
>>> in the code to work with affinity.
>>
>> Applied 1-3, 4 needs some reworking and can wait for v5.19, the first 3
>> are fixes, so can go now.
>
> Now trying to fix this:
>
> 26 7.89 debian:9 : FAIL gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1)
> bench/numa.c: In function 'alloc_data':
> bench/numa.c:359:6: error: 'orig_mask' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> ret = sched_setaffinity(0, size, mask);
> ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> bench/numa.c:409:13: note: 'orig_mask' was declared here
> cpu_set_t *orig_mask;
> ^~~~~~~~~
> cc1: all warnings being treated as errors
> /git/perf-5.18.0-rc1/tools/build/Makefile.build:139: recipe for target 'bench' failed
> make[3]: *** [bench] Error 2
>
>
> Happened in several distros.

Hi Arnaldo

Thanks for pointing it. I could be able to recreate this compile error in Debian.
The reason for this issue is variable orig_mask which is used and initialised in “alloc_data"
function within if condition for "init_cpu0”. We can fix this issue by initialising it to NULL since
it is accessed conditionally. I also made some changes to CPU_FREE the mask in other error paths.
I will post a V3 with these changes.

Athira

>
> - Arnaldo