[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH RFC v3 06/13] bpf: Take a Tasks Trace reader in the trampoline glue
- To: "Josef Bacik" <josef@xxxxxxxxxxxxxx>
- From: "Alexei Starovoitov" <alexei.starovoitov@xxxxxxxxx>
- Date: Thu, 17 Sep 2026 02:24:24 +0000
- Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=20251104 header.d=gmail.com header.i="@gmail.com" header.h="In-Reply-To:References:From:Subject:Cc:To:Message-Id:Date:Content-Type:Content-Transfer-Encoding:Mime-Version"
- Cc: "Paul E. McKenney" <paulmck@xxxxxxxxxx>, "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@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>, <linux-kernel@xxxxxxxxxxxxxxx>, <rcu@xxxxxxxxxxxxxxx>, <linux-trace-kernel@xxxxxxxxxxxxxxx>, <bpf@xxxxxxxxxxxxxxx>, <linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Thu, 17 Sep 2026 02:24:46 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Thu Sep 17, 2026 at 1:16 AM UTC, Josef Bacik wrote:
> On Wed, 16 Sep 2026 03:45:16 +0000, Alexei Starovoitov wrote:
> > On Tue Sep 15, 2026 at 1:17 PM UTC, Josef Bacik wrote:
> > > __acquires(RCU)
> > > {
> > > + bpf_tramp_read_lock_trace();
> > > rcu_read_lock_dont_migrate();
> >
> > This is double increment. rcu_read_lock_dont_migrate() includes
> > rcu_read_lock_trace().
>
> Unless I'm looking at the wrong tree it doesn't, on Linus' master and on
> bpf-next it is
>
> static __always_inline void rcu_read_lock_dont_migrate(void)
> {
> if (IS_ENABLED(CONFIG_PREEMPT_RCU))
> migrate_disable();
> rcu_read_lock();
> }
>
> so plain RCU plus migrate_disable(), no Tasks Trace reader. That is why
> the non-sleepable glue needs one added here: on these architectures the
> trampoline image the glue returns into is only kept alive by Tasks RCU
> while the task is a rcu_read_lock_trace() reader, and rcu_read_lock()
> does not give us that.
Right. I got confused. Since rcu_read_lock_trace() CS will cover
both sleepable and non-sleepable prog types let's do it once
per fentry+fmod_ret region and 2nd time for fexit region.
We probably don't want to hold it for the whole trampoline,
since orig_call will delay freeing of progs.
|