Thread (48 messages) 48 messages, 5 authors, 2018-11-23
STALE2750d

[PATCH 07/27] arm64: Substitute gettimeofday with C implementation

From: arnd@arndb.de (Arnd Bergmann)
Date: 2018-11-14 17:47:24
Also in: linux-arch

On Tue, Nov 13, 2018 at 2:58 AM Vincenzo Frascino
[off-list ref] wrote:
On 09/11/2018 16:13, Arnd Bergmann wrote:
quoted
quoted
diff --git a/arch/arm64/kernel/vdso/vdso.lds.S b/arch/arm64/kernel/vdso/vdso.lds.S
index beca249bc2f3..9de0ffc369c5 100644
--- a/arch/arm64/kernel/vdso/vdso.lds.S
+++ b/arch/arm64/kernel/vdso/vdso.lds.S
@@ -88,6 +88,7 @@ VERSION
                __kernel_gettimeofday;
                __kernel_clock_gettime;
                __kernel_clock_getres;
+               __kernel_time;
        local: *;
        };
 }
I would  prefer to not add any deprecated interfaces in the VDSO. If we
have the 64-bit version of clock_gettime, we don't need the 32-bit version
of it, and we don't need gettimeofday() or time() either. The C library
can easily implement those by calling into clock_gettime.
I like the idea, this would make the vdso lib code more simple and more maintainable.

In this patchset I tried to cover the widest possible scenario making things configurable: each architecture can select and enable exactly what it needs from the vdso common code.

Based on what you are proposing, once the C library will implement things in this way, it will be easy to deprecate and remove the unused code.
Just to clarify: we can never remove interfaces that an older version of the
C library was using. What I'm asking is that we don't introduce any of the
unnecessary ones for architectures that don't already have them.
I am not familiar with the development plans of the various C libraries, but looking at
bionic libc currently seems using all the vdso exposed functions [1].

[1] https://github.com/aosp-mirror/platform_bionic/blob/master/libc/bionic/vdso.cpp
It looks like this implementation checks for each one of them to be present
first and then uses a fallback implementation if it does not exist. This would
clearly let us remove the handlers we don't want to support, but there
are two possible downsides:

- some other libc might be lacking that fallback path
- the fallback might be much slower, e.g. time() should fallback to
  the vdso version of clock_gettime(CLOCK_REALTIME_COARSE) for
  best performance, rather than the time() syscall or CLOCK_REALTIME.

So I'd argue that if an architecture already has a time() vdso implementation,
we probably want to keep that entry point but make it point to the best
generic implementation (i.e. clock_gettime CLOCK_REALTIME_COARSE).

      Arnd
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help