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: <37D7C6CF3E00A74B8858931C1DB2F07750CA2BC9@SHSMSX103.ccr.corp.intel.com>
Date:   Thu, 24 Nov 2016 13:45:28 +0000
From:   "Liang, Kan" <kan.liang@...el.com>
To:     Jiri Olsa <jolsa@...hat.com>
CC:     "peterz@...radead.org" <peterz@...radead.org>,
        "mingo@...hat.com" <mingo@...hat.com>,
        "acme@...nel.org" <acme@...nel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "alexander.shishkin@...ux.intel.com" 
        <alexander.shishkin@...ux.intel.com>,
        "tglx@...utronix.de" <tglx@...utronix.de>,
        "namhyung@...nel.org" <namhyung@...nel.org>,
        "jolsa@...nel.org" <jolsa@...nel.org>,
        "Hunter, Adrian" <adrian.hunter@...el.com>,
        "wangnan0@...wei.com" <wangnan0@...wei.com>,
        "mark.rutland@....com" <mark.rutland@....com>,
        "andi@...stfloor.org" <andi@...stfloor.org>
Subject: RE: [PATCH 01/14] perf/x86: Introduce PERF_RECORD_OVERHEAD



> 
> On Wed, Nov 23, 2016 at 04:44:39AM -0500, kan.liang@...el.com wrote:
> > From: Kan Liang <kan.liang@...el.com>
> >
> > A new perf record is introduced to export perf overhead information to
> > userspace. So we can measure the overhead of sampling directly.
> >
> > To output the overhead information, it takes advantage of the existing
> > event log mechanism. But the overhead information is the system
> > overhead, not per-event overhead.
> >
> > Signed-off-by: Kan Liang <kan.liang@...el.com>
> > ---
> >  include/linux/perf_event.h      |  4 ++++
> >  include/uapi/linux/perf_event.h | 29 +++++++++++++++++++++++++++
> >  kernel/events/core.c            | 43
> +++++++++++++++++++++++++++++++++++++++++
> >  3 files changed, 76 insertions(+)
> >
> > diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
> > index 4741ecd..3a530a7 100644
> > --- a/include/linux/perf_event.h
> > +++ b/include/linux/perf_event.h
> > @@ -998,6 +998,10 @@ perf_event__output_id_sample(struct
> perf_event
> > *event,  extern void  perf_log_lost_samples(struct perf_event *event,
> > u64 lost);
> >
> > +extern void
> > +perf_log_overhead(struct perf_event *event, u32 type,
> > +		  struct perf_overhead_entry *entry);
> > +
> >  static inline bool is_sampling_event(struct perf_event *event)  {
> >  	return event->attr.sample_period != 0; diff --git
> > a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
> > index c66a485..ae571be 100644
> > --- a/include/uapi/linux/perf_event.h
> > +++ b/include/uapi/linux/perf_event.h
> > @@ -862,6 +862,17 @@ enum perf_event_type {
> >  	 */
> >  	PERF_RECORD_SWITCH_CPU_WIDE		= 15,
> >
> > +	/*
> > +	 * Records perf overhead
> > +	 * struct {
> > +	 * 	struct perf_event_header 	header;
> > +	 * 	u32				type;
> > +	 * 	struct perf_overhead_entry	entry;
> > +	 * 	struct sample_id		sample_id;
> > +	 * };
> > +	 */
> > +	PERF_RECORD_OVERHEAD			= 16,
> > +
> >  	PERF_RECORD_MAX,			/* non-ABI */
> >  };
> 
> I think we should make this optional/configurable like the rest of the aux
> events, like below..
> 

The overhead logging only happens when event is going to be disabled or
the task is scheduling out. It should not be much and expensive.

Peter,

What do you think?
Should we make it configurable?

Thanks,
Kan

> jirka
> 
> 
> ---
> diff --git a/include/uapi/linux/perf_event.h
> b/include/uapi/linux/perf_event.h index 5e7c52278ef0..853a919bd9ae
> 100644
> --- a/include/uapi/linux/perf_event.h
> +++ b/include/uapi/linux/perf_event.h
> @@ -344,7 +344,8 @@ struct perf_event_attr {
>  				use_clockid    :  1, /* use @clockid for time
> fields */
>  				context_switch :  1, /* context switch data */
>  				write_backward :  1, /* Write ring buffer
> from end to beginning */
> -				__reserved_1   : 36;
> +				overhead       :  1,
> +				__reserved_1   : 35;
> 
>  	union {
>  		__u32		wakeup_events;	  /* wakeup every n
> events */

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ