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]
Date:	Tue, 15 Jul 2014 21:32:01 +0300
From:	Adrian Hunter <adrian.hunter@...el.com>
To:	Arnaldo Carvalho de Melo <acme@...nel.org>
CC:	Peter Zijlstra <peterz@...radead.org>,
	linux-kernel@...r.kernel.org, David Ahern <dsahern@...il.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Jiri Olsa <jolsa@...hat.com>,
	Namhyung Kim <namhyung@...il.com>,
	Paul Mackerras <paulus@...ba.org>,
	Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH 38/41] perf session: Add perf_session__deliver_synth_event()

On 15/07/2014 6:17 p.m., Arnaldo Carvalho de Melo wrote:
> Em Mon, Jul 14, 2014 at 01:03:02PM +0300, Adrian Hunter escreveu:
>> Add a function to deliver synthesized events from
>> within a session.
>
> Why not put this in perf_session_deliver_event (and fix its naming,
> renaming it to perf_session__deliver_event)?
>
> The way you did makes me wonder why you want to fallback to
> perf_session_deliver_event, i.e. would a normal event come thru a
> function which name implies it should be used only for synth events?
>
> Also that events_stats__inc() looks suspicious there :-\

What happens is Intel PT (or Intel BTS) data is decoded which
results in (mostly) branch data.  So "branches" events are
synthesized and injected into the event stream using
perf_session__deliver_synth_event().

The structure of perf_session__deliver_synth_event() reflects
the fact that "user" events (not from the kernel) are processed
differently to "real" events (from the kernel or synthesized).

The synthesized branches events are then consumed by the tools
just as though they came directly from the perf.data file
- so updating stats is normal.


>
> - Arnaldo
>
>> Signed-off-by: Adrian Hunter <adrian.hunter@...el.com>
>> ---
>>   tools/perf/util/session.c | 14 ++++++++++++++
>>   tools/perf/util/session.h |  5 +++++
>>   2 files changed, 19 insertions(+)
>>
>> diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
>> index 708e1c1..433884c 100644
>> --- a/tools/perf/util/session.c
>> +++ b/tools/perf/util/session.c
>> @@ -1066,6 +1066,20 @@ static s64 perf_session__process_user_event(struct perf_session *session,
>>   	}
>>   }
>>
>> +int perf_session__deliver_synth_event(struct perf_session *session,
>> +				      union perf_event *event,
>> +				      struct perf_sample *sample,
>> +				      struct perf_tool *tool)
>> +{
>> +	events_stats__inc(&session->stats, event->header.type);
>> +
>> +	if (event->header.type >= PERF_RECORD_USER_TYPE_START)
>> +		return perf_session__process_user_event(session, event, tool,
>> +							0);
>> +
>> +	return perf_session_deliver_event(session, event, sample, tool, 0);
>> +}
>> +
>>   static void event_swap(union perf_event *event, bool sample_id_all)
>>   {
>>   	perf_event__swap_op swap;
>> diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h
>> index 39327ca..86f1bb4 100644
>> --- a/tools/perf/util/session.h
>> +++ b/tools/perf/util/session.h
>> @@ -130,6 +130,11 @@ extern volatile int session_done;
>>
>>   #define session_done()	(*(volatile int *)(&session_done))
>>
>> +int perf_session__deliver_synth_event(struct perf_session *session,
>> +				      union perf_event *event,
>> +				      struct perf_sample *sample,
>> +				      struct perf_tool *tool);
>> +
>>   int perf_event__process_id_index(struct perf_tool *tool,
>>   				 union perf_event *event,
>>   				 struct perf_session *session);
>> --
>> 1.8.3.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ