lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJN39oibpBU9rZpAX2KJp2bNDj-gdrOMU+4xG14iuab5aPG-xg@mail.gmail.com>
Date:	Fri, 29 Jul 2016 11:05:27 -0700
From:	Brendan Gregg <bgregg@...flix.com>
To:	Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...hat.com>,
	Arnaldo Carvalho de Melo <acme@...nel.org>,
	Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc:	linux-kernel@...r.kernel.org, Alexei Starovoitov <ast@...nel.org>,
	Wang Nan <wangnan0@...wei.com>,
	Brendan Gregg <bgregg@...flix.com>
Subject: Re: [PATCH] perf/core: Add a tracepoint for perf sampling

On Tue, Jul 19, 2016 at 4:20 PM, Brendan Gregg <bgregg@...flix.com> wrote:
> When perf is performing hrtimer-based sampling, this tracepoint can be used
> by BPF to run additional logic on each sample. For example, BPF can fetch
> stack traces and frequency count them in kernel context, for an efficient
> profiler.

Any comments on this patch? Thanks,

Brendan

>
> Signed-off-by: Brendan Gregg <bgregg@...flix.com>
> Cc: Alexei Starovoitov <ast@...nel.org>
> Cc: Wang Nan <wangnan0@...wei.com>
> ---
>  include/trace/events/perf.h | 29 +++++++++++++++++++++++++++++
>  kernel/events/core.c        |  5 +++++
>  2 files changed, 34 insertions(+)
>  create mode 100644 include/trace/events/perf.h
>
> diff --git a/include/trace/events/perf.h b/include/trace/events/perf.h
> new file mode 100644
> index 0000000..461770d
> --- /dev/null
> +++ b/include/trace/events/perf.h
> @@ -0,0 +1,29 @@
> +#undef TRACE_SYSTEM
> +#define TRACE_SYSTEM perf
> +
> +#if !defined(_TRACE_PERF_H) || defined(TRACE_HEADER_MULTI_READ)
> +#define _TRACE_PERF_H
> +
> +#include <linux/tracepoint.h>
> +
> +TRACE_EVENT(perf_hrtimer,
> +       TP_PROTO(struct pt_regs *regs, struct perf_event *event),
> +
> +       TP_ARGS(regs, event),
> +
> +       TP_STRUCT__entry(
> +               __field(struct pt_regs *, regs)
> +               __field(struct perf_event *, event)
> +       ),
> +
> +       TP_fast_assign(
> +               __entry->regs = regs;
> +               __entry->event = event;
> +       ),
> +
> +       TP_printk("regs=%p evt=%p", __entry->regs, __entry->event)
> +);
> +#endif /* _TRACE_PERF_H */
> +
> +/* This part must be outside protection */
> +#include <trace/define_trace.h>
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 79dae18..0d843a7 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -51,6 +51,9 @@
>
>  #include <asm/irq_regs.h>
>
> +#define CREATE_TRACE_POINTS
> +#include <trace/events/perf.h>
> +
>  typedef int (*remote_function_f)(void *);
>
>  struct remote_function_call {
> @@ -8036,6 +8039,8 @@ static enum hrtimer_restart perf_swevent_hrtimer(struct hrtimer *hrtimer)
>         perf_sample_data_init(&data, 0, event->hw.last_period);
>         regs = get_irq_regs();
>
> +       trace_perf_hrtimer(regs, event);
> +
>         if (regs && !perf_exclude_event(event, regs)) {
>                 if (!(event->attr.exclude_idle && is_idle_task(current)))
>                         if (__perf_event_overflow(event, 1, &data, regs))
> --
> 2.7.4
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ