public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] lib: Show other clients when SETMASTER fails
@ 2019-05-15 10:21 Chris Wilson
  2019-05-15 11:05 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Chris Wilson @ 2019-05-15 10:21 UTC (permalink / raw)
  To: igt-dev; +Cc: Martin Peres

Currently we only show the clients at DEBUG level which is not
automatically shown for a SKIP. However, failing to SETMASTER is more
often a mistake and we do want to see the other clients. The choice is
at what level to show them? If we want to avoid having extra WARNs in
CI, we should keep them to INFO, but on the hand failing to acquire
SETMASTER is tantamount to failure, so WARN.

References: https://bugs.freedesktop.org/show_bug.cgi?id=110682
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Martin Peres <martin.peres@free.fr>
---
 lib/igt_debugfs.c |  4 ++--
 lib/igt_debugfs.h |  3 ++-
 lib/igt_device.c  | 17 +++++++++++++----
 3 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index dd229c099..82ce18344 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -1145,7 +1145,7 @@ int igt_get_stable_obj_count(int driver)
 	return obj_count;
 }
 
-void igt_debugfs_dump(int device, const char *filename)
+void __igt_debugfs_dump(int device, const char *filename, int level)
 {
 	char *contents;
 	int dir;
@@ -1154,6 +1154,6 @@ void igt_debugfs_dump(int device, const char *filename)
 	contents = igt_sysfs_get(dir, filename);
 	close(dir);
 
-	igt_debug("%s:\n%s\n", filename, contents);
+	igt_log(IGT_LOG_DOMAIN, level, "%s:\n%s\n", filename, contents);
 	free(contents);
 }
diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
index f8e57a6bf..52520b3c5 100644
--- a/lib/igt_debugfs.h
+++ b/lib/igt_debugfs.h
@@ -201,6 +201,7 @@ void igt_enable_prefault(void);
  * gem buffer objects
  */
 int igt_get_stable_obj_count(int driver);
-void igt_debugfs_dump(int device, const char *filename);
+void __igt_debugfs_dump(int device, const char *filename, int level);
+#define igt_debugfs_dump(d, f) __igt_debugfs_dump(d, f, IGT_LOG_DEBUG)
 
 #endif /* __IGT_DEBUGFS_H__ */
diff --git a/lib/igt_device.c b/lib/igt_device.c
index 08f39c8b1..9469e5de2 100644
--- a/lib/igt_device.c
+++ b/lib/igt_device.c
@@ -32,13 +32,20 @@ int __igt_device_set_master(int fd)
 	int err;
 
 	err = 0;
-	if (drmIoctl(fd, DRM_IOCTL_SET_MASTER, NULL))
+	if (drmIoctl(fd, DRM_IOCTL_SET_MASTER, NULL)) {
 		err = -errno;
+		igt_assume(err);
+	}
 
 	errno = 0;
 	return err;
 }
 
+static void show_clients(int fd)
+{
+	__igt_debugfs_dump(fd, "clients", IGT_LOG_WARN);
+}
+
 /**
  * igt_device_set_master: Set the device fd to be DRM master
  * @fd: the device
@@ -48,7 +55,7 @@ int __igt_device_set_master(int fd)
 void igt_device_set_master(int fd)
 {
 	if (__igt_device_set_master(fd)) {
-		igt_debugfs_dump(fd, "clients");
+		show_clients(fd);
 		igt_require_f(__igt_device_set_master(fd) == 0,
 			      "Can't become DRM master, "
 			      "please check if no other DRM client is running.\n");
@@ -60,8 +67,10 @@ int __igt_device_drop_master(int fd)
 	int err;
 
 	err = 0;
-	if (drmIoctl(fd, DRM_IOCTL_DROP_MASTER, NULL))
+	if (drmIoctl(fd, DRM_IOCTL_DROP_MASTER, NULL)) {
 		err = -errno;
+		igt_assume(err);
+	}
 
 	errno = 0;
 	return err;
@@ -81,7 +90,7 @@ void igt_device_drop_master(int fd)
 		return;
 
 	if (__igt_device_drop_master(fd)) {
-		igt_debugfs_dump(fd, "clients");
+		show_clients(fd);
 		igt_assert_f(__igt_device_drop_master(fd) == 0,
 			      "Failed to drop DRM master.\n");
 	}
-- 
2.20.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-05-15 20:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-15 10:21 [igt-dev] [PATCH i-g-t] lib: Show other clients when SETMASTER fails Chris Wilson
2019-05-15 11:05 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-05-15 14:38 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-05-15 19:48 ` [igt-dev] [PATCH i-g-t] " Martin Peres
2019-05-15 20:12   ` Chris Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox