From patchwork Thu Apr 8 08:30:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 12190257 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CD6DC433ED for ; Thu, 8 Apr 2021 08:30:49 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D34F161158 for ; Thu, 8 Apr 2021 08:30:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D34F161158 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6AB276E3F2; Thu, 8 Apr 2021 08:30:48 +0000 (UTC) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by gabe.freedesktop.org (Postfix) with ESMTPS id E7AFB6E3F2 for ; Thu, 8 Apr 2021 08:30:46 +0000 (UTC) IronPort-SDR: XwTkAzMhLpkld0PJi1bp6s0glPRDaW4LUp6IASs5ZTGhF9Y12km2zRDBdx1oih5VMdsZjUjEw0 BTnbzAp838SA== X-IronPort-AV: E=McAfee;i="6000,8403,9947"; a="173571198" X-IronPort-AV: E=Sophos;i="5.82,205,1613462400"; d="scan'208";a="173571198" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2021 01:30:46 -0700 IronPort-SDR: 4ghKaLB3+9t53Z5nGxfS/xP4KKamNmg5i9Jw90Bs99EHiPRTFjmtDMr4w25Z7r9xwMu64hYShz VRRAyigJjmqA== X-IronPort-AV: E=Sophos;i="5.82,205,1613462400"; d="scan'208";a="415659754" Received: from jkrzyszt-mobl1.ger.corp.intel.com ([10.213.1.187]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2021 01:30:44 -0700 From: Janusz Krzysztofik To: igt-dev@lists.freedesktop.oef Date: Thu, 8 Apr 2021 10:30:08 +0200 Message-Id: <20210408083009.22860-1-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH 1/2] tests/core_hotunplug: Add perf health check X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 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 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Sometimes CI reports skips of perf subtests when run subsequently after core_hotunplug. That may be an indication of issues with restoring device perf features on driver (hot)rebind. Detect device perf support at test start and check if still available after driver rebind. If that fails, a post-subtest device recovery step restores the device perf support so no subsequently executed tests are affected. Signed-off-by: Janusz Krzysztofik --- tests/core_hotunplug.c | 22 ++++++++++++++++++++++ tests/meson.build | 8 +++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/tests/core_hotunplug.c b/tests/core_hotunplug.c index 56a88fefd..06f15d845 100644 --- a/tests/core_hotunplug.c +++ b/tests/core_hotunplug.c @@ -31,6 +31,7 @@ #include #include "i915/gem.h" +#include "i915/perf.h" #include "igt.h" #include "igt_device_scan.h" #include "igt_kmod.h" @@ -50,6 +51,7 @@ struct hotunplug { const char *dev_bus_addr; const char *failure; bool need_healthcheck; + bool has_intel_perf; }; /* Helpers */ @@ -319,6 +321,16 @@ static int local_i915_recover(int i915) return local_i915_healthcheck(i915, "post-"); } +static bool local_i915_perf_healthcheck(int i915) +{ + struct intel_perf *intel_perf; + + intel_perf = intel_perf_for_fd(i915); + if (intel_perf) + intel_perf_free(intel_perf); + return intel_perf; +} + #define FLAG_RENDER (1 << 0) #define FLAG_RECOVER (1 << 1) static void node_healthcheck(struct hotunplug *priv, unsigned flags) @@ -360,6 +372,13 @@ static void node_healthcheck(struct hotunplug *priv, unsigned flags) } } + if (!priv->failure && priv->has_intel_perf) { + local_debug("%s\n", "running i915 device perf healthcheck"); + priv->failure = "Device perf healthckeck failure!"; + if (local_i915_perf_healthcheck(fd_drm)) + priv->failure = NULL; + } + fd_drm = close_device(fd_drm, "", "health checked "); if (closed || fd_drm < -1) /* update status for post_healthcheck */ priv->fd.drm_hc = fd_drm; @@ -553,6 +572,7 @@ igt_main .fd = { .drm = -1, .drm_hc = -1, .sysfs_dev = -1, }, .failure = NULL, .need_healthcheck = true, + .has_intel_perf = false, }; igt_fixture { @@ -567,6 +587,8 @@ igt_main gem_quiescent_gpu(fd_drm); igt_require_gem(fd_drm); + priv.has_intel_perf = local_i915_perf_healthcheck(fd_drm); + /** * FIXME: Unbinding the i915 driver on some Haswell * platforms with Azalia audio results in a kernel WARN diff --git a/tests/meson.build b/tests/meson.build index 3e3db7d5b..3f6dc4fe3 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -3,7 +3,6 @@ test_progs = [ 'core_getclient', 'core_getstats', 'core_getversion', - 'core_hotunplug', 'core_setmaster', 'core_setmaster_vs_auth', 'debugfs_test', @@ -361,6 +360,13 @@ test_executables += executable('perf', install : true) test_list += 'perf' +test_executables += executable('core_hotunplug', 'core_hotunplug.c', + dependencies : test_deps + [ lib_igt_i915_perf ], + install_dir : libexecdir, + install_rpath : libexecdir_rpathdir, + install : true) +test_list += 'core_hotunplug' + executable('testdisplay', ['testdisplay.c', 'testdisplay_hotplug.c'], dependencies : test_deps, install_dir : libexecdir,