Re: [PATCH vdsotest] Use vdso wrapper for gettimeofday()

2020-04-13 Thread Nathan Lynch
Christophe Leroy  writes:
> Hi Nathan,
>
> Le 16/01/2020 à 17:56, Nathan Lynch a écrit :
>> Hi Christophe,
>> 
>> Christophe Leroy  writes:
>>> To properly handle errors returned by gettimeofday(), the
>>> DO_VDSO_CALL() macro has to be used, otherwise vdsotest
>>> misinterpret VDSO function return on error.
>>>
>>> This has gone unnoticed until now because the powerpc VDSO
>>> gettimeofday() always succeed, but while porting powerpc to
>>> generic C VDSO, the following has been encountered:
>> 
>> Thanks for this, I'll review it soon.
>> 
>> Can you point me to patches for the powerpc generic vdso work?
>> 
>
> I have not seen any update on the vdsotest repository, have you been 
> able to have a look at the patch ?

Thanks for the reminder. I've applied this now.


Re: [PATCH vdsotest] Use vdso wrapper for gettimeofday()

2020-04-07 Thread Christophe Leroy

Hi Nathan,

Le 16/01/2020 à 17:56, Nathan Lynch a écrit :

Hi Christophe,

Christophe Leroy  writes:

To properly handle errors returned by gettimeofday(), the
DO_VDSO_CALL() macro has to be used, otherwise vdsotest
misinterpret VDSO function return on error.

This has gone unnoticed until now because the powerpc VDSO
gettimeofday() always succeed, but while porting powerpc to
generic C VDSO, the following has been encountered:


Thanks for this, I'll review it soon.

Can you point me to patches for the powerpc generic vdso work?



I have not seen any update on the vdsotest repository, have you been 
able to have a look at the patch ?


Thanks
Christophe


Re: [PATCH vdsotest] Use vdso wrapper for gettimeofday()

2020-01-16 Thread Christophe Leroy




Le 16/01/2020 à 17:56, Nathan Lynch a écrit :

Hi Christophe,

Christophe Leroy  writes:

To properly handle errors returned by gettimeofday(), the
DO_VDSO_CALL() macro has to be used, otherwise vdsotest
misinterpret VDSO function return on error.

This has gone unnoticed until now because the powerpc VDSO
gettimeofday() always succeed, but while porting powerpc to
generic C VDSO, the following has been encountered:


Thanks for this, I'll review it soon.

Can you point me to patches for the powerpc generic vdso work?



Sure.

v3 is at 
https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=152867


I added you in v4 destinees.

Christophe


Re: [PATCH vdsotest] Use vdso wrapper for gettimeofday()

2020-01-16 Thread Nathan Lynch
Hi Christophe,

Christophe Leroy  writes:
> To properly handle errors returned by gettimeofday(), the
> DO_VDSO_CALL() macro has to be used, otherwise vdsotest
> misinterpret VDSO function return on error.
>
> This has gone unnoticed until now because the powerpc VDSO
> gettimeofday() always succeed, but while porting powerpc to
> generic C VDSO, the following has been encountered:

Thanks for this, I'll review it soon.

Can you point me to patches for the powerpc generic vdso work?


[PATCH vdsotest] Use vdso wrapper for gettimeofday()

2020-01-15 Thread Christophe Leroy
To properly handle errors returned by gettimeofday(), the
DO_VDSO_CALL() macro has to be used, otherwise vdsotest
misinterpret VDSO function return on error.

This has gone unnoticed until now because the powerpc VDSO
gettimeofday() always succeed, but while porting powerpc to
generic C VDSO, the following has been encountered:

gettimeofday(valid, UINTPTR_MAX) (VDSO): unexpected return value 14, expected -1
gettimeofday(valid, UINTPTR_MAX) (VDSO): exited with status 1, expected 0
gettimeofday(valid, page (PROT_NONE)) (VDSO): unexpected return value 14, 
expected -1
gettimeofday(valid, page (PROT_NONE)) (VDSO): exited with status 1, expected 0
gettimeofday(valid, page (PROT_READ)) (VDSO): unexpected return value 14, 
expected -1
gettimeofday(valid, page (PROT_READ)) (VDSO): exited with status 1, expected 0
gettimeofday(UINTPTR_MAX, valid) (VDSO): unexpected return value 14, expected -1
gettimeofday(UINTPTR_MAX, valid) (VDSO): exited with status 1, expected 0
gettimeofday(UINTPTR_MAX, NULL) (VDSO): unexpected return value 14, expected -1
gettimeofday(UINTPTR_MAX, NULL) (VDSO): exited with status 1, expected 0
gettimeofday(UINTPTR_MAX, UINTPTR_MAX) (VDSO): unexpected return value 14, 
expected -1
gettimeofday(UINTPTR_MAX, UINTPTR_MAX) (VDSO): exited with status 1, expected 0
gettimeofday(UINTPTR_MAX, page (PROT_NONE)) (VDSO): unexpected return value 14, 
expected -1
gettimeofday(UINTPTR_MAX, page (PROT_NONE)) (VDSO): exited with status 1, 
expected 0
gettimeofday(UINTPTR_MAX, page (PROT_READ)) (VDSO): unexpected return value 14, 
expected -1
gettimeofday(UINTPTR_MAX, page (PROT_READ)) (VDSO): exited with status 1, 
expected 0
gettimeofday(page (PROT_NONE), valid) (VDSO): unexpected return value 14, 
expected -1
gettimeofday(page (PROT_NONE), valid) (VDSO): exited with status 1, expected 0
gettimeofday(page (PROT_NONE), NULL) (VDSO): unexpected return value 14, 
expected -1
gettimeofday(page (PROT_NONE), NULL) (VDSO): exited with status 1, expected 0
Failure threshold (10) reached; stopping test.
gettimeofday(page (PROT_NONE), UINTPTR_MAX) (VDSO): unexpected return value 14, 
expected -1
gettimeofday(page (PROT_NONE), UINTPTR_MAX) (VDSO): exited with status 1, 
expected 0
Failure threshold (10) reached; stopping test.
gettimeofday(page (PROT_NONE), page (PROT_NONE)) (VDSO): unexpected return 
value 14, expected -1
gettimeofday(page (PROT_NONE), page (PROT_NONE)) (VDSO): exited with status 1, 
expected 0
Failure threshold (10) reached; stopping test.
gettimeofday(page (PROT_NONE), page (PROT_READ)) (VDSO): unexpected return 
value 14, expected -1
gettimeofday(page (PROT_NONE), page (PROT_READ)) (VDSO): exited with status 1, 
expected 0
Failure threshold (10) reached; stopping test.
gettimeofday(page (PROT_READ), valid) (VDSO): unexpected return value 14, 
expected -1
gettimeofday(page (PROT_READ), valid) (VDSO): exited with status 1, expected 0
Failure threshold (10) reached; stopping test.
gettimeofday(page (PROT_READ), NULL) (VDSO): unexpected return value 14, 
expected -1
gettimeofday(page (PROT_READ), NULL) (VDSO): exited with status 1, expected 0
Failure threshold (10) reached; stopping test.
gettimeofday(page (PROT_READ), UINTPTR_MAX) (VDSO): unexpected return value 14, 
expected -1
gettimeofday(page (PROT_READ), UINTPTR_MAX) (VDSO): exited with status 1, 
expected 0
Failure threshold (10) reached; stopping test.
gettimeofday(page (PROT_READ), page (PROT_NONE)) (VDSO): unexpected return 
value 14, expected -1
gettimeofday(page (PROT_READ), page (PROT_NONE)) (VDSO): exited with status 1, 
expected 0
Failure threshold (10) reached; stopping test.
gettimeofday(page (PROT_READ), page (PROT_READ)) (VDSO): unexpected return 
value 14, expected -1
gettimeofday(page (PROT_READ), page (PROT_READ)) (VDSO): exited with status 1, 
expected 0
Failure threshold (10) reached; stopping test.
gettimeofday/abi: 18 failures/inconsistencies encountered

Signed-off-by: Christophe Leroy 
---
 src/gettimeofday.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/gettimeofday.c b/src/gettimeofday.c
index c50ecea..472f372 100644
--- a/src/gettimeofday.c
+++ b/src/gettimeofday.c
@@ -54,11 +54,16 @@ static void gettimeofday_syscall_nofail(struct timeval *tv, 
struct timezone *tz)
error(EXIT_FAILURE, errno, "SYS_gettimeofday");
 }
 
+static int gettimeofday_vdso_wrapper(struct timeval *tv, struct timezone *tz)
+{
+   return DO_VDSO_CALL(gettimeofday_vdso, int, 2, tv, tz);
+}
+
 static void gettimeofday_vdso_nofail(struct timeval *tv, struct timezone *tz)
 {
int err;
 
-   err = gettimeofday_vdso(tv, tz);
+   err = gettimeofday_vdso_wrapper(tv, tz);
if (err)
error(EXIT_FAILURE, errno, "gettimeofday");
 }
@@ -153,7 +158,7 @@ static void gettimeofday_bench(struct ctx *ctx, struct 
bench_results *res)
struct timeval tv;
 
if (vdso_has_gettimeofday()) {
-   BENCH(ctx, gettimeofday_vdso(&tv, NULL),
+   BENC