diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-03-17 09:53:45 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2016-03-17 09:55:00 +0000 |
commit | 34098b71fa1b365ffb0c12fb84ebb7aa26c8f300 (patch) | |
tree | 2efa6d4e8e0156923dd90f686f71657e1b8af29c /lib/igt_gt.c | |
parent | 5df2de7e14ec320223825db7a5a29a1ac7253ba6 (diff) |
lib/igt_gt: Handle SIGINT whilst writing to i915_error_state
Becareful in case we try and eat the error state whilst interrupts are
being sent and repeat the write() until we finish uninterrupted.
References: https://bugs.freedesktop.org/show_bug.cgi?id=94573
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/igt_gt.c')
-rw-r--r-- | lib/igt_gt.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/igt_gt.c b/lib/igt_gt.c index c7e16e35..d2ae0587 100644 --- a/lib/igt_gt.c +++ b/lib/igt_gt.c @@ -225,10 +225,14 @@ igt_hang_ring_t igt_hang_ring(int fd, int ring) static void eat_error_state(void) { - int fd; + int fd, ret; fd = igt_debugfs_open("i915_error_state", O_WRONLY); - igt_assert(write(fd, "", 1) == 1); + do { + ret = write(fd, "", 1); + if (ret < 0) + ret = -errno; + } while (ret == -EINTR || ret == -EAGAIN); close(fd); } |