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>
This commit is contained in:
Chris Wilson 2016-03-17 09:53:45 +00:00
parent 5df2de7e14
commit 34098b71fa

View File

@ -225,10 +225,14 @@ igt_hang_ring_t igt_hang_ring(int fd, int ring)
static void eat_error_state(void) static void eat_error_state(void)
{ {
int fd; int fd, ret;
fd = igt_debugfs_open("i915_error_state", O_WRONLY); 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); close(fd);
} }