[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200421134504.GQ20730@hirez.programming.kicks-ass.net>
Date: Tue, 21 Apr 2020 15:45:04 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Adrian Hunter <adrian.hunter@...el.com>
Cc: Ingo Molnar <mingo@...hat.com>,
Masami Hiramatsu <mhiramat@...nel.org>,
Steven Rostedt <rostedt@...dmis.org>,
Borislav Petkov <bp@...en8.de>,
"H . Peter Anvin" <hpa@...or.com>, x86@...nel.org,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Mathieu Poirier <mathieu.poirier@...aro.org>,
Leo Yan <leo.yan@...aro.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Jiri Olsa <jolsa@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH V6 08/15] ftrace: Add perf text poke events for ftrace
trampolines
On Sun, Apr 05, 2020 at 11:13:20PM +0300, Adrian Hunter wrote:
> Add perf text poke events for ftrace trampolines when created and when
> freed.
Maybe also put in a little more detail on the various events. Because
arch_ftrace_update_trampoline() can also generate text_poke_bp() events,
to update an existing trampoline.
A diagram, like with the kprobes thing perhaps.
> Signed-off-by: Adrian Hunter <adrian.hunter@...el.com>
> ---
> kernel/trace/ftrace.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index 398d58b8ffa5..3318f7eca76c 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -2792,6 +2792,13 @@ static void ftrace_trampoline_free(struct ftrace_ops *ops)
> {
> if (ops && (ops->flags & FTRACE_OPS_FL_ALLOC_TRAMP) &&
> ops->trampoline) {
> + /*
> + * Record the text poke event before the ksymbol unregister
> + * event.
> + */
> + perf_event_text_poke((void *)ops->trampoline,
> + (void *)ops->trampoline,
> + ops->trampoline_size, NULL, 0);
> perf_event_ksymbol(PERF_RECORD_KSYMBOL_TYPE_OOL,
> ops->trampoline, ops->trampoline_size,
> true, FTRACE_TRAMPOLINE_SYM);
> @@ -6816,6 +6823,13 @@ static void ftrace_update_trampoline(struct ftrace_ops *ops)
> perf_event_ksymbol(PERF_RECORD_KSYMBOL_TYPE_OOL,
> ops->trampoline, ops->trampoline_size, false,
> FTRACE_TRAMPOLINE_SYM);
> + /*
> + * Record the perf text poke event after the ksymbol register
> + * event.
> + */
> + perf_event_text_poke((void *)ops->trampoline, NULL, 0,
> + (void *)ops->trampoline,
> + ops->trampoline_size);
> }
> }
>
> --
> 2.17.1
>
Powered by blists - more mailing lists