linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
To: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Anton Blanchard <anton@ozlabs.org>,
	linux-kernel@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>,
	Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH 2/2] trace/kprobe: Remove limit on kretprobe maxactive
Date: Thu, 17 Jun 2021 22:04:34 +0530	[thread overview]
Message-ID: <1623946796.80yhllbpmp.naveen@linux.ibm.com> (raw)
In-Reply-To: <20210617001009.d5ae7b2edfdc34f4f8c19ab5@kernel.org>

Masami Hiramatsu wrote:
> On Wed, 16 Jun 2021 11:27:11 +0900
> Masami Hiramatsu <mhiramat@kernel.org> wrote:
> 
>> On Tue, 15 Jun 2021 21:03:51 -0400
>> Steven Rostedt <rostedt@goodmis.org> wrote:
>> 
>> > On Wed, 16 Jun 2021 09:46:22 +0900
>> > Masami Hiramatsu <mhiramat@kernel.org> wrote:
>> > 
>> > > To avoid such trouble, I had set the 4096 limitation for the maxactive
>> > > parameter. Of course 4096 may not enough for some use-cases. I'm welcome
>> > > to expand it (e.g. 32k, isn't it enough?), but removing the limitation
>> > > may cause OOM trouble easily.
>> > 
>> > What if you just made the max as 10 * number of possible cpus, or 4096,
>> > which ever is greater? Why would a user need more?
>> 
>> It could be. But actually, that is not correct number because the
>> number of instances depends on the number of processes and the possiblity
>> of recursive. Thus the huge system which runs more than 64k processes,
>> may need more than that.
>> 
>> > I'd still like to get a wrapper around function graph tracing so that
>> > kretprobes could use it. I think that would get rid of the requirement
>> > of maxactive, because isn't that just used to have a way to know the
>> > original return value?
>> 
>> Hmm, yes, on some arch, it can be done. But on other arch we still need
>> current implementation for generic solution.
>> What I need is not fully wrapped by the function graph, but just share
>> the per-task (software) shadow stack.
> 
> BTW, I have 2 ideas to fix this except for wrapper.
> 
> 1. Use func-graph tracer API directly from dynamic event instead of
>   kretprobes. This will be enabled only if the arch supports fgraph
>   tracer and enable it. maxactive will be ignored if this is enabled,
>   and tracefs user may not need except for the return value 
>   (BTW, is that possible to access the stack? In some case, return
>   value can be passed via stack)
> 
> 2. Move the kretprobe instance pool from kretprobe to struct task.
>   This pool will allocates one page per task, and shared among all
>   kretprobes. This pool will be allocated when the 1st kretprobe
>   is registered. maxactive will be kept for someone who wants to
>   use per-instance data. But since dynamic event doesn't use it,
>   it will be removed from tracefs and perf.

Won't this result in _more_ memory usage compared to what we have now?

Thanks,
Naveen


  reply	other threads:[~2021-06-17 16:35 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-14 18:03 [PATCH 0/2] trace/kprobe: Two fixes for kretprobes Naveen N. Rao
2021-06-14 18:03 ` [PATCH 1/2] trace/kprobe: Fix count of missed kretprobes in kprobe_profile Naveen N. Rao
2021-06-15  5:47   ` Masami Hiramatsu
2021-06-14 18:03 ` [PATCH 2/2] trace/kprobe: Remove limit on kretprobe maxactive Naveen N. Rao
2021-06-15  9:35   ` Masami Hiramatsu
2021-06-15 17:41     ` Naveen N. Rao
2021-06-16  0:46       ` Masami Hiramatsu
2021-06-16  1:03         ` Steven Rostedt
2021-06-16  2:27           ` Masami Hiramatsu
2021-06-16 15:10             ` Masami Hiramatsu
2021-06-17 16:34               ` Naveen N. Rao [this message]
2021-06-17 17:07                 ` Steven Rostedt
2021-06-18  4:26                   ` Masami Hiramatsu
2021-06-18  8:41                     ` Naveen N. Rao
2021-06-17 16:19         ` Naveen N. Rao
2021-06-18  6:17           ` Masami Hiramatsu
2021-06-18 13:19             ` Naveen N. Rao

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=1623946796.80yhllbpmp.naveen@linux.ibm.com \
    --to=naveen.n.rao@linux.vnet.ibm.com \
    --cc=anton@ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    /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;
as well as URLs for NNTP newsgroup(s).