From fc233ed86b01d962f987312c7aef869c1368e3ab Mon Sep 17 00:00:00 2001 From: Mika Kuoppala Date: Tue, 11 Jun 2013 11:56:53 +0300 Subject: [PATCH 1/1] tests: deal with EINTR and EAGAIN from dfs write Writing might return with these when trying to idle gpu. Bugzilla: http://bugs.freedesktop.org/show_bug.cgi?id=65387 Signed-off-by: Mika Kuoppala --- tests/gem_seqno_wrap.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tests/gem_seqno_wrap.c b/tests/gem_seqno_wrap.c index 776dedc..2ced08d 100644 --- a/tests/gem_seqno_wrap.c +++ b/tests/gem_seqno_wrap.c @@ -446,11 +446,18 @@ static int write_seqno(uint32_t seqno) fh = dfs_open(O_RDWR); assert(snprintf(buf, sizeof(buf), "0x%x", seqno) > 0); - r = write(fh, buf, strnlen(buf, sizeof(buf))); - close(fh); + do { + r = write(fh, buf, strnlen(buf, sizeof(buf))); + if (r < 0) + printf("%s write to dfs: %d\n", + errno == EINTR || errno == EAGAIN ? + "retrying" : "failed", errno); + } while (r == -1 && (errno == EINTR || errno == EAGAIN)); + if (r < 0) - return r; + return errno; + close(fh); assert(r == strnlen(buf, sizeof(buf))); last_seqno = seqno; @@ -459,8 +466,10 @@ static int write_seqno(uint32_t seqno) printf("next_seqno set to: 0x%x\n", seqno); r = __read_seqno(&rb); - if (r < 0) + if (r < 0) { + printf("read from dfs failed with %d\n", r); return r; + } if (rb != seqno) { printf("seqno readback differs rb:0x%x vs w:0x%x\n", rb, seqno); -- 1.7.9.5