[igt-dev] [PATCH i-g-t 03/17] trace.pl: Virtual engine preemption support

Tvrtko Ursulin
2018-10-18T15:28:27Z

Use the 'completed?' tracepoint field to detect more robustly when a
request has been preempted and remove it from the engine database if so.

Otherwise the script can hit a scenario where the same global seqno will
be mentioned multiple times (on an engine seqno) which aborts processing.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
scripts/trace.pl | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/scripts/trace.pl b/scripts/trace.pl
index 72747b046202..a55e4f39539a 100755
--- a/scripts/trace.pl
+++ b/scripts/trace.pl
@@ -481,12 +481,16 @@ while (<>) {
} elsif ($tp_name eq 'i915:i915_request_out:') {
my $gkey = global_key($ring, $tp{'global'});

- die unless exists $db{$key};
- die unless exists $db{$key}->{'start'};
- die if exists $db{$key}->{'end'};
+ 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};
+ $db{$key}->{'end'} = $time;
+ $db{$key}->{'notify'} = $notify{$gkey} if exists $notify{$gkey};
+ } else {
+ delete $db{$key};
+ }
} elsif ($tp_name eq 'i915:intel_engine_notify:') {
my $gkey = global_key($ring, $seqno);