From patchwork Thu Mar 29 09:11:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10314771 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 394C460212 for ; Thu, 29 Mar 2018 09:11:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D8172A2C4 for ; Thu, 29 Mar 2018 09:11:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2280F2A2CE; Thu, 29 Mar 2018 09:11:45 +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 A636D2A2CB for ; Thu, 29 Mar 2018 09:11:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D27BE6E1E3; Thu, 29 Mar 2018 09:11:43 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id DD6976E1E3 for ; Thu, 29 Mar 2018 09:11:42 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id v21so9543273wmc.1 for ; Thu, 29 Mar 2018 02:11:42 -0700 (PDT) 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=YB1W+7soK2HgmrKSXVLL93WvJPm4DC2yjBgXO5c0KSE=; b=qDzibxQHBPnga7XT/QX02g16+VO/FKHehhOO2doIZ5/hJVGUKipA8JP+mYvEftj0zy 2dQQ1NNb+SjYrBqtp32SlRDQVHSUpqqBxqA17/G0mp0UJXzCix5tWeXffw/Sl/bPppvt yv4cPJM8K00ImuugfMHgdWE4KrY+QpiztYjBV+PefC6R5EUO80CBtBNFYtojeU/o3kt4 6g4WhFEVSejYZW77uwCjeD51hj+w76MfiR7GxCqJLKEmeOqeBuV4qRr4eQMY/q7ljQh5 8jMMn4b0jsOo2dr2Qv6bM/gMVjdX4VFJLJQF5dsQF1sz6DMyGze0NMFrTbta/HevS2Cx qNpQ== 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=YB1W+7soK2HgmrKSXVLL93WvJPm4DC2yjBgXO5c0KSE=; b=Ic+r5vsWfUDbbSFY1lMqUVKt36Lq2rBXSEVO/S1hkiXcz053G5dbAsIttLVVQO2MW/ n/QCI//j13D+lFNhnqr6VxaQQbckIs8k8JZ6B8w449R0gR037MAMgKGwtNhYN9tQNJD4 HeJUsACiTil4u6AjV55pnTencGcBbv2kAHYEKVAcmiKiXlG0qxsk2TKNNT/2jlMQFKEc ZEMwGnioDZPc1eYLZtTlqOFFxA/3VhfsFf1aT0y3euNVtomQQq1mPT+UbFBVBhI5eK97 ZDmBLxqKmbR6Zd+zMABS5P+zXnj2IgbNycutqjDSnkpIoKLDAxc7nBXqTHotXvNc+NRj EzTg== X-Gm-Message-State: AElRT7GShvZw7WR4ztd2GcFzpVFsDgMOAFpybTeOoDVWnwiUIzilsfzZ TeR0YjUo+oMbzOqCpG0ucl2tzA== X-Google-Smtp-Source: AIpwx48vZkf977d/CCCFQv7mgQDdBK31XW5HgK3TqoZoa3l+E9B6/KBZBb3/FOu6FtVucbBmqZrcrQ== X-Received: by 10.28.212.84 with SMTP id l81mr4091023wmg.151.1522314701518; Thu, 29 Mar 2018 02:11:41 -0700 (PDT) Received: from localhost.localdomain ([95.146.144.186]) by smtp.gmail.com with ESMTPSA id u69sm2291186wma.5.2018.03.29.02.11.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Mar 2018 02:11:41 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org Date: Thu, 29 Mar 2018 10:11:28 +0100 Message-Id: <20180329091128.32341-1-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.14.1 Subject: [Intel-gfx] [PATCH i-g-t] tests/perf_pmu: Fix usage of for_each_engine_class_instance 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: Tvrtko Ursulin Wrong file descriptor was passed to the iterator. This had currently no effect, since it wasn't used in the macro, but needs to be fixed. At the same time make the macro consistent by checking for engine presence like the other iterators do. Added __for_each_engine_class_instance which does not check for engine presence and so is useful for enumerating all possible engines - like for instance for subtest enumeration. And another 'wrong fd used' fixlet in the render node subtests. Signed-off-by: Tvrtko Ursulin Reported-by: Michel Thierry Cc: Michel Thierry Reviewed-by: Chris Wilson Reviewed-by: Michel Thierry --- lib/igt_gt.h | 12 +++++++----- tests/perf_pmu.c | 30 ++++++++++-------------------- 2 files changed, 17 insertions(+), 25 deletions(-) diff --git a/lib/igt_gt.h b/lib/igt_gt.h index a517ed7b29a0..d44b7552f3c4 100644 --- a/lib/igt_gt.h +++ b/lib/igt_gt.h @@ -100,11 +100,6 @@ extern const struct intel_execution_engine2 { int instance; } intel_execution_engines2[]; -#define for_each_engine_class_instance(fd__, e__) \ - for ((e__) = intel_execution_engines2;\ - (e__)->name; \ - (e__)++) - unsigned int gem_class_instance_to_eb_flags(int gem_fd, enum drm_i915_gem_engine_class class, @@ -122,4 +117,11 @@ void gem_require_engine(int gem_fd, igt_require(gem_has_engine(gem_fd, class, instance)); } +#define __for_each_engine_class_instance(fd__, e__) \ + for ((e__) = intel_execution_engines2; (e__)->name; (e__)++) + +#define for_each_engine_class_instance(fd__, e__) \ + for ((e__) = intel_execution_engines2; (e__)->name; (e__)++) \ + for_if (gem_has_engine((fd__), (e__)->class, (e__)->instance)) + #endif /* IGT_GT_H */ diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c index b59af81819c7..2273ddb9e684 100644 --- a/tests/perf_pmu.c +++ b/tests/perf_pmu.c @@ -434,10 +434,8 @@ busy_check_all(int gem_fd, const struct intel_execution_engine2 *e, i = 0; fd[0] = -1; - for_each_engine_class_instance(fd, e_) { - if (!gem_has_engine(gem_fd, e_->class, e_->instance)) - continue; - else if (e == e_) + for_each_engine_class_instance(gem_fd, e_) { + if (e == e_) busy_idx = i; fd[i++] = open_group(I915_PMU_ENGINE_BUSY(e_->class, @@ -499,10 +497,7 @@ most_busy_check_all(int gem_fd, const struct intel_execution_engine2 *e, unsigned int idle_idx, i; i = 0; - for_each_engine_class_instance(fd, e_) { - if (!gem_has_engine(gem_fd, e_->class, e_->instance)) - continue; - + for_each_engine_class_instance(gem_fd, e_) { if (e == e_) idle_idx = i; else if (spin) @@ -559,10 +554,7 @@ all_busy_check_all(int gem_fd, const unsigned int num_engines, unsigned int i; i = 0; - for_each_engine_class_instance(fd, e) { - if (!gem_has_engine(gem_fd, e->class, e->instance)) - continue; - + for_each_engine_class_instance(gem_fd, e) { if (spin) __submit_spin_batch(gem_fd, spin, e, 64); else @@ -1677,10 +1669,8 @@ igt_main igt_require_gem(fd); igt_require(i915_type_id() > 0); - for_each_engine_class_instance(fd, e) { - if (gem_has_engine(fd, e->class, e->instance)) - num_engines++; - } + for_each_engine_class_instance(fd, e) + num_engines++; } /** @@ -1689,7 +1679,7 @@ igt_main igt_subtest("invalid-init") invalid_init(); - for_each_engine_class_instance(fd, e) { + __for_each_engine_class_instance(fd, e) { const unsigned int pct[] = { 2, 50, 98 }; /** @@ -1888,7 +1878,7 @@ igt_main gem_quiescent_gpu(fd); } - for_each_engine_class_instance(fd, e) { + __for_each_engine_class_instance(render_fd, e) { igt_subtest_group { igt_fixture { gem_require_engine(render_fd, @@ -1897,10 +1887,10 @@ igt_main } igt_subtest_f("render-node-busy-%s", e->name) - single(fd, e, TEST_BUSY); + single(render_fd, e, TEST_BUSY); igt_subtest_f("render-node-busy-idle-%s", e->name) - single(fd, e, + single(render_fd, e, TEST_BUSY | TEST_TRAILING_IDLE); } }