[PATCH i-g-t] scripts/trace.pl: Rudimentary preemption support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>

Make the script survive preemption by simply forgetting the previous
request_in event happened.

Downside of the trivial approach is that the timeline will not show
the preemption event, but it will be as if the request only got
submitted to the hardware for the first time when it was submitted
the final time, the time it actually ran to completion.

Runnable time accounting will also be over-accounted.

To solve this properly heavier refactoring is needed, and some design
thought, but for the moment this at least makes the script not die.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
Cc: John Harrison <John.C.Harrison@xxxxxxxxx>
---
 scripts/trace.pl | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/scripts/trace.pl b/scripts/trace.pl
index 2628a41abfc4..879e02365f34 100755
--- a/scripts/trace.pl
+++ b/scripts/trace.pl
@@ -423,7 +423,9 @@ while (<>) {
 	} elsif ($tp_name eq 'i915:i915_gem_request_in:') {
 		my %req;
 
-		die if exists $db{$key};
+		# Duplicated req in is a sign of preemption - just forget it
+		# happened before.
+		delete $db{$key} if exists $db{$key};
 		die unless exists $queue{$key};
 		die unless exists $submit{$key};
 
@@ -443,7 +445,8 @@ while (<>) {
 	} elsif ($tp_name eq 'i915:i915_gem_request_out:') {
 		my $gkey = global_key($ring, $tp{'global'});
 
-		die unless exists $db{$key};
+# 		# Probable incomplete trace, not gathered with trace.pl --trace.
+		next unless exists $db{$key};
 		die unless exists $db{$key}->{'start'};
 		die if exists $db{$key}->{'end'};
 
-- 
2.14.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux