diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2018-09-07 09:27:20 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2018-09-07 17:46:48 +0100 |
commit | 40de31df52ffed5e392d607a83e3aea4efb150e6 (patch) | |
tree | df22a10c961a021ff96f5f95f9b296f04e280145 | |
parent | a4d1158b171ad6774a91562766817d93befdabf6 (diff) |
lib: Cancel all outstanding requests at the end of a test
Quite often on catastrophic failure the test leaves a long queue of
unterminated batches pending execution. Each runs until hangcheck fires
and skips onto the next, leaving us waiting for a very long time at test
exit.
On older kernels, this gracefully degrades into the existing mechanism.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Antonio Argenziano <antonio.argenziano@intel.com>
-rw-r--r-- | lib/drmtest.c | 25 | ||||
-rw-r--r-- | lib/igt_debugfs.h | 12 |
2 files changed, 31 insertions, 6 deletions
diff --git a/lib/drmtest.c b/lib/drmtest.c index bfa2e0f0..fee9d33a 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -302,22 +302,35 @@ static int __drm_open_driver_render(int chipset) static int at_exit_drm_fd = -1; static int at_exit_drm_render_fd = -1; -static void quiescent_gpu_at_exit(int sig) +static void __cancel_work_at_exit(int fd) +{ + igt_terminate_spin_batches(); /* for older kernels */ + + igt_drop_caches_set(fd, + /* cancel everything */ + DROP_RESET_ACTIVE | DROP_RESET_SEQNO | + /* cleanup */ + DROP_ACTIVE | DROP_RETIRE | DROP_IDLE | DROP_FREED); +} + +static void cancel_work_at_exit(int sig) { if (at_exit_drm_fd < 0) return; - gem_quiescent_gpu(at_exit_drm_fd); + __cancel_work_at_exit(at_exit_drm_fd); + close(at_exit_drm_fd); at_exit_drm_fd = -1; } -static void quiescent_gpu_at_exit_render(int sig) +static void cancel_work_at_exit_render(int sig) { if (at_exit_drm_render_fd < 0) return; - gem_quiescent_gpu(at_exit_drm_render_fd); + __cancel_work_at_exit(at_exit_drm_render_fd); + close(at_exit_drm_render_fd); at_exit_drm_render_fd = -1; } @@ -369,7 +382,7 @@ int drm_open_driver(int chipset) gem_quiescent_gpu(fd); at_exit_drm_fd = __drm_open_driver(chipset); - igt_install_exit_handler(quiescent_gpu_at_exit); + igt_install_exit_handler(cancel_work_at_exit); } } @@ -418,7 +431,7 @@ int drm_open_driver_render(int chipset) at_exit_drm_render_fd = __drm_open_driver(chipset); if(chipset & DRIVER_INTEL){ gem_quiescent_gpu(fd); - igt_install_exit_handler(quiescent_gpu_at_exit_render); + igt_install_exit_handler(cancel_work_at_exit_render); } return fd; diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h index ff8612dc..9f81be0a 100644 --- a/lib/igt_debugfs.h +++ b/lib/igt_debugfs.h @@ -191,6 +191,18 @@ void igt_require_hpd_storm_ctl(int fd); */ #define DROP_IDLE 0x40 /** + * DROP_RESET_ACTIVE: + * + * Cancel all outstanding requests by forcing a gpu reset + */ +#define DROP_RESET_ACTIVE 0x80 +/** + * DROP_RESET_SEQNO: + * + * Reset the global request seqno counter back to 0 + */ +#define DROP_RESET_SEQNO 0x100 +/** * DROP_ALL: * * All of the above DROP_ flags combined. |