perf tools build broken for RISCV 32 bit

Arnd Bergmann arnd at kernel.org
Mon Jan 18 10:44:36 EST 2021


On Mon, Jan 18, 2021 at 4:33 PM Emiliano Ingrassia
<ingrassia at epigenesys.com> wrote:

> Ok, I totally agree with you on this point.
>
> So, it is right to conclude that the problem is not in perf
> implementation but in the libc implementation?

No, libc does not provide a futex abstraction, and the SYS_* macros
just refer to the low-level interfaces that operate on kernel types rather
than libc types. An application that uses them must pass the
correct types.

> That is, for example, glibc should define SYS_futex as SYS_futex_time64
> in case of riscv 32 bit because of its support to 64 bit time_t?

As I explained, SYS_futex would refer to the time32 syscall, which
does not exist on rv32, redefining it to a different syscall would lead to
data corruption as well.

If you call futex_time64, you have to pass a __kernel_timespec structure,
while the old futex call must take a __kernel_old_timespec structure.
Depending on the architecture, only one of the two syscalls might be
available, and if you pass a timespec defined by libc, you have to
know which of the two syscalls that corresponds to, or convert
the arguments when calling it.

      Arnd



More information about the linux-riscv mailing list