summaryrefslogtreecommitdiff
path: root/tests/core_hotunplug.c
diff options
context:
space:
mode:
authorJanusz Krzysztofik <janusz.krzysztofik@linux.intel.com>2021-04-07 14:29:54 +0200
committerJanusz Krzysztofik <janusz.krzysztofik@linux.intel.com>2021-04-14 17:51:15 +0200
commit870601e7fb4aa8dcb118fd99833d07ce3dd2ea88 (patch)
tree1403ce6f603ee969809b10f6424fdf341d1249e6 /tests/core_hotunplug.c
parentac9dc8487c1d73ad5327737297f0777e6bd2accf (diff)
tests/core_hotunplug: Add perf health check
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 <janusz.krzysztofik@linux.intel.com> Acked-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
Diffstat (limited to 'tests/core_hotunplug.c')
-rw-r--r--tests/core_hotunplug.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/tests/core_hotunplug.c b/tests/core_hotunplug.c
index 56a88fef..e6079fa3 100644
--- a/tests/core_hotunplug.c
+++ b/tests/core_hotunplug.c
@@ -31,6 +31,7 @@
#include <unistd.h>
#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)
@@ -352,7 +364,7 @@ static void node_healthcheck(struct hotunplug *priv, unsigned flags)
char path[200];
local_debug("%s\n", "running device sysfs healthcheck");
- priv->failure = "Device sysfs healthckeck failure!";
+ priv->failure = "Device sysfs healthcheck failure!";
if (igt_sysfs_path(fd_drm, path, sizeof(path))) {
priv->failure = "Device debugfs healthckeck failure!";
if (igt_debugfs_path(fd_drm, path, sizeof(path)))
@@ -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