[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH RFC v2 08/15] bpf, x86: Maintain Tasks RCU trampoline nesting in the BPF trampoline
- To: "Paul E. McKenney" <paulmck@xxxxxxxxxx>
- From: Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx>
- Date: Sat, 12 Sep 2026 16:59:02 -0700
- Arc-authentication-results: i=1; mx.google.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=5whm1ZGtSD6d9UTQoSVGX4pAamqW3MhbLVJJEUPVUGg=; fh=KLzOaxjmFPU4ZAnxx5B7YBeW6stGSKQtRp7BAQnf2jo=; b=NRvXPohDoxSwdotPeJWKFC9WYeUpRK8PuYGtA0BbyUnhX/fKGc00Txbr5MzhG0LOep BHICtJRbK7VDwt8YdyGdRyzKTLHxQZrXX3Fn/fngI+SketIdDN5DZ3YxUcdOFqH3TJpN TtnUn4jcPoan607vUNfGPFsKc/m54N2HWQi0ekg5yFC5iOo3DxR9/zwfENgTynaWIuhj OMMZhLJv9chxg8C85XsCNH9u1pGvaaShLVfa3T2lnotFx57CVp3WgkFoUJg1JsIU5Fss NrouF8ZCuwhYqdvGADNMKIOcs3Zkj0+FJa3+scftkv+pVtYZ2ndiPsDrXOFsA9EGdoIW NoJg==; darn=lists.xenproject.org
- Arc-seal: i=1; a=rsa-sha256; t=1789257554; cv=none; d=google.com; s=arc-20260327; b=B4a5xdKJQ2v7f9LjwB3jfjHLwggFgSHOkdrH3FVbsjVCxAsLytAb1EVS9eny09iT33 V2qgexTSXScug9Em79Aj46FBTHwB25723FBL8Yz9Snd15ruu6NPB5EF27DVH6eQMWO4R 59iTt8ZQxRlDWtt1ExruQA6XIShBSQg5IYXRusZw7pkvouFoSQKYpLjmVnhLBMvDPsYe 1gQj+rK54tfzf9ES1DW3MirOwrpqWKG0JomurwGrRb/rD8zsuvAr3cxkzBYlutg9/TS9 lBHSLDJCFoUYe/765O7boEMaS62EMf4R5klBfNDNFdwkQ3CQl4jDdoW2N85mqZ6DoE7i +pEA==
- Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=20251104 header.d=gmail.com header.i="@gmail.com" header.h="Content-Transfer-Encoding:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References:MIME-Version"
- Cc: Josef Bacik <josef@xxxxxxxxxxxxxx>, Frederic Weisbecker <frederic@xxxxxxxxxx>, Neeraj Upadhyay <neeraj.upadhyay@xxxxxxxxxx>, Joel Fernandes <joelagnelf@xxxxxxxxxx>, Boqun Feng <boqun@xxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxx>, Peter Zijlstra <peterz@xxxxxxxxxxxxx>, Steven Rostedt <rostedt@xxxxxxxxxxx>, Masami Hiramatsu <mhiramat@xxxxxxxxxx>, Mark Rutland <mark.rutland@xxxxxxx>, Jiri Olsa <jolsa@xxxxxxxxxx>, Alexei Starovoitov <ast@xxxxxxxxxx>, Daniel Borkmann <daniel@xxxxxxxxxxxxx>, Andrii Nakryiko <andrii@xxxxxxxxxx>, X86 ML <x86@xxxxxxxxxx>, Catalin Marinas <catalin.marinas@xxxxxxx>, Will Deacon <will@xxxxxxxxxx>, Puranjay Mohan <puranjay@xxxxxxxxxx>, Xu Kuohai <xukuohai@xxxxxxxxxxxxxxx>, Andy Lutomirski <luto@xxxxxxxxxx>, Josh Triplett <josh@xxxxxxxxxxxxxxxx>, Uladzislau Rezki <urezki@xxxxxxxxx>, Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>, Lai Jiangshan <jiangshanlai@xxxxxxxxx>, Zqiang <qiang.zhang@xxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Luis Chamberlain <mcgrof@xxxxxxxxxx>, Ihor Solodrai <ihor.solodrai@xxxxxxxxx>, LKML <linux-kernel@xxxxxxxxxxxxxxx>, rcu@xxxxxxxxxxxxxxx, linux-trace-kernel <linux-trace-kernel@xxxxxxxxxxxxxxx>, bpf <bpf@xxxxxxxxxxxxxxx>, linux-arm-kernel <linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Sat, 12 Sep 2026 23:59:34 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Sat, Sep 12, 2026 at 3:28 PM Paul E. McKenney <paulmck@xxxxxxxxxx> wrote:
>
> On Sat, Sep 12, 2026 at 12:40:55PM -0700, Alexei Starovoitov wrote:
> > On Sat Sep 12, 2026 at 11:03 AM PDT, Paul E. McKenney wrote:
> > >
> > > In the old kernels, yes, we have current->trc_reader_nesting++.
> > > In the newer kernels, Tasks Trace RCU is instead implemented in terms
> > > of SRCU-fast, which instead increments per-CPU counters. Which among
> > > other thins is a bit faster and does not need to hook into the scheduler.
> >
> > old kernels? I'm confused.
> > rcu_read_lock_trace() in bpf-next is doing t->trc_reader_nesting++
> > and then calls __srcu_read_lock_fast().
> >
> > Are you talking about some RCU branch that you target for next merge window?
>
> No, I was thinking of rcu_read_lock_tasks_trace(), forgetting that
> rcu_read_lock_trace() is still used. (For good reason, just be clear.)
> Your comments are quite correct for rcu_read_lock_trace().
>
> Hmmm... Josep's using t->trc_reader_nesting would break for
> partially overlapping RCU Tasks and rcu_read_lock_trace() readers.
>
> But yes, your #5 makes sense: Deprecate RCU Tasks, upgrade RCU Tasks
> Trace to check for preemption from within trampolines, and move RCU
> Tasks users over to the rcu_read_lock_trace() variant of RCU Tasks Trace.
> (Or am I still missing your point?)
Pretty much. This way bpf trampoline stays as-is. No extra overhead there.
rcu tasks users (faultable tracepoints and what else ? )
switch to rcu_read_lock_trace().
The only difference for faultable tracepoints is
extra t->trc_reader_nesting++.
I have studied the rest of the patches in the series,
so this proposal can be completely off the mark.
|