From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Jianlin Lv <iecedge@gmail.com>,
alison.schofield@intel.com, davidgow@google.com,
thunder.leizhen@huawei.com, jianlv@ebay.com,
linux-kernel@vger.kernel.org,
Masami Hiramatsu <mhiramat@kernel.org>
Subject: Re: [PATCH] tracepoint: Allow livepatch module add trace event
Date: Wed, 16 Nov 2022 00:07:07 +0900 [thread overview]
Message-ID: <20221116000707.a8a692e377d8daaf3764ee64@kernel.org> (raw)
In-Reply-To: <20221114220216.05dd0541@gandalf.local.home>
On Mon, 14 Nov 2022 22:02:16 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:
> On Tue, 15 Nov 2022 10:38:34 +0800
> Jianlin Lv <iecedge@gmail.com> wrote:
>
> > On Tue, Nov 15, 2022 at 1:22 AM Steven Rostedt <rostedt@goodmis.org> wrote:
> > >
> > > On Wed, 2 Nov 2022 16:02:36 +0000
> > > Jianlin Lv <iecedge@gmail.com> wrote:
> > >
> > > > In the case of keeping the system running, the preferred method for
> > > > tracing the kernel is dynamic tracing (kprobe), but the drawback of
> > > > this method is that events are lost, especially when tracing packages
> > > > in the network stack.
> > >
> > > I'm not against this change, but the above is where I'm a bit confused. How
> > > are events more likely to be lost with kprobes over a static event?
> >
> > We have encountered a case of kprobes missing event, detailed
> > information can refer to the following link:
> > https://github.com/iovisor/bcc/issues/4198
> >
> > Replacing kprobe with ’bpf + raw tracepoint‘, no missing events occur.
> >
>
> Masami,
>
> What's the reason that kprobes are not re-entrant when using ftrace?
I think we had discussed this issue when I drop the irq_disable() from
kprobe ftrace handler on x86, see commit a19b2e3d7839 ("kprobes/x86:
Remove IRQ disabling from ftrace-based/optimized kprobes").
Anyway, kprobes itself is not re-entrant (and no need to be re-entrant
when using int3) because it uses a per-cpu variable to memorize the
current running kprobes while processing the int3 handling and the
singlestep (trap) handling so that it can go back to the correct track
safely. It also has a single-stage "backup" (see save_previous_kprobe())
for unexpectedly re-entrant kprobes (e.g. call a probed function from
kprobe user handler.)
Thus the kprobe user doesn't need to write a re-entrant handler code.
Since kprobes on function entry is transparently changed to the ftrace,
we have to keep this limitation on the kprobes on ftrace.
BTW, now the kprobe_ftrace_handler() uses ftrace_test_recursion_trylock()
to avoid ftrace recursion, is that OK for this case?
Thank you,
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
next prev parent reply other threads:[~2022-11-15 15:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-02 16:02 [PATCH] tracepoint: Allow livepatch module add trace event Jianlin Lv
2022-11-14 17:20 ` Steven Rostedt
2022-11-14 17:23 ` Steven Rostedt
2022-11-15 2:38 ` Jianlin Lv
2022-11-15 3:02 ` Steven Rostedt
2022-11-15 15:07 ` Masami Hiramatsu [this message]
2022-11-15 15:18 ` Steven Rostedt
2022-12-23 4:52 ` Jianlin Lv
2022-12-23 5:08 ` Steven Rostedt
2023-02-17 1:47 ` Steven Rostedt
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=20221116000707.a8a692e377d8daaf3764ee64@kernel.org \
--to=mhiramat@kernel.org \
--cc=alison.schofield@intel.com \
--cc=davidgow@google.com \
--cc=iecedge@gmail.com \
--cc=jianlv@ebay.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=thunder.leizhen@huawei.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