From patchwork Wed Dec 20 10:21:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10125407 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 1475660388 for ; Wed, 20 Dec 2017 10:21:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B08A295D8 for ; Wed, 20 Dec 2017 10:21:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F3626296E9; Wed, 20 Dec 2017 10:21:34 +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 8AFBF295D8 for ; Wed, 20 Dec 2017 10:21:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B37D76E3B1; Wed, 20 Dec 2017 10:21:33 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wm0-x22a.google.com (mail-wm0-x22a.google.com [IPv6:2a00:1450:400c:c09::22a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 645BD6E3B1 for ; Wed, 20 Dec 2017 10:21:32 +0000 (UTC) Received: by mail-wm0-x22a.google.com with SMTP id g130so15064171wme.0 for ; Wed, 20 Dec 2017 02:21:32 -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; bh=+NONoyLEjLhJe0V3w7G9iJKIO3+cHE+sMxrqBoBbv8E=; b=OkyFIT7CsvVzv3JNaUlyueZpJ6s7W5e50wX1T3NlRbWgohmPgBmQ8f7z5DIkesIWKS FDiclCksVqGBUW29Y7OD5oaW6BEGREKR5FaohI2QtWkV2/xcp4kCUlQOt9pOy8A0Ax8K pr90YPen6rp4ZZK3LVHb02yEFc3uT4smv41iEg/xX+dUtLpUDeOOBGhIju4dk0oEBbLd /mdGzijy5T/7sgMxNl4djHpsr8Py4toHGv+p0OSTwd4o67Fqdnf+gPhV+bUARjrgqCMw ed4+vvS6+Dit200SmVpEx3iBHUejhz7vLgUb4MYEtCf3lDwQs9bWkn9WMaSc7Kp/EANT TJkw== 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; bh=+NONoyLEjLhJe0V3w7G9iJKIO3+cHE+sMxrqBoBbv8E=; b=Oy6kAnfcxoedjogu9HsJldvGiANtdM01uJB8we+YiaWyvIK3ODAT1Ku/mmpaxrK+Jz fYIurrB4b7tjz1jNpXbqCNFU82ZIaJcZ0DctYTgZVSnnYI0eav2FIV8EOpGjkYj7U/Km aPrs0mx9ylY3cU0op8+GClq5lihO70AYW5B1ibFsF15GEJ++b+1bGfY7H+p9yVYrzeR1 6iNbgdaCvRldSUrKMwdRHJUwr3q9Gs8W6cLrFjIiG4JTo27iZINcobJM3GgOWLIqPxRH tixcvUJjchJIdXHtECqUSO6MzDCRZ/fOsaR+Yh/V/DQSQANMSrGT3NrNN2dkR/Y4gozB JWRg== X-Gm-Message-State: AKGB3mJ7TTDZ7KfRMCN8euDoSrio8fQSIolJe+RsfHHD8n1ptMjpVETB Kv8SOE4XLwy5VFFbEAOsclNte9Pb X-Google-Smtp-Source: ACJfBotGrSVxxhC2C9PJMA3UjH/xYKGX0e9goQw9Slv6xQGnzMEIjc2CcwW8wIXbXqaPL0z1ICOGpg== X-Received: by 10.28.181.209 with SMTP id e200mr6087785wmf.68.1513765290890; Wed, 20 Dec 2017 02:21:30 -0800 (PST) Received: from localhost.localdomain ([95.146.151.224]) by smtp.gmail.com with ESMTPSA id v62sm18547626wrc.13.2017.12.20.02.21.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 02:21:30 -0800 (PST) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: Intel-gfx@lists.freedesktop.org Date: Wed, 20 Dec 2017 10:21:21 +0000 Message-Id: <20171220102121.17914-1-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.14.1 Subject: [Intel-gfx] [PATCH i-g-t] scripts/trace.pl: Rudimentary preemption support X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Tvrtko Ursulin 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 Cc: John Harrison --- 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'};