Skip to content

[PW_SID:1156007] perf bench futex: Define SYS_futex on 32-bit arches with 64-bit time_t - #2580

Open
linux-riscv-bot wants to merge 2 commits into
workflow__riscv__fixesfrom
pw1156007
Open

[PW_SID:1156007] perf bench futex: Define SYS_futex on 32-bit arches with 64-bit time_t#2580
linux-riscv-bot wants to merge 2 commits into
workflow__riscv__fixesfrom
pw1156007

Conversation

@linux-riscv-bot

Copy link
Copy Markdown

PR for series 1156007 applied to workflow__riscv__fixes

Name: perf bench futex: Define SYS_futex on 32-bit arches with 64-bit time_t
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1156007
Version: 1

Linux RISC-V bot and others added 2 commits September 2, 2026 05:24
The kernel does not provide sys_futex() on 32-bit architectures that lack
a 32-bit time representation, such as riscv32. Consequently glibc does not
define SYS_futex there, only SYS_futex_time64, and perf bench's futex
benchmarks fail to build:

  bench/futex.h: In function 'futex_syscall':
  bench/futex.h:77:18: error: 'SYS_futex' undeclared (first use in this function)

Define SYS_futex as SYS_futex_time64 when only the latter is available.
The guard and its comment are taken verbatim from
tools/testing/selftests/futex/include/futextest.h, where they were added by
commit 0485081 ("selftests/futex: Define SYS_futex on 32-bit
architectures with 64-bit time_t"), keeping the two futex userspace headers
in sync.

No timespec conversion helper is needed on top of this. glibc lays out
struct timespec on 32-bit architectures with 64-bit time_t as
{ int64 tv_sec; int32 tv_nsec; 32-bit pad }, which is compatible with
struct __kernel_timespec, and every futex_wait()/futex_lock_pi()/
futex_wait_requeue_pi() call site in perf bench passes a NULL timeout
anyway, so no timespec ever crosses the syscall boundary here.

Note that an earlier and more ambitious attempt at this was
commit c1ff12d ("perf bench futex: Add support for 32-bit systems
with 64-bit time_t"), reverted by
commit ba4026b ("Revert "perf bench futex: Add support for 32-bit
systems with 64-bit time_t"") because it included linux/time_types.h,
which is unavailable on older distributions. This change deliberately
avoids that dependency and adds only the one guard needed to fix
compilation.

Signed-off-by: Nylon Chen <nylon.chen@sifive.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants