[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1087071545.17266.1613072197171.JavaMail.zimbra@efficios.com>
Date: Thu, 11 Feb 2021 14:36:37 -0500 (EST)
From: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc: Michael Jeanson <mjeanson@...icios.com>,
linux-kernel <linux-kernel@...r.kernel.org>,
rostedt <rostedt@...dmis.org>,
Peter Zijlstra <peterz@...radead.org>,
Alexei Starovoitov <ast@...nel.org>,
Yonghong Song <yhs@...com>, paulmck <paulmck@...nel.org>,
Ingo Molnar <mingo@...hat.com>, acme <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
"Joel Fernandes, Google" <joel@...lfernandes.org>,
bpf <bpf@...r.kernel.org>
Subject: Re: [RFC PATCH 1/6] tracing: introduce sleepable tracepoints
----- On Oct 28, 2020, at 5:23 PM, Alexei Starovoitov alexei.starovoitov@...il.com wrote:
> On Tue, Oct 27, 2020 at 09:37:08AM -0400, Mathieu Desnoyers wrote:
>>
>> ----- On Oct 26, 2020, at 6:43 PM, Alexei Starovoitov
>> alexei.starovoitov@...il.com wrote:
>>
>> > On Fri, Oct 23, 2020 at 03:53:47PM -0400, Michael Jeanson wrote:
>> >> -#define __DO_TRACE(tp, proto, args, cond, rcuidle) \
>> >> +#define __DO_TRACE(tp, proto, args, cond, rcuidle, tp_flags) \
>> >> do { \
>> >> struct tracepoint_func *it_func_ptr; \
>> >> void *it_func; \
>> >> void *__data; \
>> >> int __maybe_unused __idx = 0; \
>> >> + bool maysleep = (tp_flags) & TRACEPOINT_MAYSLEEP; \
>> >> \
>> >> if (!(cond)) \
>> >> return; \
>> >> @@ -170,8 +178,13 @@ static inline struct tracepoint
>> >> *tracepoint_ptr_deref(tracepoint_ptr_t *p)
>> >> /* srcu can't be used from NMI */ \
>> >> WARN_ON_ONCE(rcuidle && in_nmi()); \
>> >> \
>> >> - /* keep srcu and sched-rcu usage consistent */ \
>> >> - preempt_disable_notrace(); \
>> >> + if (maysleep) { \
>> >> + might_sleep(); \
>> >
>> > The main purpose of the patch set is to access user memory in tracepoints,
>> > right?
>>
>> Yes, exactly.
>>
>> > In such case I suggest to use stronger might_fault() here.
>> > We used might_sleep() in sleepable bpf and it wasn't enough to catch
>> > a combination where sleepable hook was invoked while mm->mmap_lock was
>> > taken which may cause a deadlock.
>>
>> Good point! We will do that for the next round.
>>
>> By the way, we named this "sleepable" tracepoint (with flag
>> TRACEPOINT_MAYSLEEP),
>> but we are open to a better name. Would TRACEPOINT_MAYFAULT be more descriptive
>> ?
>> (a "faultable" tracepoint sounds weird though)
>
> bpf kept 'sleepable' as a name. 'faultable' is too misleading.
We're working on an updated patchset for those "sleepable tracepoints", and considering
that those are really "tracepoints allowing page faults", I must admit that I am
uncomfortable with the confusion between "sleep" and "fault" in the naming here.
I am tempted to do the following changes:
- Change name from "sleepable tracepoints" to a better suited "tracepoints allowing page faults",
- Use might_fault() rather than might_sleep() in __DO_TRACE(), effectively guaranteeing that all
probes connecting to a tracepoint which allows page faults can indeed take page faults.
- Change TRACEPOINT_MAYSLEEP into TRACEPOINT_MAYFAULT.
Any objections ?
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
Powered by blists - more mailing lists