From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, igt-dev@lists.freedesktop.org
Cc: Intel-gfx@lists.freedesktop.org,
Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t 01/21] scripts/trace.pl: Fix after intel_engine_notify removal
Date: Mon, 13 May 2019 13:16:03 +0100 [thread overview]
Message-ID: <f6f1943c-b216-e1d4-832f-323311bfae9b@linux.intel.com> (raw)
In-Reply-To: <155749158480.28545.14640530975629638702@skylake-alporthouse-com>
On 10/05/2019 13:33, Chris Wilson wrote:
> Quoting Tvrtko Ursulin (2019-05-08 13:10:38)
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> After the removal of engine global seqnos and the corresponding
>> intel_engine_notify tracepoints the script needs to be adjusted to cope
>> with the new state of things.
>>
>> To keep working it switches over using the dma_fence:dma_fence_signaled:
>> tracepoint and keeps one extra internal map to connect the ctx-seqno pairs
>> with engines.
>>
>> It also needs to key the completion events on the full engine/ctx/seqno
>> tokens, and adjust correspondingly the timeline sorting logic.
>>
>> v2:
>> * Do not use late notifications (received after context complete) when
>> splitting up coalesced requests. They are now much more likely and can
>> not be used.
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>> ---
>> scripts/trace.pl | 82 ++++++++++++++++++++++++------------------------
>> 1 file changed, 41 insertions(+), 41 deletions(-)
>>
>> diff --git a/scripts/trace.pl b/scripts/trace.pl
>> index 18f9f3b18396..95dc3a645e8e 100755
>> --- a/scripts/trace.pl
>> +++ b/scripts/trace.pl
>> @@ -27,7 +27,8 @@ use warnings;
>> use 5.010;
>>
>> my $gid = 0;
>> -my (%db, %queue, %submit, %notify, %rings, %ctxdb, %ringmap, %reqwait, %ctxtimelines);
>> +my (%db, %queue, %submit, %notify, %rings, %ctxdb, %ringmap, %reqwait,
>> + %ctxtimelines, %ctxengines);
>> my @freqs;
>
> So what's ctxengines? Or rings for that matter?
rings go back to the beginnings of the tool when I think the
visualizaiton library needed an unique integer value for every timeline
(so engine). And there is a ringmap from this id back to our engine
name. Perhaps this would be clearer if reversed, but I am not sure how
much churn would that be without actually doing it. Renaming rings to
engines would also make sense.
> I take it ctxengines is really the last engine which we saw this context
> execute on?
Correct.
I guess there is a problem if dma_fence_signaled is delayed past another
request_in. Hm but I also have a die if engine is different.. that
cannot be right, but why it didn't fail.. I need to double check this.
>
>>
>> my $max_items = 3000;
>> @@ -66,7 +67,7 @@ Notes:
>> i915:i915_request_submit, \
>> i915:i915_request_in, \
>> i915:i915_request_out, \
>> - i915:intel_engine_notify, \
>> + dma_fence:dma_fence_signaled, \
>> i915:i915_request_wait_begin, \
>> i915:i915_request_wait_end \
>> [command-to-be-profiled]
>> @@ -161,7 +162,7 @@ sub arg_trace
>> 'i915:i915_request_submit',
>> 'i915:i915_request_in',
>> 'i915:i915_request_out',
>> - 'i915:intel_engine_notify',
>> + 'dma_fence:dma_fence_signaled',
>> 'i915:i915_request_wait_begin',
>> 'i915:i915_request_wait_end' );
>>
>> @@ -312,13 +313,6 @@ sub db_key
>> return $ring . '/' . $ctx . '/' . $seqno;
>> }
>>
>> -sub global_key
>> -{
>> - my ($ring, $seqno) = @_;
>> -
>> - return $ring . '/' . $seqno;
>> -}
>> -
>> sub sanitize_ctx
>> {
>> my ($ctx, $ring) = @_;
>> @@ -419,6 +413,8 @@ while (<>) {
>> $req{'ring'} = $ring;
>> $req{'seqno'} = $seqno;
>> $req{'ctx'} = $ctx;
>> + die if exists $ctxengines{$ctx} and $ctxengines{$ctx} ne $ring;
>> + $ctxengines{$ctx} = $ring;
>> $ctxtimelines{$ctx . '/' . $ring} = 1;
>> $req{'name'} = $ctx . '/' . $seqno;
>> $req{'global'} = $tp{'global'};
>> @@ -429,16 +425,29 @@ while (<>) {
>> $ringmap{$rings{$ring}} = $ring;
>> $db{$key} = \%req;
>> } elsif ($tp_name eq 'i915:i915_request_out:') {
>> - my $gkey = global_key($ring, $tp{'global'});
>> + my $gkey;
>> +
>
> # Must be paired with a previous i915_request_in
>> + die unless exists $ctxengines{$ctx};
>
> I'd suggest next unless, because there's always a change the capture is
> started part way though someone's workload.
That would need much more work.
>
>> + $gkey = db_key($ctxengines{$ctx}, $ctx, $seqno);
>> +
>> + if ($tp{'completed?'}) {
>> + die unless exists $db{$key};
>> + die unless exists $db{$key}->{'start'};
>> + die if exists $db{$key}->{'end'};
>> +
>> + $db{$key}->{'end'} = $time;
>> + $db{$key}->{'notify'} = $notify{$gkey}
>> + if exists $notify{$gkey};
>
> Hmm. With preempt-to-busy, a request can complete when we are no longer
> tracking it (it completes before we preempt it).
>
> They will still get the schedule-out tracepoint, but marked as
> incomplete, and there will be a signaled tp later before we try and
> resubmit.
This sounds like the request would disappear from the scripts view.
>
>> + } else {
>> + delete $db{$key};
>> + }
>> + } elsif ($tp_name eq 'dma_fence:dma_fence_signaled:') {
>> + my $gkey;
>>
>> - die unless exists $db{$key};
>> - die unless exists $db{$key}->{'start'};
>> - die if exists $db{$key}->{'end'};
>> + die unless exists $ctxengines{$tp{'context'}};
>>
>> - $db{$key}->{'end'} = $time;
>> - $db{$key}->{'notify'} = $notify{$gkey} if exists $notify{$gkey};
>> - } elsif ($tp_name eq 'i915:intel_engine_notify:') {
>> - my $gkey = global_key($ring, $seqno);
>> + $gkey = db_key($ctxengines{$tp{'context'}}, $tp{'context'}, $tp{'seqno'});
>>
>> $notify{$gkey} = $time unless exists $notify{$gkey};
>> } elsif ($tp_name eq 'i915:intel_gpu_freq_change:') {
>> @@ -452,7 +461,7 @@ while (<>) {
>> # find the largest seqno to be used for timeline sorting purposes.
>> my $max_seqno = 0;
>> foreach my $key (keys %db) {
>> - my $gkey = global_key($db{$key}->{'ring'}, $db{$key}->{'global'});
>> + my $gkey = db_key($db{$key}->{'ring'}, $db{$key}->{'ctx'}, $db{$key}->{'seqno'});
>>
>> die unless exists $db{$key}->{'start'};
>>
>> @@ -478,14 +487,13 @@ my $key_count = scalar(keys %db);
>>
>> my %engine_timelines;
>>
>> -sub sortEngine {
>> - my $as = $db{$a}->{'global'};
>> - my $bs = $db{$b}->{'global'};
>> +sub sortStart {
>> + my $as = $db{$a}->{'start'};
>> + my $bs = $db{$b}->{'start'};
>> my $val;
>>
>> $val = $as <=> $bs;
>> -
>> - die if $val == 0;
>> + $val = $a cmp $b if $val == 0;
>>
>> return $val;
>> }
>> @@ -497,9 +505,7 @@ sub get_engine_timeline {
>> return $engine_timelines{$ring} if exists $engine_timelines{$ring};
>>
>> @timeline = grep { $db{$_}->{'ring'} eq $ring } keys %db;
>> - # FIXME seqno restart
>> - @timeline = sort sortEngine @timeline;
>> -
>> + @timeline = sort sortStart @timeline;
>> $engine_timelines{$ring} = \@timeline;
>>
>> return \@timeline;
>> @@ -561,20 +567,10 @@ foreach my $gid (sort keys %rings) {
>> $db{$key}->{'no-notify'} = 1;
>> }
>> $db{$key}->{'end'} = $end;
>> + $db{$key}->{'notify'} = $end if $db{$key}->{'notify'} > $end;
>> }
>> }
>>
>> -sub sortStart {
>> - my $as = $db{$a}->{'start'};
>> - my $bs = $db{$b}->{'start'};
>> - my $val;
>> -
>> - $val = $as <=> $bs;
>> - $val = $a cmp $b if $val == 0;
>> -
>> - return $val;
>> -}
>> -
>> my $re_sort = 1;
>> my @sorted_keys;
>>
>> @@ -670,9 +666,13 @@ if ($correct_durations) {
>> next unless exists $db{$key}->{'no-end'};
>> last if $pos == $#{$timeline};
>>
>> - # Shift following request to start after the current one
>> + # Shift following request to start after the current
>> + # one, but only if that wouldn't make it zero duration,
>> + # which would indicate notify arrived after context
>> + # complete.
>> $next_key = ${$timeline}[$pos + 1];
>> - if (exists $db{$key}->{'notify'}) {
>> + if (exists $db{$key}->{'notify'} and
>> + $db{$key}->{'notify'} < $db{$key}->{'end'}) {
>> $db{$next_key}->{'engine-start'} = $db{$next_key}->{'start'};
>> $db{$next_key}->{'start'} = $db{$key}->{'notify'};
>> $re_sort = 1;
>> @@ -750,9 +750,9 @@ foreach my $gid (sort keys %rings) {
>> # Extract all GPU busy intervals and sort them.
>> foreach my $key (@sorted_keys) {
>> next unless $db{$key}->{'ring'} eq $ring;
>> + die if $db{$key}->{'start'} > $db{$key}->{'end'};
>
> Heh, we're out of luck if we want to trace across seqno wraparound.
Yeah, that's another missing thing.
>
> It makes enough sense,
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Thanks. Overall the script could use a cleanup so I'll try to find some
time towards it when this settles.
Regards,
Tvrtko
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-05-13 12:16 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-08 12:10 [igt-dev] [PATCH i-g-t 00/21] Media scalability tooling Tvrtko Ursulin
2019-05-08 12:10 ` [igt-dev] [PATCH i-g-t 01/21] scripts/trace.pl: Fix after intel_engine_notify removal Tvrtko Ursulin
2019-05-08 12:17 ` Chris Wilson
2019-05-09 9:27 ` [Intel-gfx] " Tvrtko Ursulin
2019-05-10 12:33 ` Chris Wilson
2019-05-13 12:16 ` Tvrtko Ursulin [this message]
2019-05-08 12:10 ` [igt-dev] [PATCH i-g-t 02/21] headers: bump Tvrtko Ursulin
2019-05-08 12:10 ` [igt-dev] [PATCH i-g-t 03/21] trace.pl: Virtual engine support Tvrtko Ursulin
2019-05-10 12:52 ` Chris Wilson
2019-05-13 12:30 ` Tvrtko Ursulin
2019-05-08 12:10 ` [igt-dev] [PATCH i-g-t 04/21] trace.pl: Virtual engine preemption support Tvrtko Ursulin
2019-05-10 12:55 ` [igt-dev] [Intel-gfx] " Chris Wilson
2019-05-13 12:38 ` Tvrtko Ursulin
2019-05-08 12:10 ` [Intel-gfx] [PATCH i-g-t 05/21] wsim/media-bench: i915 balancing Tvrtko Ursulin
2019-05-10 13:14 ` [igt-dev] " Chris Wilson
2019-05-13 12:41 ` Tvrtko Ursulin
2019-05-13 12:54 ` Chris Wilson
2019-05-10 13:23 ` [Intel-gfx] " Chris Wilson
2019-05-08 12:10 ` [igt-dev] [PATCH i-g-t 06/21] gem_wsim: Use IGT uapi headers Tvrtko Ursulin
2019-05-10 13:15 ` Chris Wilson
2019-05-08 12:10 ` [igt-dev] [PATCH i-g-t 07/21] gem_wsim: Factor out common error handling Tvrtko Ursulin
2019-05-10 13:15 ` Chris Wilson
2019-05-08 12:10 ` [igt-dev] [PATCH i-g-t 08/21] gem_wsim: More wsim_err Tvrtko Ursulin
2019-05-10 13:16 ` [Intel-gfx] " Chris Wilson
2019-05-08 12:10 ` [Intel-gfx] [PATCH i-g-t 09/21] gem_wsim: Submit fence support Tvrtko Ursulin
2019-05-10 13:18 ` [igt-dev] " Chris Wilson
2019-05-08 12:10 ` [Intel-gfx] [PATCH i-g-t 10/21] gem_wsim: Extract str to engine lookup Tvrtko Ursulin
2019-05-10 13:20 ` [igt-dev] " Chris Wilson
2019-05-13 13:08 ` Tvrtko Ursulin
2019-05-08 12:10 ` [Intel-gfx] [PATCH i-g-t 11/21] gem_wsim: Engine map support Tvrtko Ursulin
2019-05-10 13:26 ` [igt-dev] " Chris Wilson
2019-05-13 13:18 ` Tvrtko Ursulin
2019-05-13 13:29 ` Chris Wilson
2019-05-13 13:40 ` Tvrtko Ursulin
2019-05-08 12:10 ` [igt-dev] [PATCH i-g-t 12/21] gem_wsim: Save some lines by changing to implicit NULL checking Tvrtko Ursulin
2019-05-10 13:28 ` Chris Wilson
2019-05-08 12:10 ` [Intel-gfx] [PATCH i-g-t 13/21] gem_wsim: Compact int command parsing with a macro Tvrtko Ursulin
2019-05-10 13:29 ` [igt-dev] " Chris Wilson
2019-05-13 13:24 ` Tvrtko Ursulin
2019-05-08 12:10 ` [igt-dev] [PATCH i-g-t 14/21] gem_wsim: Engine map load balance command Tvrtko Ursulin
2019-05-10 13:31 ` Chris Wilson
2019-05-15 11:44 ` Tvrtko Ursulin
2019-05-15 11:48 ` Chris Wilson
2019-05-15 11:55 ` Tvrtko Ursulin
2019-05-08 12:10 ` [Intel-gfx] [PATCH i-g-t 15/21] gem_wsim: Engine bond command Tvrtko Ursulin
2019-05-10 13:36 ` [igt-dev] " Chris Wilson
2019-05-13 13:28 ` Tvrtko Ursulin
2019-05-08 12:10 ` [igt-dev] [PATCH i-g-t 16/21] gem_wsim: Some more example workloads Tvrtko Ursulin
2019-05-08 12:27 ` Chris Wilson
2019-05-08 13:50 ` Tvrtko Ursulin
2019-05-08 13:56 ` Chris Wilson
2019-05-08 14:16 ` Tvrtko Ursulin
2019-05-10 13:37 ` Chris Wilson
2019-05-08 12:10 ` [igt-dev] [PATCH i-g-t 17/21] gem_wsim: Infinite batch support Tvrtko Ursulin
2019-05-10 13:48 ` Chris Wilson
2019-05-13 13:59 ` Tvrtko Ursulin
2019-05-13 14:11 ` Chris Wilson
2019-05-08 12:10 ` [igt-dev] [PATCH i-g-t 18/21] gem_wsim: Command line switch for specifying low slice count workloads Tvrtko Ursulin
2019-05-08 12:10 ` [igt-dev] [PATCH i-g-t 19/21] gem_wsim: Per context SSEU control Tvrtko Ursulin
2019-05-14 21:53 ` Chris Wilson
2019-05-08 12:10 ` [igt-dev] [PATCH i-g-t 20/21] gem_wsim: Allow RCS virtual engine with " Tvrtko Ursulin
2019-05-08 12:10 ` [igt-dev] [PATCH i-g-t 21/21] tests/i915_query: Engine discovery tests Tvrtko Ursulin
2019-05-08 12:53 ` [igt-dev] ✓ Fi.CI.BAT: success for Media scalability tooling (rev2) Patchwork
2019-05-08 16:01 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f6f1943c-b216-e1d4-832f-323311bfae9b@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=Intel-gfx@lists.freedesktop.org \
--cc=chris@chris-wilson.co.uk \
--cc=igt-dev@lists.freedesktop.org \
--cc=tvrtko.ursulin@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox