Re: linux-next: build failure after merge of the tip tree

Peter Zijlstra
2025-03-17T09:39:00Z

On Tue, Mar 04, 2025 at 04:25:31PM +1100, Stephen Rothwell wrote:
> Hi all,
>
> After merging the tip tree, today's linux-next build (x86_64 allmodconfig)
> failed like this:
>
> In file included from include/asm-generic/percpu.h:7,
> from arch/x86/include/asm/percpu.h:597,
> from arch/x86/include/asm/preempt.h:6,
> from include/linux/preempt.h:79,
> from include/linux/spinlock.h:56,
> from include/linux/wait.h:9,
> from include/linux/wait_bit.h:8,
> from include/linux/fs.h:7,
> from kernel/events/core.c:11:
> kernel/events/core.c: In function 'this_cpc':
> include/linux/percpu-defs.h:220:45: error: initialization from pointer to non-enclosed address space
> 220 | const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \
> | ^
> include/linux/percpu-defs.h:251:9: note: in expansion of macro '__verify_pcpu_ptr'
> 251 | __verify_pcpu_ptr(ptr); \
> | ^~~~~~~~~~~~~~~~~
> kernel/events/core.c:1222:17: note: in expansion of macro 'this_cpu_ptr'
> 1222 | return *this_cpu_ptr(pmu->cpu_pmu_context);
> | ^~~~~~~~~~~~
>
> (and many more similar)
>
> Presumably caused by commit
>
> f67d1ffd841f ("perf/core: Detach 'struct perf_cpu_pmu_context' and 'struct pmu' lifetimes")
>
> I have used the tip tree from next-20250303 for today.

Right. Sorry for not noticing before, and thanks Jiri for poking me.

So the below resolution make it go for me. The problem appears to be
that due to:

bcecd5a529c1 ("percpu: repurpose __percpu tag as a named address space qualifier")

this makes that this_cpu_ptr() wants a '__percpu *', instead we feed it
'__percpu**' which confuses things.

What would be the best way around to getting this resolved, should I
stick the below in a fixup patch in tip/perf/core, or do we carry this
in a merge resolution somewhere?

diff --cc include/linux/perf_event.h
index 4d0b0b007498,76f4265efee9..000000000000
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@@ -343,7 -343,7 +343,7 @@@ struct pmu
*/
unsigned int scope;

- struct perf_cpu_pmu_context __percpu *cpu_pmu_context;
- struct perf_cpu_pmu_context __percpu **cpu_pmu_context;
++ struct perf_cpu_pmu_context * __percpu *cpu_pmu_context;
atomic_t exclusive_cnt; /* < 0: cpu; > 0: tsk */
int task_ctx_nr;
int hrtimer_interval_ms;