From patchwork Tue Mar 6 12:43:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10261585 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6AD8F6037E for ; Tue, 6 Mar 2018 12:43:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C10328A57 for ; Tue, 6 Mar 2018 12:43:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5081828E43; Tue, 6 Mar 2018 12:43:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C88A028A57 for ; Tue, 6 Mar 2018 12:43:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9A5206E6C5; Tue, 6 Mar 2018 12:43:37 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wm0-x233.google.com (mail-wm0-x233.google.com [IPv6:2a00:1450:400c:c09::233]) by gabe.freedesktop.org (Postfix) with ESMTPS id 04E0E6E6B7 for ; Tue, 6 Mar 2018 12:43:30 +0000 (UTC) Received: by mail-wm0-x233.google.com with SMTP id h21so22455798wmd.1 for ; Tue, 06 Mar 2018 04:43:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ursulin-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8vy6OKVtgtEe2opbD6Uh6CGI2tantodKNUv22/B8vIs=; b=k6mNfslohRWXLUqnC6KGEWaml7hDtQTM6xRtA7Q526KKn8/G+HCU06x8Ys9DJ1ezUz k2AzfGToQ72UBUOM58vqKDMXV7vnT/9NAhTolxrOm358F5Fg1Eut1fG2QFcw2A7V8T30 281cii9fn6g9HX0D10jSGUVrIofFy9PfybQotIMH3Ib/HF02tDJ3b3Ywg7GJcg0vhHkN IktVZ5I1t/AwggcvynQEpP5GdKFbjyjYzyA3QtCF26LHHMNAaON9SaFEabXMVDqO6STo 12k/pGsjenRCg5TBLs7jKuE4Mm+NcC25AmqAr5dtXVbDi0tP4sHTGAt/pvEcigZJgyFp lYMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8vy6OKVtgtEe2opbD6Uh6CGI2tantodKNUv22/B8vIs=; b=Y7bKgrJ6TY9aY3H+iSNyhxzRMvaSXGJTG7U9RMXNUeXCKMJPiEjysJuJVyRNeT9GHt GuTmwfAYccwjTLB9xCL+BNrKOPLXr+vkK6kIzqrrQVKSCaHnTGWcDI34/7Ob7ql0wMn5 HuQjk+aWrUXno5lv7pqagyYzOKFxkvEWje2twDYBkblaNDg1OHlvI3RJMSHfyteRScLF DndskusbV2Rijxxmk9W0ukVcHLxdFwCm3qGv52Nk6TIefZVOp7tyr3NfnTWNO/IqlvBY DIS0G3DXbyf7+FYsNWIMhtNttmwKmcb4vqnVWiC3U5N/JnS9OnBP3zk5/Uo9HcXOVjWG WeQg== X-Gm-Message-State: AElRT7Et0yFKQwpgD2nhgls3EpfEZ5rfbpOG6ty453Axsua7ogQfnzGk GilheuJUfHlcvddQQsyUo9zM4w== X-Google-Smtp-Source: AG47ELu+uXrGfhCkosXta9tAMYRephsUQtytotzlPADNiieMXc+SsJA0s8vE0/8qOVLLx/cwj+f9lQ== X-Received: by 10.28.27.194 with SMTP id b185mr10804703wmb.102.1520340209597; Tue, 06 Mar 2018 04:43:29 -0800 (PST) Received: from localhost.localdomain ([95.146.144.186]) by smtp.gmail.com with ESMTPSA id v8sm3646560wmh.25.2018.03.06.04.43.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Mar 2018 04:43:29 -0800 (PST) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org Date: Tue, 6 Mar 2018 12:43:09 +0000 Message-Id: <20180306124315.30208-6-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180306124315.30208-1-tvrtko.ursulin@linux.intel.com> References: <20180306124315.30208-1-tvrtko.ursulin@linux.intel.com> Subject: [Intel-gfx] [PATCH i-g-t 05/11] scripts/trace.pl: Simplify 'end' & 'notify' generation X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Intel-gfx@lists.freedesktop.org MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: John Harrison Delay the auto-generation of end/notify values until the point where everything is known. As opposed to potentially generating them multiple times with differing values (in the case of 'incomplete' entries). v2: More complete description. [Tvrtko] Signed-off-by: John Harrison Cc: Tvrtko Ursulin Reviewed-by: Tvrtko Ursulin --- scripts/trace.pl | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/scripts/trace.pl b/scripts/trace.pl index d880a733bff8..509df6c0dd8b 100755 --- a/scripts/trace.pl +++ b/scripts/trace.pl @@ -467,10 +467,11 @@ while (<>) { } # Sanitation pass to fixup up out of order notify and context complete, and to -# fine the largest seqno to be used for timeline sorting purposes. +# 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 $notify = $notify{$gkey}; die unless exists $db{$key}->{'start'}; @@ -478,23 +479,21 @@ foreach my $key (keys %db) { unless (exists $db{$key}->{'end'}) { # Context complete not received. - if (exists $notify{$gkey}) { + $db{$key}->{'no-end'} = 1; + + if (defined($notify)) { # No context complete due req merging - use notify. - $db{$key}->{'notify'} = $notify{$gkey}; - $db{$key}->{'end'} = $db{$key}->{'notify'}; - $db{$key}->{'no-end'} = 1; + $db{$key}->{'notify'} = $notify; + $db{$key}->{'end'} = $notify; } else { - # No notify and no context complete - mark it. - $db{$key}->{'no-end'} = 1; - $db{$key}->{'end'} = $db{$key}->{'start'} + 999; - $db{$key}->{'notify'} = $db{$key}->{'end'}; + # No notify and no context complete - give up for now. $db{$key}->{'incomplete'} = 1; } } else { # Notify arrived after context complete. - if (exists $db{$key}->{'no-notify'} and exists $notify{$gkey}) { + if (exists $db{$key}->{'no-notify'} and defined($notify)) { delete $db{$key}->{'no-notify'}; - $db{$key}->{'notify'} = $notify{$gkey}; + $db{$key}->{'notify'} = $notify; } } } @@ -510,6 +509,7 @@ foreach my $key (keys %db) { my $seqno = $db{$key}->{'seqno'}; my $next_key; my $i = 1; + my $end; do { $next_key = db_key($ring, $ctx, $seqno + $i); @@ -518,9 +518,14 @@ foreach my $key (keys %db) { or $i > $key_count); # ugly stop hack if (exists $db{$next_key}) { - $db{$key}->{'notify'} = $db{$next_key}->{'end'}; - $db{$key}->{'end'} = $db{$key}->{'notify'}; + $end = $db{$next_key}->{'end'}; + } else { + # No info at all, fake it: + $end = $db{$key}->{'start'} + 999; } + + $db{$key}->{'notify'} = $end; + $db{$key}->{'end'} = $end; } # GPU time accounting