public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/3] GLIBC LOONGARCH PATCHES
@ 2022-07-28  7:30 caiyinyu
  2022-07-28  7:30 ` [PATCH 1/3] LoongArch: Add vdso support for gettimeofday caiyinyu
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: caiyinyu @ 2022-07-28  7:30 UTC (permalink / raw)
  To: adhemerval.zanella, libc-alpha, i.swmail
  Cc: joseph_myers, carlos, xuchenghua, caiyinyu

Hi:

Considering binutils[1] (2eb132bdfb915) is ready I added vdso support for gettimeofday
back.

These patches are tested with gcc 12.0.1, Linux-5.19 [2].

I also tested vdso after I corrected the macros VDSO_NAME/VDSO_HASH, and the results[3]
are not good compared with Wang xuerui's tests[4].

BTW, there are little difference whether the macros VDSO_NAME/VDSO_HASH
are LINUX_5.10/182947696 or not.

[1] https://sourceware.org/git/?p=binutils-gdb.git;a=shortlog;h=refs/heads/master

[2] Glibc test results:
XPASS: conform/UNIX98/ndbm.h/linknamespace
XPASS: conform/XOPEN2K/ndbm.h/linknamespace
XPASS: conform/XOPEN2K8/ndbm.h/linknamespace
XPASS: conform/XPG42/ndbm.h/linknamespace
UNSUPPORTED: crypt/cert
UNSUPPORTED: elf/tst-env-setuid
UNSUPPORTED: elf/tst-env-setuid-tunables
XPASS: elf/tst-protected1a
XPASS: elf/tst-protected1b
UNSUPPORTED: elf/tst-valgrind-smoke
UNSUPPORTED: misc/tst-adjtimex
UNSUPPORTED: misc/tst-clock_adjtime
UNSUPPORTED: misc/tst-ntp_adjtime
UNSUPPORTED: misc/tst-pkey
UNSUPPORTED: misc/tst-rseq
UNSUPPORTED: misc/tst-rseq-disable
UNSUPPORTED: nptl/test-cond-printers
UNSUPPORTED: nptl/test-condattr-printers
UNSUPPORTED: nptl/test-mutex-printers
UNSUPPORTED: nptl/test-mutexattr-printers
UNSUPPORTED: nptl/test-rwlock-printers
UNSUPPORTED: nptl/test-rwlockattr-printers
UNSUPPORTED: nptl/tst-rseq-nptl
UNSUPPORTED: stdlib/tst-secure-getenv
UNSUPPORTED: time/tst-clock_settime
UNSUPPORTED: time/tst-settimeofday
Summary of test results:
   4579 PASS
     20 UNSUPPORTED
     12 XFAIL
      6 XPASS

[3] vdsotest-bench ( VDSO_NAME/VDSO_HASH -- LINUX_5.10/182947696 ):
clock-gettime-monotonic: syscall: 228 nsec/call
clock-gettime-monotonic:    libc: 243 nsec/call
clock-gettime-monotonic:    vdso: 239 nsec/call
clock-getres-monotonic: syscall: 196 nsec/call
clock-getres-monotonic:    libc: 8 nsec/call
clock-getres-monotonic:    vdso: 5 nsec/call
clock-gettime-monotonic-coarse: syscall: 218 nsec/call
clock-gettime-monotonic-coarse:    libc: 25 nsec/call
clock-gettime-monotonic-coarse:    vdso: 24 nsec/call
clock-getres-monotonic-coarse: syscall: 198 nsec/call
clock-getres-monotonic-coarse:    libc: 8 nsec/call
clock-getres-monotonic-coarse:    vdso: 4 nsec/call
clock-gettime-monotonic-raw: syscall: 228 nsec/call
clock-gettime-monotonic-raw:    libc: 243 nsec/call
clock-gettime-monotonic-raw:    vdso: 240 nsec/call
clock-getres-monotonic-raw: syscall: 197 nsec/call
clock-getres-monotonic-raw:    libc: 8 nsec/call
clock-getres-monotonic-raw:    vdso: 4 nsec/call
clock-gettime-tai: syscall: 231 nsec/call
clock-gettime-tai:    libc: 246 nsec/call
clock-gettime-tai:    vdso: 242 nsec/call
clock-getres-tai: syscall: 197 nsec/call
clock-getres-tai:    libc: 8 nsec/call
clock-getres-tai:    vdso: 4 nsec/call
clock-gettime-boottime: syscall: 229 nsec/call
clock-gettime-boottime:    libc: 243 nsec/call
clock-gettime-boottime:    vdso: 240 nsec/call
clock-getres-boottime: syscall: 196 nsec/call
clock-getres-boottime:    libc: 8 nsec/call
clock-getres-boottime:    vdso: 4 nsec/call
clock-gettime-realtime: syscall: 228 nsec/call
clock-gettime-realtime:    libc: 242 nsec/call
clock-gettime-realtime:    vdso: 239 nsec/call
clock-getres-realtime: syscall: 197 nsec/call
clock-getres-realtime:    libc: 8 nsec/call
clock-getres-realtime:    vdso: 5 nsec/call
clock-gettime-realtime-coarse: syscall: 227 nsec/call
clock-gettime-realtime-coarse:    libc: 25 nsec/call
clock-gettime-realtime-coarse:    vdso: 24 nsec/call
clock-getres-realtime-coarse: syscall: 198 nsec/call
clock-getres-realtime-coarse:    libc: 7 nsec/call
clock-getres-realtime-coarse:    vdso: 4 nsec/call
getcpu: syscall: 178 nsec/call
getcpu:    libc: 179 nsec/call
getcpu:    vdso: not tested
Note: vDSO version of getcpu not found
gettimeofday: syscall: 215 nsec/call
gettimeofday:    libc: 226 nsec/call
gettimeofday:    vdso: 226 nsec/call

[4] Wang xuerui's vdsotest results:
clock-gettime-monotonic: syscall: 183 nsec/call
clock-gettime-monotonic:    libc: 44 nsec/call
clock-gettime-monotonic:    vdso: 34 nsec/call
clock-getres-monotonic: syscall: 152 nsec/call
clock-getres-monotonic:    libc: 19 nsec/call
clock-getres-monotonic:    vdso: 14 nsec/call
clock-gettime-monotonic-coarse: syscall: 172 nsec/call
clock-gettime-monotonic-coarse:    libc: 39 nsec/call
clock-gettime-monotonic-coarse:    vdso: 29 nsec/call
clock-getres-monotonic-coarse: syscall: 154 nsec/call
clock-getres-monotonic-coarse:    libc: 18 nsec/call
clock-getres-monotonic-coarse:    vdso: 14 nsec/call
clock-gettime-monotonic-raw: syscall: 181 nsec/call
clock-gettime-monotonic-raw:    libc: 45 nsec/call
clock-gettime-monotonic-raw:    vdso: 36 nsec/call
clock-getres-monotonic-raw: syscall: 151 nsec/call
clock-getres-monotonic-raw:    libc: 19 nsec/call
clock-getres-monotonic-raw:    vdso: 14 nsec/call
clock-gettime-tai: syscall: 187 nsec/call
clock-gettime-tai:    libc: 44 nsec/call
clock-gettime-tai:    vdso: 34 nsec/call
clock-getres-tai: syscall: 151 nsec/call
clock-getres-tai:    libc: 19 nsec/call
clock-getres-tai:    vdso: 14 nsec/call
clock-gettime-boottime: syscall: 184 nsec/call
clock-gettime-boottime:    libc: 44 nsec/call
clock-gettime-boottime:    vdso: 34 nsec/call
clock-getres-boottime: syscall: 151 nsec/call
clock-getres-boottime:    libc: 19 nsec/call
clock-getres-boottime:    vdso: 14 nsec/call
clock-gettime-realtime: syscall: 181 nsec/call
clock-gettime-realtime:    libc: 44 nsec/call
clock-gettime-realtime:    vdso: 34 nsec/call
clock-getres-realtime: syscall: 151 nsec/call
clock-getres-realtime:    libc: 19 nsec/call
clock-getres-realtime:    vdso: 14 nsec/call
clock-gettime-realtime-coarse: syscall: 179 nsec/call
clock-gettime-realtime-coarse:    libc: 40 nsec/call
clock-gettime-realtime-coarse:    vdso: 29 nsec/call
clock-getres-realtime-coarse: syscall: 154 nsec/call
clock-getres-realtime-coarse:    libc: 18 nsec/call
clock-getres-realtime-coarse:    vdso: 14 nsec/call
getcpu: syscall: 134 nsec/call
getcpu:    libc: 20 nsec/call
getcpu:    vdso: 13 nsec/call
gettimeofday: syscall: 171 nsec/call
gettimeofday:    libc: 47 nsec/call
gettimeofday:    vdso: 33 nsec/call


caiyinyu (3):
  LoongArch: Add vdso support for gettimeofday.
  LoongArch: Fix VDSO_HASH and VDSO_NAME.
  LoongArch: Add greg_t and gregset_t.

 .../unix/sysv/linux/loongarch/gettimeofday.c  | 22 +++++++++++++++++++
 .../unix/sysv/linux/loongarch/sys/ucontext.h  |  3 +++
 sysdeps/unix/sysv/linux/loongarch/sysdep.h    |  5 +++--
 3 files changed, 28 insertions(+), 2 deletions(-)
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/gettimeofday.c

-- 
2.31.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/3] LoongArch: Add vdso support for gettimeofday.
  2022-07-28  7:30 [PATCH 0/3] GLIBC LOONGARCH PATCHES caiyinyu
@ 2022-07-28  7:30 ` caiyinyu
  2022-07-28 12:58   ` Adhemerval Zanella Netto
  2022-07-28  7:30 ` [PATCH 2/3] LoongArch: Fix VDSO_HASH and VDSO_NAME caiyinyu
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: caiyinyu @ 2022-07-28  7:30 UTC (permalink / raw)
  To: adhemerval.zanella, libc-alpha, i.swmail
  Cc: joseph_myers, carlos, xuchenghua, caiyinyu

---
 .../unix/sysv/linux/loongarch/gettimeofday.c  | 22 +++++++++++++++++++
 sysdeps/unix/sysv/linux/loongarch/sysdep.h    |  1 +
 2 files changed, 23 insertions(+)
 create mode 100644 sysdeps/unix/sysv/linux/loongarch/gettimeofday.c

diff --git a/sysdeps/unix/sysv/linux/loongarch/gettimeofday.c b/sysdeps/unix/sysv/linux/loongarch/gettimeofday.c
new file mode 100644
index 0000000000..ee35a08650
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/loongarch/gettimeofday.c
@@ -0,0 +1,22 @@
+/* gettimeofday -- Get the current time of day.
+   Copyright (C) 2022 Free Software Foundation, Inc.
+
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <https://www.gnu.org/licenses/>.  */
+
+
+#define USE_IFUNC_GETTIMEOFDAY
+#include <sysdeps/unix/sysv/linux/gettimeofday.c>
diff --git a/sysdeps/unix/sysv/linux/loongarch/sysdep.h b/sysdeps/unix/sysv/linux/loongarch/sysdep.h
index c586df819c..306e0af3a3 100644
--- a/sysdeps/unix/sysv/linux/loongarch/sysdep.h
+++ b/sysdeps/unix/sysv/linux/loongarch/sysdep.h
@@ -116,6 +116,7 @@
 /* List of system calls which are supported as vsyscalls.  */
 #define HAVE_CLOCK_GETRES64_VSYSCALL "__vdso_clock_getres"
 #define HAVE_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime"
+#define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday"
 #define HAVE_GETCPU_VSYSCALL "__vdso_getcpu"
 
 #define HAVE_CLONE3_WRAPPER 1
-- 
2.31.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 2/3] LoongArch: Fix VDSO_HASH and VDSO_NAME.
  2022-07-28  7:30 [PATCH 0/3] GLIBC LOONGARCH PATCHES caiyinyu
  2022-07-28  7:30 ` [PATCH 1/3] LoongArch: Add vdso support for gettimeofday caiyinyu
@ 2022-07-28  7:30 ` caiyinyu
  2022-07-28 12:57   ` Adhemerval Zanella Netto
  2022-07-28  7:30 ` [PATCH 3/3] LoongArch: Add greg_t and gregset_t caiyinyu
  2022-07-28 12:53 ` [PATCH 0/3] GLIBC LOONGARCH PATCHES Adhemerval Zanella Netto
  3 siblings, 1 reply; 10+ messages in thread
From: caiyinyu @ 2022-07-28  7:30 UTC (permalink / raw)
  To: adhemerval.zanella, libc-alpha, i.swmail
  Cc: joseph_myers, carlos, xuchenghua, caiyinyu

---
 sysdeps/unix/sysv/linux/loongarch/sysdep.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/loongarch/sysdep.h b/sysdeps/unix/sysv/linux/loongarch/sysdep.h
index 306e0af3a3..8a398adb70 100644
--- a/sysdeps/unix/sysv/linux/loongarch/sysdep.h
+++ b/sysdeps/unix/sysv/linux/loongarch/sysdep.h
@@ -110,8 +110,8 @@
 
 #ifndef __ASSEMBLER__
 
-#define VDSO_NAME "LINUX_2.6"
-#define VDSO_HASH 61765110
+#define VDSO_NAME "LINUX_5.10"
+#define VDSO_HASH 182947696
 
 /* List of system calls which are supported as vsyscalls.  */
 #define HAVE_CLOCK_GETRES64_VSYSCALL "__vdso_clock_getres"
-- 
2.31.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 3/3] LoongArch: Add greg_t and gregset_t.
  2022-07-28  7:30 [PATCH 0/3] GLIBC LOONGARCH PATCHES caiyinyu
  2022-07-28  7:30 ` [PATCH 1/3] LoongArch: Add vdso support for gettimeofday caiyinyu
  2022-07-28  7:30 ` [PATCH 2/3] LoongArch: Fix VDSO_HASH and VDSO_NAME caiyinyu
@ 2022-07-28  7:30 ` caiyinyu
  2022-07-28 12:57   ` Adhemerval Zanella Netto
  2022-07-28 12:53 ` [PATCH 0/3] GLIBC LOONGARCH PATCHES Adhemerval Zanella Netto
  3 siblings, 1 reply; 10+ messages in thread
From: caiyinyu @ 2022-07-28  7:30 UTC (permalink / raw)
  To: adhemerval.zanella, libc-alpha, i.swmail
  Cc: joseph_myers, carlos, xuchenghua, caiyinyu

---
 sysdeps/unix/sysv/linux/loongarch/sys/ucontext.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sysdeps/unix/sysv/linux/loongarch/sys/ucontext.h b/sysdeps/unix/sysv/linux/loongarch/sys/ucontext.h
index e334a45a44..db86380d55 100644
--- a/sysdeps/unix/sysv/linux/loongarch/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/loongarch/sys/ucontext.h
@@ -38,6 +38,9 @@
 #define LARCH_REG_S2 25
 #define LARCH_REG_NARGS 8
 
+typedef unsigned long int greg_t;
+/* Container for all general registers.  */
+typedef greg_t gregset_t[32];
 #endif
 
 typedef struct mcontext_t
-- 
2.31.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/3] GLIBC LOONGARCH PATCHES
  2022-07-28  7:30 [PATCH 0/3] GLIBC LOONGARCH PATCHES caiyinyu
                   ` (2 preceding siblings ...)
  2022-07-28  7:30 ` [PATCH 3/3] LoongArch: Add greg_t and gregset_t caiyinyu
@ 2022-07-28 12:53 ` Adhemerval Zanella Netto
  3 siblings, 0 replies; 10+ messages in thread
From: Adhemerval Zanella Netto @ 2022-07-28 12:53 UTC (permalink / raw)
  To: caiyinyu, libc-alpha, i.swmail; +Cc: joseph_myers, carlos, xuchenghua



On 28/07/22 04:30, caiyinyu wrote:
> Hi:
> 
> Considering binutils[1] (2eb132bdfb915) is ready I added vdso support for gettimeofday
> back.
> 

Is ifunc support backported to 2.28? Otherwise glibc gettimeout optimization
will not work properly with minimum support binutils.

> These patches are tested with gcc 12.0.1, Linux-5.19 [2].
> 
> I also tested vdso after I corrected the macros VDSO_NAME/VDSO_HASH, and the results[3]
> are not good compared with Wang xuerui's tests[4].
> 
> BTW, there are little difference whether the macros VDSO_NAME/VDSO_HASH
> are LINUX_5.10/182947696 or not.

It seems that for vDSO resolution the version/hash is not really used
(I will need check why exactly and if it really matters).

In any case the gettimeofday raises some concern regarding binutils support,
and it is also an optimization.  So I think we should postpone it to 2.37,
and we can backport if required.

The VDSO_HASH/VDSO_NAME is ok for 2.36, it loongarch and follows that kernel
exports.

The greg_t and gregset_t is also ok for 2.36, I take the types are used
on some project so we should fix it. 

> 
> [1] https://sourceware.org/git/?p=binutils-gdb.git;a=shortlog;h=refs/heads/master
> 
> [2] Glibc test results:
> XPASS: conform/UNIX98/ndbm.h/linknamespace
> XPASS: conform/XOPEN2K/ndbm.h/linknamespace
> XPASS: conform/XOPEN2K8/ndbm.h/linknamespace
> XPASS: conform/XPG42/ndbm.h/linknamespace
> UNSUPPORTED: crypt/cert
> UNSUPPORTED: elf/tst-env-setuid
> UNSUPPORTED: elf/tst-env-setuid-tunables
> XPASS: elf/tst-protected1a
> XPASS: elf/tst-protected1b
> UNSUPPORTED: elf/tst-valgrind-smoke
> UNSUPPORTED: misc/tst-adjtimex
> UNSUPPORTED: misc/tst-clock_adjtime
> UNSUPPORTED: misc/tst-ntp_adjtime
> UNSUPPORTED: misc/tst-pkey
> UNSUPPORTED: misc/tst-rseq
> UNSUPPORTED: misc/tst-rseq-disable
> UNSUPPORTED: nptl/test-cond-printers
> UNSUPPORTED: nptl/test-condattr-printers
> UNSUPPORTED: nptl/test-mutex-printers
> UNSUPPORTED: nptl/test-mutexattr-printers
> UNSUPPORTED: nptl/test-rwlock-printers
> UNSUPPORTED: nptl/test-rwlockattr-printers
> UNSUPPORTED: nptl/tst-rseq-nptl
> UNSUPPORTED: stdlib/tst-secure-getenv
> UNSUPPORTED: time/tst-clock_settime
> UNSUPPORTED: time/tst-settimeofday
> Summary of test results:
>    4579 PASS
>      20 UNSUPPORTED
>      12 XFAIL
>       6 XPASS
> 
> [3] vdsotest-bench ( VDSO_NAME/VDSO_HASH -- LINUX_5.10/182947696 ):
> clock-gettime-monotonic: syscall: 228 nsec/call
> clock-gettime-monotonic:    libc: 243 nsec/call
> clock-gettime-monotonic:    vdso: 239 nsec/call
> clock-getres-monotonic: syscall: 196 nsec/call
> clock-getres-monotonic:    libc: 8 nsec/call
> clock-getres-monotonic:    vdso: 5 nsec/call
> clock-gettime-monotonic-coarse: syscall: 218 nsec/call
> clock-gettime-monotonic-coarse:    libc: 25 nsec/call
> clock-gettime-monotonic-coarse:    vdso: 24 nsec/call
> clock-getres-monotonic-coarse: syscall: 198 nsec/call
> clock-getres-monotonic-coarse:    libc: 8 nsec/call
> clock-getres-monotonic-coarse:    vdso: 4 nsec/call
> clock-gettime-monotonic-raw: syscall: 228 nsec/call
> clock-gettime-monotonic-raw:    libc: 243 nsec/call
> clock-gettime-monotonic-raw:    vdso: 240 nsec/call
> clock-getres-monotonic-raw: syscall: 197 nsec/call
> clock-getres-monotonic-raw:    libc: 8 nsec/call
> clock-getres-monotonic-raw:    vdso: 4 nsec/call
> clock-gettime-tai: syscall: 231 nsec/call
> clock-gettime-tai:    libc: 246 nsec/call
> clock-gettime-tai:    vdso: 242 nsec/call
> clock-getres-tai: syscall: 197 nsec/call
> clock-getres-tai:    libc: 8 nsec/call
> clock-getres-tai:    vdso: 4 nsec/call
> clock-gettime-boottime: syscall: 229 nsec/call
> clock-gettime-boottime:    libc: 243 nsec/call
> clock-gettime-boottime:    vdso: 240 nsec/call
> clock-getres-boottime: syscall: 196 nsec/call
> clock-getres-boottime:    libc: 8 nsec/call
> clock-getres-boottime:    vdso: 4 nsec/call
> clock-gettime-realtime: syscall: 228 nsec/call
> clock-gettime-realtime:    libc: 242 nsec/call
> clock-gettime-realtime:    vdso: 239 nsec/call
> clock-getres-realtime: syscall: 197 nsec/call
> clock-getres-realtime:    libc: 8 nsec/call
> clock-getres-realtime:    vdso: 5 nsec/call
> clock-gettime-realtime-coarse: syscall: 227 nsec/call
> clock-gettime-realtime-coarse:    libc: 25 nsec/call
> clock-gettime-realtime-coarse:    vdso: 24 nsec/call
> clock-getres-realtime-coarse: syscall: 198 nsec/call
> clock-getres-realtime-coarse:    libc: 7 nsec/call
> clock-getres-realtime-coarse:    vdso: 4 nsec/call
> getcpu: syscall: 178 nsec/call
> getcpu:    libc: 179 nsec/call
> getcpu:    vdso: not tested
> Note: vDSO version of getcpu not found
> gettimeofday: syscall: 215 nsec/call
> gettimeofday:    libc: 226 nsec/call
> gettimeofday:    vdso: 226 nsec/call
> 
> [4] Wang xuerui's vdsotest results:
> clock-gettime-monotonic: syscall: 183 nsec/call
> clock-gettime-monotonic:    libc: 44 nsec/call
> clock-gettime-monotonic:    vdso: 34 nsec/call
> clock-getres-monotonic: syscall: 152 nsec/call
> clock-getres-monotonic:    libc: 19 nsec/call
> clock-getres-monotonic:    vdso: 14 nsec/call
> clock-gettime-monotonic-coarse: syscall: 172 nsec/call
> clock-gettime-monotonic-coarse:    libc: 39 nsec/call
> clock-gettime-monotonic-coarse:    vdso: 29 nsec/call
> clock-getres-monotonic-coarse: syscall: 154 nsec/call
> clock-getres-monotonic-coarse:    libc: 18 nsec/call
> clock-getres-monotonic-coarse:    vdso: 14 nsec/call
> clock-gettime-monotonic-raw: syscall: 181 nsec/call
> clock-gettime-monotonic-raw:    libc: 45 nsec/call
> clock-gettime-monotonic-raw:    vdso: 36 nsec/call
> clock-getres-monotonic-raw: syscall: 151 nsec/call
> clock-getres-monotonic-raw:    libc: 19 nsec/call
> clock-getres-monotonic-raw:    vdso: 14 nsec/call
> clock-gettime-tai: syscall: 187 nsec/call
> clock-gettime-tai:    libc: 44 nsec/call
> clock-gettime-tai:    vdso: 34 nsec/call
> clock-getres-tai: syscall: 151 nsec/call
> clock-getres-tai:    libc: 19 nsec/call
> clock-getres-tai:    vdso: 14 nsec/call
> clock-gettime-boottime: syscall: 184 nsec/call
> clock-gettime-boottime:    libc: 44 nsec/call
> clock-gettime-boottime:    vdso: 34 nsec/call
> clock-getres-boottime: syscall: 151 nsec/call
> clock-getres-boottime:    libc: 19 nsec/call
> clock-getres-boottime:    vdso: 14 nsec/call
> clock-gettime-realtime: syscall: 181 nsec/call
> clock-gettime-realtime:    libc: 44 nsec/call
> clock-gettime-realtime:    vdso: 34 nsec/call
> clock-getres-realtime: syscall: 151 nsec/call
> clock-getres-realtime:    libc: 19 nsec/call
> clock-getres-realtime:    vdso: 14 nsec/call
> clock-gettime-realtime-coarse: syscall: 179 nsec/call
> clock-gettime-realtime-coarse:    libc: 40 nsec/call
> clock-gettime-realtime-coarse:    vdso: 29 nsec/call
> clock-getres-realtime-coarse: syscall: 154 nsec/call
> clock-getres-realtime-coarse:    libc: 18 nsec/call
> clock-getres-realtime-coarse:    vdso: 14 nsec/call
> getcpu: syscall: 134 nsec/call
> getcpu:    libc: 20 nsec/call
> getcpu:    vdso: 13 nsec/call
> gettimeofday: syscall: 171 nsec/call
> gettimeofday:    libc: 47 nsec/call
> gettimeofday:    vdso: 33 nsec/call
> 
> 
> caiyinyu (3):
>   LoongArch: Add vdso support for gettimeofday.
>   LoongArch: Fix VDSO_HASH and VDSO_NAME.
>   LoongArch: Add greg_t and gregset_t.
> 
>  .../unix/sysv/linux/loongarch/gettimeofday.c  | 22 +++++++++++++++++++
>  .../unix/sysv/linux/loongarch/sys/ucontext.h  |  3 +++
>  sysdeps/unix/sysv/linux/loongarch/sysdep.h    |  5 +++--
>  3 files changed, 28 insertions(+), 2 deletions(-)
>  create mode 100644 sysdeps/unix/sysv/linux/loongarch/gettimeofday.c
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/3] LoongArch: Fix VDSO_HASH and VDSO_NAME.
  2022-07-28  7:30 ` [PATCH 2/3] LoongArch: Fix VDSO_HASH and VDSO_NAME caiyinyu
@ 2022-07-28 12:57   ` Adhemerval Zanella Netto
  0 siblings, 0 replies; 10+ messages in thread
From: Adhemerval Zanella Netto @ 2022-07-28 12:57 UTC (permalink / raw)
  To: caiyinyu, libc-alpha, i.swmail; +Cc: joseph_myers, carlos, xuchenghua



On 28/07/22 04:30, caiyinyu wrote:
> ---
>  sysdeps/unix/sysv/linux/loongarch/sysdep.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/loongarch/sysdep.h b/sysdeps/unix/sysv/linux/loongarch/sysdep.h
> index 306e0af3a3..8a398adb70 100644
> --- a/sysdeps/unix/sysv/linux/loongarch/sysdep.h
> +++ b/sysdeps/unix/sysv/linux/loongarch/sysdep.h
> @@ -110,8 +110,8 @@
>  
>  #ifndef __ASSEMBLER__
>  
> -#define VDSO_NAME "LINUX_2.6"
> -#define VDSO_HASH 61765110
> +#define VDSO_NAME "LINUX_5.10"
> +#define VDSO_HASH 182947696
>  
>  /* List of system calls which are supported as vsyscalls.  */
>  #define HAVE_CLOCK_GETRES64_VSYSCALL "__vdso_clock_getres"

LGTM and it is ok for 2.36, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/3] LoongArch: Add greg_t and gregset_t.
  2022-07-28  7:30 ` [PATCH 3/3] LoongArch: Add greg_t and gregset_t caiyinyu
@ 2022-07-28 12:57   ` Adhemerval Zanella Netto
  0 siblings, 0 replies; 10+ messages in thread
From: Adhemerval Zanella Netto @ 2022-07-28 12:57 UTC (permalink / raw)
  To: caiyinyu, libc-alpha, i.swmail; +Cc: joseph_myers, carlos, xuchenghua



On 28/07/22 04:30, caiyinyu wrote:
> ---
>  sysdeps/unix/sysv/linux/loongarch/sys/ucontext.h | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/sysdeps/unix/sysv/linux/loongarch/sys/ucontext.h b/sysdeps/unix/sysv/linux/loongarch/sys/ucontext.h
> index e334a45a44..db86380d55 100644
> --- a/sysdeps/unix/sysv/linux/loongarch/sys/ucontext.h
> +++ b/sysdeps/unix/sysv/linux/loongarch/sys/ucontext.h
> @@ -38,6 +38,9 @@
>  #define LARCH_REG_S2 25
>  #define LARCH_REG_NARGS 8
>  
> +typedef unsigned long int greg_t;
> +/* Container for all general registers.  */
> +typedef greg_t gregset_t[32];
>  #endif
>  
>  typedef struct mcontext_t


LGTM and it is ok for 2.36, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] LoongArch: Add vdso support for gettimeofday.
  2022-07-28  7:30 ` [PATCH 1/3] LoongArch: Add vdso support for gettimeofday caiyinyu
@ 2022-07-28 12:58   ` Adhemerval Zanella Netto
  2022-07-29 15:10     ` Carlos O'Donell
  0 siblings, 1 reply; 10+ messages in thread
From: Adhemerval Zanella Netto @ 2022-07-28 12:58 UTC (permalink / raw)
  To: caiyinyu, libc-alpha, i.swmail; +Cc: joseph_myers, carlos, xuchenghua

I think we should postpone it to 2.37, it is an optimization and we
can backport it if required.

The patch looks ok though.

On 28/07/22 04:30, caiyinyu wrote:
> ---
>  .../unix/sysv/linux/loongarch/gettimeofday.c  | 22 +++++++++++++++++++
>  sysdeps/unix/sysv/linux/loongarch/sysdep.h    |  1 +
>  2 files changed, 23 insertions(+)
>  create mode 100644 sysdeps/unix/sysv/linux/loongarch/gettimeofday.c
> 
> diff --git a/sysdeps/unix/sysv/linux/loongarch/gettimeofday.c b/sysdeps/unix/sysv/linux/loongarch/gettimeofday.c
> new file mode 100644
> index 0000000000..ee35a08650
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/loongarch/gettimeofday.c
> @@ -0,0 +1,22 @@
> +/* gettimeofday -- Get the current time of day.
> +   Copyright (C) 2022 Free Software Foundation, Inc.
> +
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library.  If not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +
> +#define USE_IFUNC_GETTIMEOFDAY
> +#include <sysdeps/unix/sysv/linux/gettimeofday.c>
> diff --git a/sysdeps/unix/sysv/linux/loongarch/sysdep.h b/sysdeps/unix/sysv/linux/loongarch/sysdep.h
> index c586df819c..306e0af3a3 100644
> --- a/sysdeps/unix/sysv/linux/loongarch/sysdep.h
> +++ b/sysdeps/unix/sysv/linux/loongarch/sysdep.h
> @@ -116,6 +116,7 @@
>  /* List of system calls which are supported as vsyscalls.  */
>  #define HAVE_CLOCK_GETRES64_VSYSCALL "__vdso_clock_getres"
>  #define HAVE_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime"
> +#define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday"
>  #define HAVE_GETCPU_VSYSCALL "__vdso_getcpu"
>  
>  #define HAVE_CLONE3_WRAPPER 1

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] LoongArch: Add vdso support for gettimeofday.
  2022-07-28 12:58   ` Adhemerval Zanella Netto
@ 2022-07-29 15:10     ` Carlos O'Donell
  2022-08-03  3:12       ` caiyinyu
  0 siblings, 1 reply; 10+ messages in thread
From: Carlos O'Donell @ 2022-07-29 15:10 UTC (permalink / raw)
  To: Adhemerval Zanella Netto, caiyinyu, libc-alpha, i.swmail
  Cc: joseph_myers, xuchenghua

On 7/28/22 08:58, Adhemerval Zanella Netto wrote:
> I think we should postpone it to 2.37, it is an optimization and we
> can backport it if required.

Agreed, lets wait until after the release for this.

vDSO additions can be done at any point in time after the release and backported.
 
> The patch looks ok though.
> 
> On 28/07/22 04:30, caiyinyu wrote:
>> ---
>>  .../unix/sysv/linux/loongarch/gettimeofday.c  | 22 +++++++++++++++++++
>>  sysdeps/unix/sysv/linux/loongarch/sysdep.h    |  1 +
>>  2 files changed, 23 insertions(+)
>>  create mode 100644 sysdeps/unix/sysv/linux/loongarch/gettimeofday.c
>>
>> diff --git a/sysdeps/unix/sysv/linux/loongarch/gettimeofday.c b/sysdeps/unix/sysv/linux/loongarch/gettimeofday.c
>> new file mode 100644
>> index 0000000000..ee35a08650
>> --- /dev/null
>> +++ b/sysdeps/unix/sysv/linux/loongarch/gettimeofday.c
>> @@ -0,0 +1,22 @@
>> +/* gettimeofday -- Get the current time of day.
>> +   Copyright (C) 2022 Free Software Foundation, Inc.
>> +
>> +   This file is part of the GNU C Library.
>> +
>> +   The GNU C Library is free software; you can redistribute it and/or
>> +   modify it under the terms of the GNU Lesser General Public
>> +   License as published by the Free Software Foundation; either
>> +   version 2.1 of the License, or (at your option) any later version.
>> +
>> +   The GNU C Library is distributed in the hope that it will be useful,
>> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
>> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>> +   Lesser General Public License for more details.
>> +
>> +   You should have received a copy of the GNU Lesser General Public
>> +   License along with the GNU C Library.  If not, see
>> +   <https://www.gnu.org/licenses/>.  */
>> +
>> +
>> +#define USE_IFUNC_GETTIMEOFDAY
>> +#include <sysdeps/unix/sysv/linux/gettimeofday.c>
>> diff --git a/sysdeps/unix/sysv/linux/loongarch/sysdep.h b/sysdeps/unix/sysv/linux/loongarch/sysdep.h
>> index c586df819c..306e0af3a3 100644
>> --- a/sysdeps/unix/sysv/linux/loongarch/sysdep.h
>> +++ b/sysdeps/unix/sysv/linux/loongarch/sysdep.h
>> @@ -116,6 +116,7 @@
>>  /* List of system calls which are supported as vsyscalls.  */
>>  #define HAVE_CLOCK_GETRES64_VSYSCALL "__vdso_clock_getres"
>>  #define HAVE_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime"
>> +#define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday"
>>  #define HAVE_GETCPU_VSYSCALL "__vdso_getcpu"
>>  
>>  #define HAVE_CLONE3_WRAPPER 1
> 


-- 
Cheers,
Carlos.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] LoongArch: Add vdso support for gettimeofday.
  2022-07-29 15:10     ` Carlos O'Donell
@ 2022-08-03  3:12       ` caiyinyu
  0 siblings, 0 replies; 10+ messages in thread
From: caiyinyu @ 2022-08-03  3:12 UTC (permalink / raw)
  To: Carlos O'Donell, Adhemerval Zanella Netto, libc-alpha, i.swmail
  Cc: joseph_myers, xuchenghua


在 2022/7/29 下午11:10, Carlos O'Donell 写道:
> On 7/28/22 08:58, Adhemerval Zanella Netto wrote:
>> I think we should postpone it to 2.37, it is an optimization and we
>> can backport it if required.
> Agreed, lets wait until after the release for this.
>
> vDSO additions can be done at any point in time after the release and backported.


The new vdsotest results with this patch are much better on kernel 5.19 
rc1 (old results[1]):

clock-gettime-monotonic: syscall: 228 nsec/call
clock-gettime-monotonic:    libc: 30 nsec/call
clock-gettime-monotonic:    vdso: 29 nsec/call
clock-getres-monotonic: syscall: 196 nsec/call
clock-getres-monotonic:    libc: 9 nsec/call
clock-getres-monotonic:    vdso: 5 nsec/call
clock-gettime-monotonic-coarse: syscall: 217 nsec/call
clock-gettime-monotonic-coarse:    libc: 25 nsec/call
clock-gettime-monotonic-coarse:    vdso: 24 nsec/call
clock-getres-monotonic-coarse: syscall: 198 nsec/call
clock-getres-monotonic-coarse:    libc: 8 nsec/call
clock-getres-monotonic-coarse:    vdso: 4 nsec/call
clock-gettime-monotonic-raw: syscall: 226 nsec/call
clock-gettime-monotonic-raw:    libc: 30 nsec/call
clock-gettime-monotonic-raw:    vdso: 29 nsec/call
clock-getres-monotonic-raw: syscall: 196 nsec/call
clock-getres-monotonic-raw:    libc: 9 nsec/call
clock-getres-monotonic-raw:    vdso: 5 nsec/call
clock-gettime-tai: syscall: 230 nsec/call
clock-gettime-tai:    libc: 30 nsec/call
clock-gettime-tai:    vdso: 29 nsec/call
clock-getres-tai: syscall: 196 nsec/call
clock-getres-tai:    libc: 9 nsec/call
clock-getres-tai:    vdso: 5 nsec/call
clock-gettime-boottime: syscall: 228 nsec/call
clock-gettime-boottime:    libc: 30 nsec/call
clock-gettime-boottime:    vdso: 29 nsec/call
clock-getres-boottime: syscall: 196 nsec/call
clock-getres-boottime:    libc: 9 nsec/call
clock-getres-boottime:    vdso: 5 nsec/call
clock-gettime-realtime: syscall: 227 nsec/call
clock-gettime-realtime:    libc: 30 nsec/call
clock-gettime-realtime:    vdso: 29 nsec/call
clock-getres-realtime: syscall: 196 nsec/call
clock-getres-realtime:    libc: 9 nsec/call
clock-getres-realtime:    vdso: 5 nsec/call
clock-gettime-realtime-coarse: syscall: 225 nsec/call
clock-gettime-realtime-coarse:    libc: 25 nsec/call
clock-gettime-realtime-coarse:    vdso: 24 nsec/call
clock-getres-realtime-coarse: syscall: 198 nsec/call
clock-getres-realtime-coarse:    libc: 8 nsec/call
clock-getres-realtime-coarse:    vdso: 4 nsec/call
getcpu: syscall: 176 nsec/call
getcpu:    libc: 8 nsec/call
getcpu:    vdso: 6 nsec/call
gettimeofday: syscall: 213 nsec/call
gettimeofday:    libc: 29 nsec/call
gettimeofday:    vdso: 29 nsec/call


[1]: on kernel 5.18

clock-gettime-monotonic: syscall: 228 nsec/call
clock-gettime-monotonic:    libc: 243 nsec/call
clock-gettime-monotonic:    vdso: 239 nsec/call
clock-getres-monotonic: syscall: 196 nsec/call
clock-getres-monotonic:    libc: 8 nsec/call
clock-getres-monotonic:    vdso: 5 nsec/call
clock-gettime-monotonic-coarse: syscall: 218 nsec/call
clock-gettime-monotonic-coarse:    libc: 25 nsec/call
clock-gettime-monotonic-coarse:    vdso: 24 nsec/call
clock-getres-monotonic-coarse: syscall: 198 nsec/call
clock-getres-monotonic-coarse:    libc: 8 nsec/call
clock-getres-monotonic-coarse:    vdso: 4 nsec/call
clock-gettime-monotonic-raw: syscall: 228 nsec/call
clock-gettime-monotonic-raw:    libc: 243 nsec/call
clock-gettime-monotonic-raw:    vdso: 240 nsec/call
clock-getres-monotonic-raw: syscall: 197 nsec/call
clock-getres-monotonic-raw:    libc: 8 nsec/call
clock-getres-monotonic-raw:    vdso: 4 nsec/call
clock-gettime-tai: syscall: 231 nsec/call
clock-gettime-tai:    libc: 246 nsec/call
clock-gettime-tai:    vdso: 242 nsec/call
clock-getres-tai: syscall: 197 nsec/call
clock-getres-tai:    libc: 8 nsec/call
clock-getres-tai:    vdso: 4 nsec/call
clock-gettime-boottime: syscall: 229 nsec/call
clock-gettime-boottime:    libc: 243 nsec/call
clock-gettime-boottime:    vdso: 240 nsec/call
clock-getres-boottime: syscall: 196 nsec/call
clock-getres-boottime:    libc: 8 nsec/call
clock-getres-boottime:    vdso: 4 nsec/call
clock-gettime-realtime: syscall: 228 nsec/call
clock-gettime-realtime:    libc: 242 nsec/call
clock-gettime-realtime:    vdso: 239 nsec/call
clock-getres-realtime: syscall: 197 nsec/call
clock-getres-realtime:    libc: 8 nsec/call
clock-getres-realtime:    vdso: 5 nsec/call
clock-gettime-realtime-coarse: syscall: 227 nsec/call
clock-gettime-realtime-coarse:    libc: 25 nsec/call
clock-gettime-realtime-coarse:    vdso: 24 nsec/call
clock-getres-realtime-coarse: syscall: 198 nsec/call
clock-getres-realtime-coarse:    libc: 7 nsec/call
clock-getres-realtime-coarse:    vdso: 4 nsec/call
getcpu: syscall: 178 nsec/call
getcpu:    libc: 179 nsec/call
getcpu:    vdso: not tested
Note: vDSO version of getcpu not found
gettimeofday: syscall: 215 nsec/call
gettimeofday:    libc: 226 nsec/call
gettimeofday:    vdso: 226 nsec/call


>   
>> The patch looks ok though.
>>
>> On 28/07/22 04:30, caiyinyu wrote:
>>> ---
>>>   .../unix/sysv/linux/loongarch/gettimeofday.c  | 22 +++++++++++++++++++
>>>   sysdeps/unix/sysv/linux/loongarch/sysdep.h    |  1 +
>>>   2 files changed, 23 insertions(+)
>>>   create mode 100644 sysdeps/unix/sysv/linux/loongarch/gettimeofday.c
>>>
>>> diff --git a/sysdeps/unix/sysv/linux/loongarch/gettimeofday.c b/sysdeps/unix/sysv/linux/loongarch/gettimeofday.c
>>> new file mode 100644
>>> index 0000000000..ee35a08650
>>> --- /dev/null
>>> +++ b/sysdeps/unix/sysv/linux/loongarch/gettimeofday.c
>>> @@ -0,0 +1,22 @@
>>> +/* gettimeofday -- Get the current time of day.
>>> +   Copyright (C) 2022 Free Software Foundation, Inc.
>>> +
>>> +   This file is part of the GNU C Library.
>>> +
>>> +   The GNU C Library is free software; you can redistribute it and/or
>>> +   modify it under the terms of the GNU Lesser General Public
>>> +   License as published by the Free Software Foundation; either
>>> +   version 2.1 of the License, or (at your option) any later version.
>>> +
>>> +   The GNU C Library is distributed in the hope that it will be useful,
>>> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>>> +   Lesser General Public License for more details.
>>> +
>>> +   You should have received a copy of the GNU Lesser General Public
>>> +   License along with the GNU C Library.  If not, see
>>> +   <https://www.gnu.org/licenses/>.  */
>>> +
>>> +
>>> +#define USE_IFUNC_GETTIMEOFDAY
>>> +#include <sysdeps/unix/sysv/linux/gettimeofday.c>
>>> diff --git a/sysdeps/unix/sysv/linux/loongarch/sysdep.h b/sysdeps/unix/sysv/linux/loongarch/sysdep.h
>>> index c586df819c..306e0af3a3 100644
>>> --- a/sysdeps/unix/sysv/linux/loongarch/sysdep.h
>>> +++ b/sysdeps/unix/sysv/linux/loongarch/sysdep.h
>>> @@ -116,6 +116,7 @@
>>>   /* List of system calls which are supported as vsyscalls.  */
>>>   #define HAVE_CLOCK_GETRES64_VSYSCALL "__vdso_clock_getres"
>>>   #define HAVE_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime"
>>> +#define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday"
>>>   #define HAVE_GETCPU_VSYSCALL "__vdso_getcpu"
>>>   
>>>   #define HAVE_CLONE3_WRAPPER 1
>


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-08-03  3:12 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-28  7:30 [PATCH 0/3] GLIBC LOONGARCH PATCHES caiyinyu
2022-07-28  7:30 ` [PATCH 1/3] LoongArch: Add vdso support for gettimeofday caiyinyu
2022-07-28 12:58   ` Adhemerval Zanella Netto
2022-07-29 15:10     ` Carlos O'Donell
2022-08-03  3:12       ` caiyinyu
2022-07-28  7:30 ` [PATCH 2/3] LoongArch: Fix VDSO_HASH and VDSO_NAME caiyinyu
2022-07-28 12:57   ` Adhemerval Zanella Netto
2022-07-28  7:30 ` [PATCH 3/3] LoongArch: Add greg_t and gregset_t caiyinyu
2022-07-28 12:57   ` Adhemerval Zanella Netto
2022-07-28 12:53 ` [PATCH 0/3] GLIBC LOONGARCH PATCHES Adhemerval Zanella Netto

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).