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-next>] [day] [month] [year] [list]
Date:	Wed, 08 Apr 2015 15:15:21 +0300
From:	Adrian Hunter <adrian.hunter@...el.com>
To:	Stephane Eranian <eranian@...gle.com>
CC:	LKML <linux-kernel@...r.kernel.org>,
	Arnaldo Carvalho de Melo <acme@...hat.com>,
	Peter Zijlstra <peterz@...radead.org>,
	"mingo@...e.hu" <mingo@...e.hu>,
	"ak@...ux.intel.com" <ak@...ux.intel.com>,
	Jiri Olsa <jolsa@...hat.com>,
	Namhyung Kim <namhyung@...nel.org>,
	Rose Belcher <cel@...ibm.com>,
	Sukadev Bhattiprolu <sukadev@...ux.vnet.ibm.com>,
	Sonny Rao <sonnyrao@...omium.org>,
	John Mccutchan <johnmccutchan@...gle.com>,
	David Ahern <dsahern@...il.com>,
	Pawel Moll <pawel.moll@....com>
Subject: Re: [PATCH v6 3/4] perf inject: add jitdump mmap injection support

On 06/04/15 22:41, Stephane Eranian wrote:
>     > +     if (inject.build_ids) {
>     > +             /*
>     > +              * to make sure the mmap records are ordered correctly
>     > +              * and so that the correct especially due to jitted code
>     > +              * mmaps. We cannot generate the buildid hit list and
>     > +              * inject the jit mmaps at the same time for now.
>     > +              */
>     > +             inject.tool.ordered_events = true;
>     > +             inject.tool.ordering_requires_timestamps = true;
>     > +     }
>     > +
>     > +     if (inject.jit_mode) {
>     > +             inject.tool.mmap2          = perf_event__repipe_mmap2;
>     > +             inject.tool.mmap           = perf_event__repipe_mmap;
> 
>     As suggested above, why not make your own tool fns e.g.
> 
>                     inject.tool.mmap2          = perf_event__jit_mode_mmap2;
>                     inject.tool.mmap           = perf_event__jit_mode_mmap;
> 
> 
>     > +             inject.tool.ordered_events = true;
>     > +             inject.tool.ordering_requires_timestamps = true;
> 
>     You are taking advantage of a bug in perf-inject, that is the
>     "finished_round" events are not being processed. Really they should be
>     processed and you should inject in time order.
> 
> I am not sure I understand.
> Yes, I am trying to have inject reorder the samples instead of perf report.
> You are likely to run inject once, and report many times. Also avoids a
> warning in report about out-of-order events.

Well forgetting about "finished_round", it seems to me you need to intercept
all the delivered events (which will be in time order) and inject your own
events at the right time.

At the moment it seems to me you are injecting all your events in one go
when you see the special jitdump mmap. So I would not expect the injected
events to be ordered with respect to other events that come later. But
maybe I misunderstand that?

As I confusingly tried to suggest earlier, one way to see all the
delivered events is to hook the ordered_events "deliver" callback. That
will mean injecting one mmap event at a time.

Here is just an idea.

struct perf_inject {
	...
	ordered_events__deliver_t deliver;
};

int cmd_inject(int argc, const char **argv, const char *prefix __maybe_unused)
{
...
	inject.deliver = inject.session->ordered_events.deliver;
	inject.session->ordered_events.deliver = inject_jit_mmap;
...
}

int inject_jit_mmap(struct ordered_events *oe, struct ordered_event *event)
{
	struct perf_session *session = container_of(oe, struct perf_session, ordered_events);
	struct perf_inject *inject = container_of(session->tool, struct perf_inject, tool); 

	/* Is it time to inject an event */
	if (jit_next_timestamp(inject) < event->timestamp) {
		/* Yes, so inject it by delivery */
		perf_session__deliver_synth_event(...);
	}
	inject->deliver(oe, event);
}

You would also need to inject any remaining events right at the end.

Note the advantage of "delivering" events is that the same approach works whatever the tool.


--
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