Re: [PATCH bpf-next] selftests/bpf: Disable preemption around css_rstat_updated()
From: Sebastian Andrzej Siewior
Date: Mon Nov 23 2026 - 09:33:12 EST
On 2026-11-23 00:47:15 [+0000], Alexei Starovoitov wrote:
> On Sat, Nov 21, 2026 at 12:28 AM Karl Mehltretter <kmehltretter@xxxxxxxxx> wrote:
> > trace_cgroup_path_lock. On PREEMPT_RT this leaves preemption and
> > interrupts enabled. On non-RT it masks interrupts, satisfying the
> > assertion.
>
> let's fix the kfunc instead
>
> diff --git a/kernel/cgroup/rstat.c b/kernel/cgroup/rstat.c
> index de816a4..d72fe72 100644
> --- a/kernel/cgroup/rstat.c
> +++ b/kernel/cgroup/rstat.c
> @@ -131,6 +131,7 @@ __bpf_kfunc void css_rstat_updated(struct cgroup_subsys_state *css, int cpu)
> if (unlikely(cpu < 0 || cpu >= nr_cpu_ids || !cpu_possible(cpu)))
> return;
>
> + guard(preempt)();
> __css_rstat_updated(css, cpu);
This looks like the only call site which did not disable preemption on
its own (the other are either NMI or have get_cpu()).
> }
Sebastian