Skip to contentSkip to conversation

linux-next: build warning after merge of the tip tree

DISCUSSION Stephen Rothwell 2 participants 4 messages Sep 11, 2024 – Sep 18, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi all,

After merging the tip tree, today's linux-next build (arm multi_v7_defconfig) produced this warning:

kernel/events/core.c: In function 'perf_event_setup_cpumask':
kernel/events/core.c:14012:13: warning: the comparison will always evaluate as 'true' for the address of 'thread_sibling' will never be NULL [-Waddress]
14012 | if (!topology_sibling_cpumask(cpu)) {
| ^
In file included from include/linux/topology.h:30,

                 from include/linux/gfp.h:8,
                 from include/linux/xarray.h:16,
                 from include/linux/list_lru.h:14,
                 from include/linux/fs.h:13,
                 from kernel/events/core.c:11:
include/linux/arch_topology.h:78:19: note: 'thread_sibling' declared here
   78 |         cpumask_t thread_sibling;
      |                   ^~~~~~~~~~~~~~

Introduced by commit

4ba4f1afb6a9 ("perf: Generic hotplug support for a PMU with a scope")

Signature · 2 lines
Cheers,
Stephen Rothwell
#1 lore raw

Hi Stephen,

Quoted 8 lines · Stephen Rothwell

Hi all,

After merging the tip tree, today's linux-next build (arm multi_v7_defconfig) produced this warning:

kernel/events/core.c: In function 'perf_event_setup_cpumask':
kernel/events/core.c:14012:13: warning: the comparison will always evaluate as 'true' for the address of 'thread_sibling' will never be NULL [-Waddress]
14012 | if (!topology_sibling_cpumask(cpu)) {

The perf_event_init_cpu() may be invoked at the early boot stage, while the topology_*_cpumask hasn't been initialized yet. The check is to specially handle the case.

X86 uses a per-cpu cpumask pointer, which could be NULL at the early boot stage. However, it looks like ARM uses a global variable, which never be NULL. If so, I think we should check whether it's empty.

The below patch should fix it (Only test on X86).

kernel/events/core.c +0 -0
index 2766090de84e..fc0c17e57c86 100644
@@ -14000,7 +14000,8 @@ static void perf_event_setup_cpumask(unsigned

int cpu)
* The perf_online_<domain>_masks includes the first CPU of each domain.
* Always uncondifionally set the boot CPU for the
perf_online_<domain>_masks.
*/
- if (!topology_sibling_cpumask(cpu)) {
+ if (cpu == get_boot_cpu_id() &&
+ (!topology_sibling_cpumask(cpu) ||
cpumask_empty(topology_sibling_cpumask(cpu)))) {
for (scope = PERF_PMU_SCOPE_NONE + 1; scope < PERF_PMU_MAX_SCOPE;
scope++) {
pmu_cpumask = perf_scope_cpumask(scope);
if (WARN_ON_ONCE(!pmu_cpumask))

Should I send the above as a separate patch to fix it?

Thanks,
Kan

Quoted 15 lines

| ^
In file included from include/linux/topology.h:30,

                 from include/linux/gfp.h:8,
                 from include/linux/xarray.h:16,
                 from include/linux/list_lru.h:14,
                 from include/linux/fs.h:13,
                 from kernel/events/core.c:11:
include/linux/arch_topology.h:78:19: note: 'thread_sibling' declared here
   78 |         cpumask_t thread_sibling;
      |                   ^~~~~~~~~~~~~~

Introduced by commit

4ba4f1afb6a9 ("perf: Generic hotplug support for a PMU with a scope")

#2 lore raw
In reply to Stephen Rothwell
Quoted 19 lines · Stephen Rothwell

Hi all,

After merging the tip tree, today's linux-next build (arm multi_v7_defconfig) produced this warning:

kernel/events/core.c: In function 'perf_event_setup_cpumask':
kernel/events/core.c:14012:13: warning: the comparison will always evaluate as 'true' for the address of 'thread_sibling' will never be NULL [-Waddress]
14012 | if (!topology_sibling_cpumask(cpu)) {
| ^
In file included from include/linux/topology.h:30,

                 from include/linux/gfp.h:8,
                 from include/linux/xarray.h:16,
                 from include/linux/list_lru.h:14,
                 from include/linux/fs.h:13,
                 from kernel/events/core.c:11:
include/linux/arch_topology.h:78:19: note: 'thread_sibling' declared here
   78 |         cpumask_t thread_sibling;
      |                   ^~~~~~~~~~~~~~
Quoted 4 lines

Introduced by commit

4ba4f1afb6a9 ("perf: Generic hotplug support for a PMU with a scope")

The patch to fix the warning has been posted.
https://lore.kernel.org/lkml/[email protected]/

Please give it a try.

Thanks,
Kan

#3 lore raw
In reply to Stephen Rothwell

Hi all,

Quoted 18 lines · On Wed, 11 Sep 2024 15:38:54 +1000 Stephen Rothwell <[email protected]>…

After merging the tip tree, today's linux-next build (arm multi_v7_defconfig) produced this warning:

kernel/events/core.c: In function 'perf_event_setup_cpumask':
kernel/events/core.c:14012:13: warning: the comparison will always evaluate as 'true' for the address of 'thread_sibling' will never be NULL [-Waddress]
14012 | if (!topology_sibling_cpumask(cpu)) {
| ^
In file included from include/linux/topology.h:30,

                 from include/linux/gfp.h:8,
                 from include/linux/xarray.h:16,
                 from include/linux/list_lru.h:14,
                 from include/linux/fs.h:13,
                 from kernel/events/core.c:11:
include/linux/arch_topology.h:78:19: note: 'thread_sibling' declared here
   78 |         cpumask_t thread_sibling;
      |                   ^~~~~~~~~~~~~~
Quoted 3 lines

Introduced by commit

4ba4f1afb6a9 ("perf: Generic hotplug support for a PMU with a scope")

This commit is now in Linus' tree and the warning is till there :-( In
fact this is a build failure for some configurations. A fix was
posted on Sep 13 (12?), please get it to Linus as soon as possible.

Signature · 2 lines
Cheers,
Stephen Rothwell