Re: [PATCH bpf-next] selftests/bpf: Disable preemption around css_rstat_updated()

From: Alexei Starovoitov

Date: Sun Nov 22 2026 - 19:47:21 EST


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);
}


pw-bot: cr