zdtm/static/fd failure on aarch64

Submitted by Dmitry Safonov on June 11, 2018, 2:47 p.m.

Details

Message ID CAJwJo6ZEt1FTzpxdKUXtz9LWQcOZvBp6Xcw=JVLn4vwfuMjW=A@mail.gmail.com
State New
Series "zdtm/static/fd failure on aarch64"
Headers show

Commit Message

Dmitry Safonov June 11, 2018, 2:47 p.m.
2018-06-11 15:35 GMT+01:00 Adrian Reber <adrian@lisas.de>:
> Hi Dmitry,

Hi Adrian,

Thanks for looking into this,

> following tests are still failing on aarch64 on my setup:
>
>  * zdtm/static/fd(h)
>  * zdtm/static/cow01(h)
>  * zdtm/transition/maps007(h)
>
> I started to look closer at zdtm/static/fd and it seems to fail while
> running the mutex_lock() function:
>
> 10:12:24.210:  3813: ERR: ../lib/lock.h:148: futex (errno = 11 (Resource temporarily unavailable))
> 10:12:24.211:  3812: ERR: test.c:256: Test exited on unexpected signal 6
>
> In strace I see the following:
>
> [pid  3813] futex(0xffff9c140000, FUTEX_WAIT, 2618556417, NULL) = -1 EAGAIN (Resource temporarily unavailable)
>
> So somehow it cannot do the lock and fails.
>
> Any ideas what might be wrong here.
>
> In the code there is mmap(... PAGE_SIZE ...) which is done using the
> correct value for that platform.

Could you try with the attached patch?

Patch hide | download patch | download mbox

From 76e9f997fa2f8ba70d663cb7fea43d1ec10bcaeb Mon Sep 17 00:00:00 2001
From: Dmitry Safonov <dima@arista.com>
Date: Mon, 11 Jun 2018 15:44:07 +0100
Subject: [PATCH] zdtm/lib: Check EWOULDBLOCK in errno instead of -EWOULDBLOCK

Syscalls do return negative value in case of an error.
But errno contains the error code itself.

Probably worth to grep other errno comparisons in our code.
(Wonder why Coverity didn't notice this?)

Signed-off-by: Dmitry Safonov <dima@arista.com>
---
 test/zdtm/lib/lock.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/zdtm/lib/lock.h b/test/zdtm/lib/lock.h
index 972ed5769a9f..5444f8f9d743 100644
--- a/test/zdtm/lib/lock.h
+++ b/test/zdtm/lib/lock.h
@@ -146,7 +146,7 @@  static void inline mutex_lock(mutex_t *m)
 		ret = sys_futex(&m->raw, FUTEX_WAIT, c + 1, NULL, NULL, 0);
 		if (ret < 0)
 			pr_perror("futex");
-		BUG_ON(ret < 0 && errno != -EWOULDBLOCK);
+		BUG_ON(ret < 0 && errno != EWOULDBLOCK);
 	}
 }
 
-- 
2.13.6


Comments

Adrian Reber June 11, 2018, 2:52 p.m.
On Mon, Jun 11, 2018 at 03:47:02PM +0100, Dmitry Safonov wrote:
> > following tests are still failing on aarch64 on my setup:
> >
> >  * zdtm/static/fd(h)
> >  * zdtm/static/cow01(h)
> >  * zdtm/transition/maps007(h)
> >
> > I started to look closer at zdtm/static/fd and it seems to fail while
> > running the mutex_lock() function:
> >
> > 10:12:24.210:  3813: ERR: ../lib/lock.h:148: futex (errno = 11 (Resource temporarily unavailable))
> > 10:12:24.211:  3812: ERR: test.c:256: Test exited on unexpected signal 6
> >
> > In strace I see the following:
> >
> > [pid  3813] futex(0xffff9c140000, FUTEX_WAIT, 2618556417, NULL) = -1 EAGAIN (Resource temporarily unavailable)
> >
> > So somehow it cannot do the lock and fails.
> >
> > Any ideas what might be wrong here.
> >
> > In the code there is mmap(... PAGE_SIZE ...) which is done using the
> > correct value for that platform.
> 
> Could you try with the attached patch?
> 
[...]
> -		BUG_ON(ret < 0 && errno != -EWOULDBLOCK);
> +		BUG_ON(ret < 0 && errno != EWOULDBLOCK);

Now it goes into an endless loop writing

 10:50:30.462:  3980: ERR: ../lib/lock.h:148: futex (errno = 11 (Resource temporarily unavailable))

to the output file.

		Adrian