[Intel-gfx] [PATCH i-g-t] tests/vgem_basic: Retry the initial module unload in unload test

Chris Wilson chris at chris-wilson.co.uk
Tue Oct 18 11:36:16 UTC 2016


On Tue, Oct 18, 2016 at 02:25:21PM +0300, Petri Latvala wrote:
> If executed too soon after prime_vgem tests, the vgem unload test
> fails due to its execbuffers still being handled in the kernel. Retry
> the unload three times with sleeps before reporting a skip.

What happened to igt ensuring that the driver was idle before closing a
test? I guess that is complicated by the use of multiple drivers in
vgem.

diff --git a/lib/drmtest.c b/lib/drmtest.c
index 40bbff6..5d3aaa8 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -344,14 +344,18 @@ int drm_open_driver(int chipset)
        fd = __drm_open_driver(chipset);
        igt_skip_on_f(fd<0, "No known gpu found\n");
 
-       if (__sync_fetch_and_add(&open_count, 1))
-               return fd;
-
+       /* For i915, at least, we ensure that the driver is idle before
+        * starting a test and we install an exit handler to wait until
+        * idle before quitting.
+        */
        if (is_i915_device(fd)) {
-               gem_quiescent_gpu(fd);
-               igt_install_exit_handler(quiescent_gpu_at_exit);
+               if (__sync_fetch_and_add(&open_count, 1) == 0) {
+                       gem_quiescent_gpu(fd);
+
+                       at_exit_drm_fd = __drm_open_driver(chipset);
+                       igt_install_exit_handler(quiescent_gpu_at_exit);
+               }
        }
-       at_exit_drm_fd = __drm_open_driver(chipset);
 
        return fd;
 }


-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list