[PATCH i-g-t v5 19/22] tests/core_hotunplug: Duplicate debug messages in dmesg

Janusz Krzysztofik janusz.krzysztofik at linux.intel.com
Tue Aug 25 10:58:13 UTC 2020


The purpose of debug messages displayed by the test is to make
identification of a subtest phase that fails more easy.  Since issues
exhibited by the test are mostly reported to dmesg, print those debug
messages to /dev/kmsg as well.

v2: Rebase on upstream.
v3: Refresh.

Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik at linux.intel.com>
---
 tests/core_hotunplug.c | 32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/tests/core_hotunplug.c b/tests/core_hotunplug.c
index f919fa6de..ae7fe18ad 100644
--- a/tests/core_hotunplug.c
+++ b/tests/core_hotunplug.c
@@ -52,6 +52,12 @@ struct hotunplug {
 
 /* Helpers */
 
+#define local_debug(fmt, msg...)			       \
+({							       \
+	igt_debug(fmt, msg);				       \
+	igt_kmsg(KMSG_DEBUG "%s: " fmt, igt_test_name(), msg); \
+})
+
 /**
  * Subtests must be able to close examined devices completely.  Don't
  * use drm_open_driver() since in case of an i915 device it opens it
@@ -61,7 +67,7 @@ static int local_drm_open_driver(const char *prefix, const char *suffix)
 {
 	int fd_drm;
 
-	igt_debug("%sopening device%s\n", prefix, suffix);
+	local_debug("%sopening device%s\n", prefix, suffix);
 
 	fd_drm = __drm_open_driver(DRIVER_ANY);
 	igt_assert_fd(fd_drm);
@@ -120,7 +126,7 @@ static void prepare(struct hotunplug *priv)
 static void driver_unbind(struct hotunplug *priv, const char *prefix,
 			  int timeout)
 {
-	igt_debug("%sunbinding the driver from the device\n", prefix);
+	local_debug("%sunbinding the driver from the device\n", prefix);
 	priv->failure = "Driver unbind failure!";
 
 	igt_set_timeout(timeout, "Driver unbind timeout!");
@@ -136,7 +142,7 @@ static void driver_unbind(struct hotunplug *priv, const char *prefix,
 /* Re-bind the driver to the device */
 static void driver_bind(struct hotunplug *priv, int timeout)
 {
-	igt_debug("rebinding the driver to the device\n");
+	local_debug("%s\n", "rebinding the driver to the device");
 	priv->failure = "Driver re-bind failure!";
 
 	igt_set_timeout(timeout, "Driver re-bind timeout!");
@@ -160,7 +166,7 @@ static void device_unplug(struct hotunplug *priv, const char *prefix,
 				    O_DIRECTORY);
 	igt_assert_fd(priv->fd.sysfs_dev);
 
-	igt_debug("%sunplugging the device\n", prefix);
+	local_debug("%sunplugging the device\n", prefix);
 	priv->failure = "Device unplug failure!";
 
 	igt_set_timeout(timeout, "Device unplug timeout!");
@@ -178,7 +184,7 @@ static void device_unplug(struct hotunplug *priv, const char *prefix,
 /* Re-discover the device by rescanning its bus */
 static void bus_rescan(struct hotunplug *priv, int timeout)
 {
-	igt_debug("rediscovering the device\n");
+	local_debug("%s\n", "rediscovering the device");
 	priv->failure = "Bus rescan failure!";
 
 	igt_set_timeout(timeout, "Bus rescan timeout!");
@@ -231,7 +237,7 @@ static int local_i915_healthcheck(int i915)
 	if (hang_detected)
 		return -EIO;
 
-	igt_debug("running i915 GPU healthcheck\n");
+	local_debug("%s\n", "running i915 GPU healthcheck");
 
 	if (local_i915_is_wedged(i915))
 		return -EIO;
@@ -262,7 +268,7 @@ static int local_i915_healthcheck(int i915)
 
 static int local_i915_recover(int i915)
 {
-	igt_debug("forcing i915 GPU reset\n");
+	local_debug("%s\n", "forcing i915 GPU reset");
 
 	igt_force_gpu_reset(i915);
 	hang_detected = false;
@@ -369,7 +375,7 @@ static void hotunbind_lateclose(struct hotunplug *priv)
 
 	driver_unbind(priv, "hot ", 0);
 
-	igt_debug("late closing the unbound device instance\n");
+	local_debug("%s\n", "late closing the unbound device instance");
 	priv->fd.drm = close_device(priv->fd.drm);
 	igt_assert_eq(priv->fd.drm, -1);
 }
@@ -380,7 +386,7 @@ static void hotunplug_lateclose(struct hotunplug *priv)
 
 	device_unplug(priv, "hot ", 0);
 
-	igt_debug("late closing the removed device instance\n");
+	local_debug("%s\n", "late closing the removed device instance");
 	priv->fd.drm = close_device(priv->fd.drm);
 	igt_assert_eq(priv->fd.drm, -1);
 }
@@ -391,7 +397,7 @@ static void hotunbind_rebind(struct hotunplug *priv)
 
 	driver_unbind(priv, "hot ", 60);
 
-	igt_debug("late closing the unbound device instance\n");
+	local_debug("%s\n", "late closing the unbound device instance");
 	priv->fd.drm = close_device(priv->fd.drm);
 	igt_assert_eq(priv->fd.drm, -1);
 
@@ -406,7 +412,7 @@ static void hotunplug_rescan(struct hotunplug *priv)
 
 	device_unplug(priv, "hot ", 60);
 
-	igt_debug("late closing the removed device instance\n");
+	local_debug("%s\n", "late closing the removed device instance");
 	priv->fd.drm = close_device(priv->fd.drm);
 	igt_assert_eq(priv->fd.drm, -1);
 
@@ -423,7 +429,7 @@ static void hotrebind_lateclose(struct hotunplug *priv)
 
 	driver_bind(priv, 0);
 
-	igt_debug("late closing the unbound device instance\n");
+	local_debug("%s\n", "late closing the unbound device instance");
 	priv->fd.drm = close_device(priv->fd.drm);
 	igt_assert_eq(priv->fd.drm, -1);
 
@@ -438,7 +444,7 @@ static void hotreplug_lateclose(struct hotunplug *priv)
 
 	bus_rescan(priv, 0);
 
-	igt_debug("late closing the removed device instance\n");
+	local_debug("%s\n", "late closing the removed device instance");
 	priv->fd.drm = close_device(priv->fd.drm);
 	igt_assert_eq(priv->fd.drm, -1);
 
-- 
2.21.1



More information about the Intel-gfx-trybot mailing list