Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>
Cc: "Andy Lutomirski" <luto@kernel.org>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Vincenzo Frascino" <vincenzo.frascino@arm.com>,
	shuah <shuah@kernel.org>,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH 04/10] selftests: vDSO: vdso_test_abi: Provide compatibility with 32-bit musl
Date: Tue, 11 Nov 2025 17:28:36 +0100	[thread overview]
Message-ID: <226858d1-fa36-4fad-bb80-15852617c20a@app.fastmail.com> (raw)
In-Reply-To: <20251111162059-734e18c4-f428-411c-afe3-87fb430fb64d@linutronix.de>

On Tue, Nov 11, 2025, at 16:50, Thomas Weißschuh wrote:
> On Tue, Nov 11, 2025 at 04:07:58PM +0100, Arnd Bergmann wrote:
>> On Tue, Nov 11, 2025, at 15:46, Thomas Weißschuh wrote:
>> > On Tue, Nov 11, 2025 at 03:19:00PM +0100, Arnd Bergmann wrote:
>
> On musl there is no SYS_clock_getres_time64 but instead there is
> SYS_clock_getres_time32.

Right. While this makes a lot of sense conceptually, it also
makes it harder to do anything portable based on those macros.

I have been wondering whether the kernel should do something
similar and replace __NR_clock_getres with __NR_clock_getres_time32
etc on 32-bit architectures unless a user specifically asks for
the compatibility macros. This would help avoid problems with
old source code using the traditional macros in combination with
the libc data structures. Unfortunately any change here also
causes new problems.

> Switching to __NR gives us back the more natural
> fallback logic. We are back at the nolibc 64-bit time functions.
> We can add a static_assert() to gain some compile-time safety.
>
> static int
> syscall_clock_getres(__kernel_clockid_t clockid, struct __kernel_timespec *res)
> {
> #ifdef __NR_clock_getres_time64
> 	return syscall(__NR_clock_getres_time64, clockid, res);
> #else
> 	/*
> 	 * __NR_clock_getres expects __kernel_old_timespec.
> 	 * Make sure the actual parameter is compatible.
> 	 */
> 	_Static_assert(sizeof(struct __kernel_old_timespec) == sizeof(*res));
> 	return syscall(__NR_clock_getres, clockid, res);
> #endif
> }
>
> And stick all of those wrappers into another helper header.

Ok, sounds good.

    Arnd

  reply	other threads:[~2025-11-11 16:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-11 10:49 [PATCH 00/10] selftests: vDSO: Stop using libc types for vDSO calls Thomas Weißschuh
2025-11-11 10:49 ` [PATCH 01/10] Revert "selftests: vDSO: parse_vdso: Use UAPI headers instead of libc headers" Thomas Weißschuh
2025-11-11 10:49 ` [PATCH 02/10] selftests: vDSO: Introduce vdso_types.h Thomas Weißschuh
2025-11-11 12:45   ` Arnd Bergmann
2025-11-11 13:47     ` Thomas Weißschuh
2025-11-11 14:48       ` Thomas Weißschuh
2025-11-11 10:49 ` [PATCH 03/10] selftests: vDSO: vdso_test_abi: Use types from vdso_types.h Thomas Weißschuh
2025-11-11 10:49 ` [PATCH 04/10] selftests: vDSO: vdso_test_abi: Provide compatibility with 32-bit musl Thomas Weißschuh
2025-11-11 12:59   ` Arnd Bergmann
2025-11-11 13:55     ` Thomas Weißschuh
2025-11-11 14:19       ` Arnd Bergmann
2025-11-11 14:46         ` Thomas Weißschuh
2025-11-11 15:07           ` Arnd Bergmann
2025-11-11 15:50             ` Thomas Weißschuh
2025-11-11 16:28               ` Arnd Bergmann [this message]
2025-11-11 10:49 ` [PATCH 05/10] selftests: vDSO: vdso_test_gettimeofday: Remove nolibc checks Thomas Weißschuh
2025-11-11 10:49 ` [PATCH 06/10] selftests: vDSO: vdso_test_gettimeofday: Use types from vdso_types.h Thomas Weißschuh
2025-11-11 10:49 ` [PATCH 07/10] selftests: vDSO: vdso_test_correctness: Drop SYS_getcpu fallbacks Thomas Weißschuh
2025-11-11 10:49 ` [PATCH 08/10] selftests: vDSO: vdso_test_correctness: Use types from vdso_types.h Thomas Weißschuh
2025-11-11 10:49 ` [PATCH 09/10] selftests: vDSO: vdso_test_correctness: Provide compatibility with 32-bit musl Thomas Weißschuh
2025-11-11 10:49 ` [PATCH 10/10] selftests: vDSO: vdso_test_correctness: Use facilities from parse_vdso.c Thomas Weißschuh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=226858d1-fa36-4fad-bb80-15852617c20a@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=shuah@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=thomas.weissschuh@linutronix.de \
    --cc=vincenzo.frascino@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox