[PATCH 0/3] GLIBC LOONGARCH PATCHES

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Thu Jul 28 12:53:36 GMT 2022



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
> 


More information about the Libc-alpha mailing list