• [PATCH 0/2] m68k: Add vDSO support for TLS and clock_gettime64

    From Stefan@3:633/10 to All on Thursday, January 08, 2026 07:50:01
    This series adds vDSO support for m68k, enabling userspace to access
    the thread pointer and clock_gettime64 without syscall overhead.

    The m68k vDSO provides a data page mapped at a fixed offset from the
    ELF header (passed via AT_SYSINFO_EHDR). The kernel maintains the
    thread pointer and timing data in this page, updating them on context
    switches.

    Patch 1 optimizes __m68k_read_tp() to read the thread pointer directly
    from the vDSO data page instead of using the get_thread_area syscall.
    This significantly reduces overhead for TLS access, which is a frequent operation in threaded applications.

    Patch 2 enables the vDSO clock_gettime64 by defining HAVE_CLOCK_GETTIME64_VSYSCALL along with the necessary VDSO_NAME and
    VDSO_HASH for symbol lookup. This allows glibc to use the
    kernel-provided __vdso_clock_gettime64 for fast time retrieval.

    Both changes include fallback paths for older kernels that lack vDSO
    support.

    Performance Results (QEMU Quadra 800)
    -------------------------------------
    Before (syscall): ~2057 ns/call
    After (vDSO): ~675 ns/call
    Improvement: ~3x faster

    Tested on qemu-system-m68k with Linux 6.18 (Debian/m68k).

    Stefan Reinauer (2):
    m68k: Use vDSO for thread pointer access
    m68k: Enable vDSO clock_gettime64

    sysdeps/unix/sysv/linux/m68k/m68k-helpers.c | 77 ++++++++++++++++++++-
    sysdeps/unix/sysv/linux/m68k/sysdep.h | 7 ++
    2 files changed, 83 insertions(+), 1 deletion(-)

    --
    2.51.0

    --- PyGate Linux v1.5.2
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Stefan@3:633/10 to All on Thursday, January 08, 2026 07:50:01
    Define HAVE_CLOCK_GETTIME64_VSYSCALL to enable using the vDSO for clock_gettime64 on m68k. This allows glibc to use the kernel-provided __vdso_clock_gettime64 symbol for fast time retrieval without entering
    kernel mode via a syscall.

    This follows the glibc conventions:
    - Subject line with architecture prefix (m68k:) and imperative description
    - Blank line separator
    - Body explaining the purpose of the change
    - Two-space sentence endings (glibc style)
    - Describes what the macro enables (vDSO symbol lookup for clock_gettime64) ---
    sysdeps/unix/sysv/linux/m68k/sysdep.h | 7 +++++++
    1 file changed, 7 insertions(+)

    diff --git a/sysdeps/unix/sysv/linux/m68k/sysdep.h b/sysdeps/unix/sysv/linux/m68k/sysdep.h
    index 6f6b46e0..be02863b 100644
    --- a/sysdeps/unix/sysv/linux/m68k/sysdep.h
    +++ b/sysdeps/unix/sysv/linux/m68k/sysdep.h
    @@ -298,3 +298,10 @@ SYSCALL_ERROR_LABEL: \
    /* M68K needs system-supplied DSO to access TLS helpers
    even when statically linked. */
    #define NEED_STATIC_SYSINFO_DSO 1
    +
    +/* vDSO version string and hash for symbol lookup. */
    +#define VDSO_NAME "LINUX_5.0"
    +#define VDSO_HASH 61765872
    +
    +/* vDSO symbol for fast clock_gettime64. */
    +#define HAVE_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime64"
    --
    2.51.0

    --- PyGate Linux v1.5.2
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Andreas K. Huettel@3:633/10 to All on Friday, January 09, 2026 07:30:01
    Am Donnerstag, 8. Januar 2026, 07:18:20 Mitteleurop„ische Normalzeit schrieb Stefan:
    This series adds vDSO support for m68k, enabling userspace to access
    the thread pointer and clock_gettime64 without syscall overhead.
    After the release only please (given other concerns are addressed)

    The m68k vDSO provides a data page mapped at a fixed offset from the
    ELF header (passed via AT_SYSINFO_EHDR). The kernel maintains the
    thread pointer and timing data in this page, updating them on context switches.

    Patch 1 optimizes __m68k_read_tp() to read the thread pointer directly
    from the vDSO data page instead of using the get_thread_area syscall.
    This significantly reduces overhead for TLS access, which is a frequent operation in threaded applications.

    Patch 2 enables the vDSO clock_gettime64 by defining HAVE_CLOCK_GETTIME64_VSYSCALL along with the necessary VDSO_NAME and VDSO_HASH for symbol lookup. This allows glibc to use the
    kernel-provided __vdso_clock_gettime64 for fast time retrieval.

    Both changes include fallback paths for older kernels that lack vDSO
    support.

    Performance Results (QEMU Quadra 800)
    -------------------------------------
    Before (syscall): ~2057 ns/call
    After (vDSO): ~675 ns/call
    Improvement: ~3x faster

    Tested on qemu-system-m68k with Linux 6.18 (Debian/m68k).

    Stefan Reinauer (2):
    m68k: Use vDSO for thread pointer access
    m68k: Enable vDSO clock_gettime64

    sysdeps/unix/sysv/linux/m68k/m68k-helpers.c | 77 ++++++++++++++++++++-
    sysdeps/unix/sysv/linux/m68k/sysdep.h | 7 ++
    2 files changed, 83 insertions(+), 1 deletion(-)



    --
    Andreas K. Httel
    dilfridge@gentoo.org
    Gentoo Linux developer
    (council, toolchain, base-system, perl, libreoffice)


    --- PyGate Linux v1.5.2
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)