Re: [PATCH 00/27] Unify vDSOs across more architectures

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/9/18, Vincenzo Frascino <vincenzo.frascino@xxxxxxx> wrote:
> vDSO (virtual dynamic shared object) is a mechanism that the Linux
> kernel provides as an alternative to system calls to reduce where
> possible the costs in terms of cycles.
> This is possible because certain syscalls like gettimeofday() do
> not write any data and return one or more values that are stored
> in the kernel, which makes relatively safe calling them directly
> as a library function.
>
> Even if the mechanism is pretty much standard, every architecture
> in the last few years ended up implementing their own vDSO library
> in the architectural code.
>
> The purpose of this patch-set is to identify the commonalities in
> between the architectures and try to consolidate the common code
> paths, starting with gettimeofday().

I'm very happy to see the generalization overall, as this is going
to make it much easier to add the 64-bit time_t on the 32-bit
vdso implementations, as well as other extensions we may want
in the future.

> This implementation contains the following design choices:
>  * Every architecture defines the arch specific code in an header in
>    "asm/vdso/".
>  * The generic implementation includes the arch specific one and lives
>    in "lib/vdso".

Makes sense.

>  * The arch specific code for gettimeofday lives in
>    "<arch path>/vdso/gettimeofday.c" and includes the generic code only.
>  * This approach allows to consolidate the common code in a single place
>    with the benefit of avoiding code duplication.

I would prefer to have that named clock_gettime.c and only implement
that one system call there. We can easily have the gettimeofday(),
time() and clock_getres() in the common code where that is needed
for backwards compatibility. As I already mentioned in my comment
for one of the patches, we won't have time() or gettimeofday() system
calls on new architectures, and 32-bit architectures won't have them
with 64-bit time_t.

I suppose we can have the time() and gettimeofday() calls
implemented in the generic vdso for everyone, but then
only hook those up on architectures that already had
them. The implementation of course is trivial based on
clock_gettime() with CLOCK_REALTIME or CLOCK_REALTIME_COARSE
respectively.

> This implementation contains the portings to the common library for: arm64,
> compat mode for arm64, arm and mips.
>
> The mips porting has been tested on qemu for mips32el. A configuration to
> repeat the tests can be found at [4].

Ah, I missed the fact that you didn't do this for x86, so I assumed that
this work was triggered by Thomas' recent cleanup of the x86 clock_gettime
vdso code. I think it would be best to get x86 to use the same code and
get the recent improvements ported to the others as well that way.

      Arnd



[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux