From: "Paul E. McKenney" <paulmck@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
linux-kernel@vger.kernel.org,
Michael Jeanson <mjeanson@efficios.com>,
Peter Zijlstra <peterz@infradead.org>,
Alexei Starovoitov <ast@kernel.org>, Yonghong Song <yhs@fb.com>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
bpf@vger.kernel.org, Joel Fernandes <joel@joelfernandes.org>
Subject: Re: [RFC PATCH v3 1/5] tracing: Introduce faultable tracepoints (v3)
Date: Tue, 3 Oct 2023 06:44:50 -0700 [thread overview]
Message-ID: <5d0771e9-332c-42cd-acf3-53d46bb691f3@paulmck-laptop> (raw)
In-Reply-To: <20231002211936.5948253e@gandalf.local.home>
On Mon, Oct 02, 2023 at 09:19:36PM -0400, Steven Rostedt wrote:
> On Mon, 2 Oct 2023 17:14:39 -0700
> "Paul E. McKenney" <paulmck@kernel.org> wrote:
>
> > On Mon, Oct 02, 2023 at 07:10:23PM -0400, Steven Rostedt wrote:
> > > On Mon, 2 Oct 2023 16:25:27 -0400
> > > Mathieu Desnoyers <mathieu.desnoyers@efficios.com> wrote:
> > >
> > > > @@ -202,8 +198,12 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
> > > > if (WARN_ON_ONCE(RCUIDLE_COND(rcuidle))) \
> > > > return; \
> > > > \
> > > > - /* keep srcu and sched-rcu usage consistent */ \
> > > > - preempt_disable_notrace(); \
> > > > + if (mayfault) { \
> > > > + rcu_read_lock_trace(); \
> > >
> > > I thought rcu_trace was for the case that a task can not voluntarily call
> > > schedule. If this tracepoint tries to read user space memory that isn't
> > > paged in, and faults, can't the faulting logic call schedule and break this
> > > requirement?
> >
> > Well, additional new uses of rcu_read_lock_trace() do bear close scrutiny,
> > but RCU Tasks Trace readers are permitted to block for page faults.
> > The BPF folks already use it for this purpose, so this should be OK.
> > (If for some unknown-to-me reason it isn't, I am sure that Alexei,
> > who is on CC, will not suffer in silence.)
> >
> > One way of thinking of RCU Tasks Trace is as a form of SRCU with
> > lightweight readers. Except that, unlike SRCU, there is only one global
> > RCU Tasks Trace. This means that all RCU Tasks Trace users need to keep
> > each other informed, because one users' unruly readers will affect all
> > RCU Tasks Trace users.
> >
> > But given that the BPF folks already have page faults in RCU Tasks Trace
> > readers, this one should be OK.
>
> Then I think we should update the documentation.
>
> From: Documentation/RCU/checklist.rst:
>
> If the updater uses call_rcu_tasks() or synchronize_rcu_tasks(),
> then the readers must refrain from executing voluntary
> context switches, that is, from blocking. If the updater uses
> call_rcu_tasks_trace() or synchronize_rcu_tasks_trace(), then
> the corresponding readers must use rcu_read_lock_trace() and
> rcu_read_unlock_trace(). If an updater uses call_rcu_tasks_rude()
> or synchronize_rcu_tasks_rude(), then the corresponding readers
> must use anything that disables preemption, for example,
> preempt_disable() and preempt_enable().
>
> Because it's all one paragraph it's a bit confusing to know what uses what.
> Perhaps it should be broken up a bit more?
>
> If the updater uses call_rcu_tasks() or synchronize_rcu_tasks(),
> then the readers must refrain from executing voluntary
> context switches, that is, from blocking.
>
> If the updater uses call_rcu_tasks_trace() or
> synchronize_rcu_tasks_trace(), then the corresponding readers must
> use rcu_read_lock_trace() and rcu_read_unlock_trace().
>
> If an updater uses call_rcu_tasks_rude() or synchronize_rcu_tasks_rude(),
> then the corresponding readers must use anything that disables
> preemption, for example, preempt_disable() and preempt_enable().
>
> That way it is clear what uses what, as I read the original paragraph a
> couple of times and could have sworn that rcu_read_lock_trace() required
> tasks to not block.
That would work for me. Would you like to send a patch, or would you
rather we made the adjustments?
Thanx, Paul
next prev parent reply other threads:[~2023-10-03 13:44 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-02 20:25 [RFC PATCH v3 0/5] Faultable Tracepoints Mathieu Desnoyers
2023-10-02 20:25 ` [RFC PATCH v3 1/5] tracing: Introduce faultable tracepoints (v3) Mathieu Desnoyers
2023-10-02 23:10 ` Steven Rostedt
2023-10-03 0:14 ` Paul E. McKenney
2023-10-03 1:19 ` Steven Rostedt
2023-10-03 13:44 ` Paul E. McKenney [this message]
2023-10-03 14:08 ` Steven Rostedt
2023-10-03 17:33 ` Paul E. McKenney
2023-10-03 17:37 ` Mathieu Desnoyers
2023-10-03 17:38 ` Steven Rostedt
2023-10-03 18:15 ` Paul E. McKenney
2023-10-02 20:25 ` [RFC PATCH v3 2/5] tracing/ftrace: Add support for faultable tracepoints Mathieu Desnoyers
2023-10-02 20:25 ` [RFC PATCH v3 3/5] tracing/bpf-trace: add " Mathieu Desnoyers
2023-10-02 20:25 ` [RFC PATCH v3 4/5] tracing/perf: " Mathieu Desnoyers
2023-10-02 20:25 ` [RFC PATCH v3 5/5] tracing: convert sys_enter/exit to " Mathieu Desnoyers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5d0771e9-332c-42cd-acf3-53d46bb691f3@paulmck-laptop \
--to=paulmck@kernel.org \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=joel@joelfernandes.org \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@redhat.com \
--cc=mjeanson@efficios.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®