public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Jiri Olsa <jolsa@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	Alexei Starovoitov <alexei.starovoitov@gmail.com>
Subject: [RFC][PATCH 0/2] ftrace: Add access to function arguments for all callbacks
Date: Wed, 28 Oct 2020 09:15:42 -0400	[thread overview]
Message-ID: <20201028131542.963014814@goodmis.org> (raw)


This is something I wanted to implement a long time ago, but held off until
there was a good reason to do so. Now it appears that having access to the
arguments of the function by default is very useful. As a bonus, because
arguments must be saved regardless before calling a callback, because they
need to be restored before returning back to the start of the traced
function, there's not much work to do to have them always be there for
normal function callbacks.

The basic idea is that if CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS is set, then
all callbacks registered to ftrace can use the regs parameter for the stack
and arguments (kernel_stack_pointer(regs), regs_get_kernel_argument(regs, n)),
without the need to set REGS that causes overhead by saving all registers as
REGS simulates a breakpoint.

Only the first patch is to be applied. The second patch is just to show how
this could work.

Steven Rostedt (VMware) (2):
      ftrace/x86: Allow for arguments to be passed in to REGS by default
      ftrace: Test arguments by adding trace_printk in function tracer

----
 arch/x86/Kconfig               |  1 +
 arch/x86/kernel/ftrace_64.S    | 12 +++++++-----
 kernel/trace/Kconfig           |  9 +++++++++
 kernel/trace/trace_functions.c | 13 ++++++++++++-
 4 files changed, 29 insertions(+), 6 deletions(-)

             reply	other threads:[~2020-10-29  0:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-28 13:15 Steven Rostedt [this message]
2020-10-28 13:15 ` [RFC][PATCH 1/2] ftrace/x86: Allow for arguments to be passed in to REGS by default Steven Rostedt
2020-10-28 14:25   ` [RFC][PATCH 1/2 v2] " Steven Rostedt
2020-10-28 15:29     ` Steven Rostedt
2020-10-28 20:36       ` Steven Rostedt
2020-10-28 21:14         ` Steven Rostedt
2020-10-29  8:07       ` Masami Hiramatsu
2020-10-28 13:15 ` [RFC][PATCH 2/2] ftrace: Test arguments by adding trace_printk in function tracer Steven Rostedt
2020-10-28 21:33 ` [RFC][PATCH 0/2] ftrace: Add access to function arguments for all callbacks Alexei Starovoitov
2020-10-28 22:07   ` Steven Rostedt
2020-10-28 23:03     ` Alexei Starovoitov
2020-10-28 23:16       ` 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=20201028131542.963014814@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=alexei.starovoitov@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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