diff --git a/lib/drmtest.c b/lib/drmtest.c index 2dd4540b8..6b7c35e20 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -418,6 +419,33 @@ static bool _is_already_opened(const char *path, int as_idx) return false; } +void peter_drm_stats(const char *msg) +{ + struct timespec uptime_ts; + char *uptime = NULL; + + if (clock_gettime(CLOCK_BOOTTIME, &uptime_ts) != 0) + return; + + asprintf(&uptime, + "%ld.%06ld", + uptime_ts.tv_sec, + uptime_ts.tv_nsec / 1000); + + for (int i = 0; i < _opened_fds_count; i++) { + unsigned long int st_rdev; + int fd, card; + fd = _opened_fds[i].fd; + st_rdev = _opened_fds[i].stat.st_rdev; + card = gnu_dev_minor(st_rdev); + igt_info("[%s] [DRM_CACHE] %s: fd %d, card: %d\n", + uptime, + msg ? msg : "", + fd, + card); + } +} + static int __search_and_open(const char *base, int offset, unsigned int chipset, int as_idx) { const char *forced; diff --git a/lib/drmtest.h b/lib/drmtest.h index 27e5a18e2..d3713e9b9 100644 --- a/lib/drmtest.h +++ b/lib/drmtest.h @@ -145,6 +145,7 @@ bool is_vc4_device(int fd); bool is_xe_device(int fd); bool is_intel_device(int fd); enum intel_driver get_intel_driver(int fd); +extern void peter_drm_stats(const char *msg); /** * do_or_die: diff --git a/tests/core_hotunplug.c b/tests/core_hotunplug.c index 7f17f4423..838404d8b 100644 --- a/tests/core_hotunplug.c +++ b/tests/core_hotunplug.c @@ -39,6 +39,8 @@ #include "igt_kmod.h" #include "igt_sysfs.h" #include "sw_sync.h" +#include "igt_facts.h" + /** * TEST: core hotunplug * Description: Examine behavior of a driver on device hot unplug @@ -614,15 +616,29 @@ static void hotunplug_rescan(struct hotunplug *priv) static void hotrebind(struct hotunplug *priv) { + igt_facts_lists_init(); + + igt_facts("Before it starts"); + peter_drm_stats("Before it starts"); + pre_check(priv); priv->fd.drm = local_drm_open_driver(false, "", " for hot rebind"); + igt_facts("After local_drm_open_driver()"); + peter_drm_stats("After local_drm_open_driver()"); + driver_unbind(priv, "hot ", 60); driver_bind(priv, 0); + igt_facts("After driver_unbind() and driver_bind()"); + peter_drm_stats("After driver_unbind() and driver_bind()"); + igt_assert_f(healthcheck(priv, false), "%s\n", priv->failure); + + igt_facts("After healthcheck()"); + peter_drm_stats("After healthcheck()"); } static void hotreplug(struct hotunplug *priv)