[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200122162317.0299cf722dd618147d97e89c@kernel.org>
Date: Wed, 22 Jan 2020 16:23:17 +0900
From: Masami Hiramatsu <mhiramat@...nel.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Brendan Gregg <brendan.d.gregg@...il.com>,
Alexei Starovoitov <ast@...nel.org>,
Ingo Molnar <mingo@...nel.org>, bpf@...r.kernel.org,
linux-kernel@...r.kernel.org,
Daniel Borkmann <daniel@...earbox.net>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
"David S . Miller" <davem@...emloft.net>, paulmck@...nel.org,
joel@...lfernandes.org,
"Naveen N . Rao" <naveen.n.rao@...ux.ibm.com>,
Anil S Keshavamurthy <anil.s.keshavamurthy@...el.com>
Subject: Re: [RFT PATCH 04/13] kprobes: Make optimizer delay to 1 second
On Tue, 21 Jan 2020 19:29:05 -0500
Steven Rostedt <rostedt@...dmis.org> wrote:
> On Thu, 16 Jan 2020 23:44:52 +0900
> Masami Hiramatsu <mhiramat@...nel.org> wrote:
>
> > Since the 5 jiffies delay for the optimizer is too
> > short to wait for other probes, make it longer,
> > like 1 second.
>
> Hi Masami,
>
> Can you explain more *why* 5 jiffies is too short.
Yes, I had introduced this 5 jiffies delay for multiple probe registration
and unregistration like systemtap, which will use array-based interface to
register/unregister. In that case, 5 jiffies will be enough for the delay
to wait for other kprobe registration/unregsitration.
However, since perf and ftrace register/unregister probes one-by-one with
RCU synchronization interval, the optimizer will be started before
finishing to register/unregister all probes.
And the optimizer locks kprobe_mutex a while -- RCU-tasks synchronization.
Since the kprobe_mutex is also involved in disabling kprobes, this also
stops probe-event disabling.
Maybe 5 jiffies is enough for adding/removing a few probe events, but
not enough for dozens of probe events.
Thank you,
>
> Thanks!
>
> -- Steve
>
> >
> > Signed-off-by: Masami Hiramatsu <mhiramat@...nel.org>
> > ---
> > kernel/kprobes.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> > index 0dacdcecc90f..9c6e230852ad 100644
> > --- a/kernel/kprobes.c
> > +++ b/kernel/kprobes.c
> > @@ -469,7 +469,8 @@ static int kprobe_optimizer_queue_update;
> >
> > static void kprobe_optimizer(struct work_struct *work);
> > static DECLARE_DELAYED_WORK(optimizing_work, kprobe_optimizer);
> > -#define OPTIMIZE_DELAY 5
> > +/* Wait 1 second for starting optimization */
> > +#define OPTIMIZE_DELAY HZ
> >
> > /*
> > * Optimize (replace a breakpoint with a jump) kprobes listed on
>
--
Masami Hiramatsu <mhiramat@...nel.org>
Powered by blists - more mailing lists