* 0001-Linux-Fix-32-bit-vDSO-for-clock_gettime-on-powerpc32
[not found] <4b3f02e0.6e69.17dd7a7ddcd.Coremail.canpool@163.com>
@ 2021-12-20 12:06 ` canpool
2021-12-20 13:32 ` 0001-Linux-Fix-32-bit-vDSO-for-clock_gettime-on-powerpc32 canpool
2021-12-20 18:51 ` 0001-Linux-Fix-32-bit-vDSO-for-clock_gettime-on-powerpc32 Adhemerval Zanella
0 siblings, 2 replies; 5+ messages in thread
From: canpool @ 2021-12-20 12:06 UTC (permalink / raw)
To: libc-alpha
[-- Attachment #1: Type: text/plain, Size: 2143 bytes --]
branch:master
test:
1)Current
$ trace -r --trace=clock_gettime,clock_gettime64 ./a.out
CLOCK_MONOTONIC errno = Success (0)
CLOCK_MONOTONIC_COARSE errno = Success (0)
CLOCK_REALTIME errno = Success (0)
CLOCK_REALTIME_COARSE errno = Success (0)
0.000000 clock_gettime(CLOCK_MONOTONIC_RAW, {tv_sec=22820, tv_nsec=304499935}) = 0
CLOCK_MONOTONIC_RAW errno = Success (0)
0.012450 clock_gettime(CLOCK_BOOTTIME, {tv_sec=22820, tv_nsec=311351295}) = 0
CLOCK_BOOTTIME errno = Success (0)
0.002625 clock_gettime(CLOCK_PROCESS_CPUTIME_ID, {tv_sec=0, tv_nsec=57978964}) = 0
0.002625 clock_gettime64(CLOCK_PROCESS_CPUTIME_ID, {tv_sec=0, tv_nsec=57978964}) = 0(like this,I forgot the specific data)
CLOCK_PROCESS_CPUTIME_ID errno = Success (0)
0.002314 clock_gettime(CLOCK_THREAD_CPUTIME_ID, {tv_sec=0, tv_nsec=58799688}) = 0
0.002314 clock_gettime64(CLOCK_THREAD_CPUTIME_ID, {tv_sec=0, tv_nsec=58799688}) = 0(like this,I forgot the specific data)
CLOCK_THREAD_CPUTIME_ID errno = Success (0)
0.003358 clock_gettime(CLOCK_TAI, {tv_sec=1262326778, tv_nsec=790176712}) = 0
CLOCK_TAI errno = Success (0)
0.007705 +++ exited with 0 +++
2)After applying the patch
$ trace -r --trace=clock_gettime,clock_gettime64 ./a.out
CLOCK_MONOTONIC errno = Success (0)
CLOCK_MONOTONIC_COARSE errno = Success (0)
CLOCK_REALTIME errno = Success (0)
CLOCK_REALTIME_COARSE errno = Success (0)
0.000000 clock_gettime(CLOCK_MONOTONIC_RAW, {tv_sec=22820, tv_nsec=304499935}) = 0
CLOCK_MONOTONIC_RAW errno = Success (0)
0.012450 clock_gettime(CLOCK_BOOTTIME, {tv_sec=22820, tv_nsec=311351295}) = 0
CLOCK_BOOTTIME errno = Success (0)
0.002625 clock_gettime(CLOCK_PROCESS_CPUTIME_ID, {tv_sec=0, tv_nsec=57978964}) = 0
CLOCK_PROCESS_CPUTIME_ID errno = Success (0)
0.002314 clock_gettime(CLOCK_THREAD_CPUTIME_ID, {tv_sec=0, tv_nsec=58799688}) = 0
CLOCK_THREAD_CPUTIME_ID errno = Success (0)
0.003358 clock_gettime(CLOCK_TAI, {tv_sec=1262326778, tv_nsec=790176712}) = 0
CLOCK_TAI errno = Success (0)
0.007705 +++ exited with 0 +++
| |
canpool
|
|
canpool@163.com
|
签名由网易邮箱大师定制
[-- Attachment #2: test.c --]
[-- Type: text/plain, Size: 1326 bytes --]
#include <time.h>
#include <stdio.h>
#include <errno.h>
//CLOCK_REALTIME
//CLOCK_REALTIME_COARSE
//CLOCK_MONOTONIC
//CLOCK_MONOTONIC_COARSE
//CLOCK_MONOTONIC_RAW
//CLOCK_BOOTTIME
//CLOCK_PROCESS_CPUTIME_ID
//CLOCK_THREAD_CPUTIME_ID
//CLOCK_TAI
int
main (void)
{
struct timespec ts;
errno = 0;
clock_gettime (CLOCK_MONOTONIC, &ts);
printf ("CLOCK_MONOTONIC errno = %m (%d)\n", errno);
errno = 0;
clock_gettime (CLOCK_MONOTONIC_COARSE, &ts);
printf ("CLOCK_MONOTONIC_COARSE errno = %m (%d)\n", errno);
errno = 0;
clock_gettime (CLOCK_REALTIME, &ts);
printf ("CLOCK_REALTIME errno = %m (%d)\n", errno);
errno = 0;
clock_gettime (CLOCK_REALTIME_COARSE, &ts);
printf ("CLOCK_REALTIME_COARSE errno = %m (%d)\n", errno);
errno = 0;
clock_gettime (CLOCK_MONOTONIC_RAW, &ts);
printf ("CLOCK_MONOTONIC_RAW errno = %m (%d)\n", errno);
errno = 0;
clock_gettime (CLOCK_BOOTTIME, &ts);
printf ("CLOCK_BOOTTIME errno = %m (%d)\n", errno);
errno = 0;
clock_gettime (CLOCK_PROCESS_CPUTIME_ID, &ts);
printf ("CLOCK_PROCESS_CPUTIME_ID errno = %m (%d)\n", errno);
errno = 0;
clock_gettime (CLOCK_THREAD_CPUTIME_ID, &ts);
printf ("CLOCK_THREAD_CPUTIME_ID errno = %m (%d)\n", errno);
errno = 0;
clock_gettime (CLOCK_TAI, &ts);
printf ("CLOCK_TAI errno = %m (%d)\n", errno);
return 0;
}
[-- Attachment #3: 0001-Linux-Fix-32-bit-vDSO-for-clock_gettime-on-powerpc32.patch --]
[-- Type: application/octet-stream, Size: 1402 bytes --]
From 1d66f6b86670549165c9899e75594661a2841ee1 Mon Sep 17 00:00:00 2001
From: canpool <canpool@163.com>
Date: Mon, 20 Dec 2021 19:36:32 +0800
Subject: [PATCH] Linux: Fix 32-bit vDSO for clock_gettime on powerpc32
When the clock_id is CLOCK_PROCESS_CPUTIME_ID or CLOCK_THREAD_CPUTIME_ID,
on the 5.10 kernel powerpc 32-bit, the 32-bit vDSO is executed successfully (
because the __kernel_clock_gettime in arch/powerpc/kernel/vdso32/gettimeofday.S
does not support these two IDs, the 32-bit time_t syscall will be used),
but tp32.tv_sec is equal to 0, causing the 64-bit time_t syscall to continue to be used,
resulting in two system calls.
Fix commit 72e84d1db22203e01a43268de71ea8669eca2863.
Signed-off-by: maminjie <maminjie2@huawei.com>
---
sysdeps/unix/sysv/linux/clock_gettime.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sysdeps/unix/sysv/linux/clock_gettime.c b/sysdeps/unix/sysv/linux/clock_gettime.c
index 91df6b3d96..9c7d907325 100644
--- a/sysdeps/unix/sysv/linux/clock_gettime.c
+++ b/sysdeps/unix/sysv/linux/clock_gettime.c
@@ -53,7 +53,7 @@ __clock_gettime64 (clockid_t clock_id, struct __timespec64 *tp)
{
struct timespec tp32;
r = INTERNAL_VSYSCALL_CALL (vdso_time, 2, clock_id, &tp32);
- if (r == 0 && tp32.tv_sec > 0)
+ if (r == 0 && tp32.tv_sec >= 0)
{
*tp = valid_timespec_to_timespec64 (tp32);
return 0;
--
2.17.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: 0001-Linux-Fix-32-bit-vDSO-for-clock_gettime-on-powerpc32
2021-12-20 12:06 ` 0001-Linux-Fix-32-bit-vDSO-for-clock_gettime-on-powerpc32 canpool
@ 2021-12-20 13:32 ` canpool
2021-12-20 18:51 ` 0001-Linux-Fix-32-bit-vDSO-for-clock_gettime-on-powerpc32 Adhemerval Zanella
1 sibling, 0 replies; 5+ messages in thread
From: canpool @ 2021-12-20 13:32 UTC (permalink / raw)
To: libc-alpha
[-- Attachment #1: Type: text/plain, Size: 2311 bytes --]
new patch,change the author information
| |
canpool
|
|
canpool@163.com
|
签名由网易邮箱大师定制
On 12/20/2021 20:06,canpool<canpool@163.com> wrote:
branch:master
test:
1)Current
$ trace -r --trace=clock_gettime,clock_gettime64 ./a.out
CLOCK_MONOTONIC errno = Success (0)
CLOCK_MONOTONIC_COARSE errno = Success (0)
CLOCK_REALTIME errno = Success (0)
CLOCK_REALTIME_COARSE errno = Success (0)
0.000000 clock_gettime(CLOCK_MONOTONIC_RAW, {tv_sec=22820, tv_nsec=304499935}) = 0
CLOCK_MONOTONIC_RAW errno = Success (0)
0.012450 clock_gettime(CLOCK_BOOTTIME, {tv_sec=22820, tv_nsec=311351295}) = 0
CLOCK_BOOTTIME errno = Success (0)
0.002625 clock_gettime(CLOCK_PROCESS_CPUTIME_ID, {tv_sec=0, tv_nsec=57978964}) = 0
0.002625 clock_gettime64(CLOCK_PROCESS_CPUTIME_ID, {tv_sec=0, tv_nsec=57978964}) = 0(like this,I forgot the specific data)
CLOCK_PROCESS_CPUTIME_ID errno = Success (0)
0.002314 clock_gettime(CLOCK_THREAD_CPUTIME_ID, {tv_sec=0, tv_nsec=58799688}) = 0
0.002314 clock_gettime64(CLOCK_THREAD_CPUTIME_ID, {tv_sec=0, tv_nsec=58799688}) = 0(like this,I forgot the specific data)
CLOCK_THREAD_CPUTIME_ID errno = Success (0)
0.003358 clock_gettime(CLOCK_TAI, {tv_sec=1262326778, tv_nsec=790176712}) = 0
CLOCK_TAI errno = Success (0)
0.007705 +++ exited with 0 +++
2)After applying the patch
$ trace -r --trace=clock_gettime,clock_gettime64 ./a.out
CLOCK_MONOTONIC errno = Success (0)
CLOCK_MONOTONIC_COARSE errno = Success (0)
CLOCK_REALTIME errno = Success (0)
CLOCK_REALTIME_COARSE errno = Success (0)
0.000000 clock_gettime(CLOCK_MONOTONIC_RAW, {tv_sec=22820, tv_nsec=304499935}) = 0
CLOCK_MONOTONIC_RAW errno = Success (0)
0.012450 clock_gettime(CLOCK_BOOTTIME, {tv_sec=22820, tv_nsec=311351295}) = 0
CLOCK_BOOTTIME errno = Success (0)
0.002625 clock_gettime(CLOCK_PROCESS_CPUTIME_ID, {tv_sec=0, tv_nsec=57978964}) = 0
CLOCK_PROCESS_CPUTIME_ID errno = Success (0)
0.002314 clock_gettime(CLOCK_THREAD_CPUTIME_ID, {tv_sec=0, tv_nsec=58799688}) = 0
CLOCK_THREAD_CPUTIME_ID errno = Success (0)
0.003358 clock_gettime(CLOCK_TAI, {tv_sec=1262326778, tv_nsec=790176712}) = 0
CLOCK_TAI errno = Success (0)
0.007705 +++ exited with 0 +++
| |
canpool
|
|
canpool@163.com
|
签名由网易邮箱大师定制
[-- Attachment #2: 0001-Linux-Fix-32-bit-vDSO-for-clock_gettime-on-powerpc32.patch --]
[-- Type: application/octet-stream, Size: 1409 bytes --]
From 1d66f6b86670549165c9899e75594661a2841ee1 Mon Sep 17 00:00:00 2001
From: maminjie <maminjie2@huawei.com>
Date: Mon, 20 Dec 2021 19:36:32 +0800
Subject: [PATCH] Linux: Fix 32-bit vDSO for clock_gettime on powerpc32
When the clock_id is CLOCK_PROCESS_CPUTIME_ID or CLOCK_THREAD_CPUTIME_ID,
on the 5.10 kernel powerpc 32-bit, the 32-bit vDSO is executed successfully (
because the __kernel_clock_gettime in arch/powerpc/kernel/vdso32/gettimeofday.S
does not support these two IDs, the 32-bit time_t syscall will be used),
but tp32.tv_sec is equal to 0, causing the 64-bit time_t syscall to continue to be used,
resulting in two system calls.
Fix commit 72e84d1db22203e01a43268de71ea8669eca2863.
Signed-off-by: maminjie <maminjie2@huawei.com>
---
sysdeps/unix/sysv/linux/clock_gettime.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sysdeps/unix/sysv/linux/clock_gettime.c b/sysdeps/unix/sysv/linux/clock_gettime.c
index 91df6b3d96..9c7d907325 100644
--- a/sysdeps/unix/sysv/linux/clock_gettime.c
+++ b/sysdeps/unix/sysv/linux/clock_gettime.c
@@ -53,7 +53,7 @@ __clock_gettime64 (clockid_t clock_id, struct __timespec64 *tp)
{
struct timespec tp32;
r = INTERNAL_VSYSCALL_CALL (vdso_time, 2, clock_id, &tp32);
- if (r == 0 && tp32.tv_sec > 0)
+ if (r == 0 && tp32.tv_sec >= 0)
{
*tp = valid_timespec_to_timespec64 (tp32);
return 0;
--
2.17.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: 0001-Linux-Fix-32-bit-vDSO-for-clock_gettime-on-powerpc32
2021-12-20 12:06 ` 0001-Linux-Fix-32-bit-vDSO-for-clock_gettime-on-powerpc32 canpool
2021-12-20 13:32 ` 0001-Linux-Fix-32-bit-vDSO-for-clock_gettime-on-powerpc32 canpool
@ 2021-12-20 18:51 ` Adhemerval Zanella
2021-12-20 20:01 ` 0001-Linux-Fix-32-bit-vDSO-for-clock_gettime-on-powerpc32 Florian Weimer
1 sibling, 1 reply; 5+ messages in thread
From: Adhemerval Zanella @ 2021-12-20 18:51 UTC (permalink / raw)
To: canpool, libc-alpha
On 20/12/2021 09:06, canpool via Libc-alpha wrote:
>
>
> branch:master
>
>
> test:
> 1)Current
> $ trace -r --trace=clock_gettime,clock_gettime64 ./a.out
> CLOCK_MONOTONIC errno = Success (0)
> CLOCK_MONOTONIC_COARSE errno = Success (0)
> CLOCK_REALTIME errno = Success (0)
> CLOCK_REALTIME_COARSE errno = Success (0)
> 0.000000 clock_gettime(CLOCK_MONOTONIC_RAW, {tv_sec=22820, tv_nsec=304499935}) = 0
> CLOCK_MONOTONIC_RAW errno = Success (0)
> 0.012450 clock_gettime(CLOCK_BOOTTIME, {tv_sec=22820, tv_nsec=311351295}) = 0
> CLOCK_BOOTTIME errno = Success (0)
> 0.002625 clock_gettime(CLOCK_PROCESS_CPUTIME_ID, {tv_sec=0, tv_nsec=57978964}) = 0
> 0.002625 clock_gettime64(CLOCK_PROCESS_CPUTIME_ID, {tv_sec=0, tv_nsec=57978964}) = 0(like this,I forgot the specific data)
> CLOCK_PROCESS_CPUTIME_ID errno = Success (0)
> 0.002314 clock_gettime(CLOCK_THREAD_CPUTIME_ID, {tv_sec=0, tv_nsec=58799688}) = 0
> 0.002314 clock_gettime64(CLOCK_THREAD_CPUTIME_ID, {tv_sec=0, tv_nsec=58799688}) = 0(like this,I forgot the specific data)
> CLOCK_THREAD_CPUTIME_ID errno = Success (0)
> 0.003358 clock_gettime(CLOCK_TAI, {tv_sec=1262326778, tv_nsec=790176712}) = 0
> CLOCK_TAI errno = Success (0)
> 0.007705 +++ exited with 0 +++
>
>
> 2)After applying the patch
> $ trace -r --trace=clock_gettime,clock_gettime64 ./a.out
> CLOCK_MONOTONIC errno = Success (0)
> CLOCK_MONOTONIC_COARSE errno = Success (0)
> CLOCK_REALTIME errno = Success (0)
> CLOCK_REALTIME_COARSE errno = Success (0)
> 0.000000 clock_gettime(CLOCK_MONOTONIC_RAW, {tv_sec=22820, tv_nsec=304499935}) = 0
> CLOCK_MONOTONIC_RAW errno = Success (0)
> 0.012450 clock_gettime(CLOCK_BOOTTIME, {tv_sec=22820, tv_nsec=311351295}) = 0
> CLOCK_BOOTTIME errno = Success (0)
> 0.002625 clock_gettime(CLOCK_PROCESS_CPUTIME_ID, {tv_sec=0, tv_nsec=57978964}) = 0
> CLOCK_PROCESS_CPUTIME_ID errno = Success (0)
> 0.002314 clock_gettime(CLOCK_THREAD_CPUTIME_ID, {tv_sec=0, tv_nsec=58799688}) = 0
> CLOCK_THREAD_CPUTIME_ID errno = Success (0)
> 0.003358 clock_gettime(CLOCK_TAI, {tv_sec=1262326778, tv_nsec=790176712}) = 0
> CLOCK_TAI errno = Success (0)
> 0.007705 +++ exited with 0 +++
>
> From 1d66f6b86670549165c9899e75594661a2841ee1 Mon Sep 17 00:00:00 2001
> From: canpool <canpool@163.com>
> Date: Mon, 20 Dec 2021 19:36:32 +0800
> Subject: [PATCH] Linux: Fix 32-bit vDSO for clock_gettime on powerpc32
>
> When the clock_id is CLOCK_PROCESS_CPUTIME_ID or CLOCK_THREAD_CPUTIME_ID,
> on the 5.10 kernel powerpc 32-bit, the 32-bit vDSO is executed successfully (
> because the __kernel_clock_gettime in arch/powerpc/kernel/vdso32/gettimeofday.S
> does not support these two IDs, the 32-bit time_t syscall will be used),
> but tp32.tv_sec is equal to 0, causing the 64-bit time_t syscall to continue to be used,
> resulting in two system calls.
>
> Fix commit 72e84d1db22203e01a43268de71ea8669eca2863.
>
> Signed-off-by: maminjie <maminjie2@huawei.com>
LGTM, thanks. However I am confused who is the author here, since 'canpool <canpool@163.com>'
is different than the signed-off-by and I think we can't really use alias as authors.
> ---
> sysdeps/unix/sysv/linux/clock_gettime.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sysdeps/unix/sysv/linux/clock_gettime.c b/sysdeps/unix/sysv/linux/clock_gettime.c
> index 91df6b3d96..9c7d907325 100644
> --- a/sysdeps/unix/sysv/linux/clock_gettime.c
> +++ b/sysdeps/unix/sysv/linux/clock_gettime.c
> @@ -53,7 +53,7 @@ __clock_gettime64 (clockid_t clock_id, struct __timespec64 *tp)
> {
> struct timespec tp32;
> r = INTERNAL_VSYSCALL_CALL (vdso_time, 2, clock_id, &tp32);
> - if (r == 0 && tp32.tv_sec > 0)
> + if (r == 0 && tp32.tv_sec >= 0)
> {
> *tp = valid_timespec_to_timespec64 (tp32);
> return 0;
> --
> 2.17.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: 0001-Linux-Fix-32-bit-vDSO-for-clock_gettime-on-powerpc32
2021-12-20 18:51 ` 0001-Linux-Fix-32-bit-vDSO-for-clock_gettime-on-powerpc32 Adhemerval Zanella
@ 2021-12-20 20:01 ` Florian Weimer
2021-12-20 20:03 ` 0001-Linux-Fix-32-bit-vDSO-for-clock_gettime-on-powerpc32 Adhemerval Zanella
0 siblings, 1 reply; 5+ messages in thread
From: Florian Weimer @ 2021-12-20 20:01 UTC (permalink / raw)
To: Adhemerval Zanella via Libc-alpha; +Cc: canpool, Adhemerval Zanella
* Adhemerval Zanella via Libc-alpha:
> LGTM, thanks. However I am confused who is the author here, since
> 'canpool <canpool@163.com>' is different than the signed-off-by and I
> think we can't really use alias as authors.
The FSF accepts contributions under aliases. Given that the change is
so small, I think we can attribute it to the submitter in any way they
want.
Thanks,
Florian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: 0001-Linux-Fix-32-bit-vDSO-for-clock_gettime-on-powerpc32
2021-12-20 20:01 ` 0001-Linux-Fix-32-bit-vDSO-for-clock_gettime-on-powerpc32 Florian Weimer
@ 2021-12-20 20:03 ` Adhemerval Zanella
0 siblings, 0 replies; 5+ messages in thread
From: Adhemerval Zanella @ 2021-12-20 20:03 UTC (permalink / raw)
To: Florian Weimer, Adhemerval Zanella via Libc-alpha; +Cc: canpool
On 20/12/2021 17:01, Florian Weimer wrote:
> * Adhemerval Zanella via Libc-alpha:
>
>> LGTM, thanks. However I am confused who is the author here, since
>> 'canpool <canpool@163.com>' is different than the signed-off-by and I
>> think we can't really use alias as authors.
>
> The FSF accepts contributions under aliases. Given that the change is
> so small, I think we can attribute it to the submitter in any way they
> want.
Alright, lgtm then.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-12-20 20:03 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <4b3f02e0.6e69.17dd7a7ddcd.Coremail.canpool@163.com>
2021-12-20 12:06 ` 0001-Linux-Fix-32-bit-vDSO-for-clock_gettime-on-powerpc32 canpool
2021-12-20 13:32 ` 0001-Linux-Fix-32-bit-vDSO-for-clock_gettime-on-powerpc32 canpool
2021-12-20 18:51 ` 0001-Linux-Fix-32-bit-vDSO-for-clock_gettime-on-powerpc32 Adhemerval Zanella
2021-12-20 20:01 ` 0001-Linux-Fix-32-bit-vDSO-for-clock_gettime-on-powerpc32 Florian Weimer
2021-12-20 20:03 ` 0001-Linux-Fix-32-bit-vDSO-for-clock_gettime-on-powerpc32 Adhemerval Zanella
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).