[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKmqyKM+VN-KST9-VMULZMC=2sNbjH2wiE-CZ1WRfVFj3WmpdQ@mail.gmail.com>
Date: Fri, 24 Sep 2021 14:34:12 +1000
From: Alistair Francis <alistair23@...il.com>
To: André Almeida <andrealmeid@...labora.com>
Cc: Alistair Francis <alistair.francis@...nsource.wdc.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-riscv <linux-riscv@...ts.infradead.org>,
Namhyung Kim <namhyung@...nel.org>,
Jiri Olsa <jolsa@...hat.com>, linux-perf-users@...r.kernel.org,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Mark Rutland <mark.rutland@....com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Davidlohr Bueso <dave@...olabs.net>,
Darren Hart <dvhart@...radead.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Atish Patra <atish.patra@....com>,
Arnd Bergmann <arnd@...db.de>,
Alistair Francis <alistair.francis@....com>
Subject: Re: [PATCH v3 2/2] perf bench: Add support for 32-bit systems with
64-bit time_t
On Tue, Sep 21, 2021 at 8:47 AM André Almeida <andrealmeid@...labora.com> wrote:
>
> Hi Alistair,
>
> Às 03:10 de 17/09/21, Alistair Francis escreveu:
> > From: Alistair Francis <alistair.francis@....com>
> >
> > Some 32-bit architectures (such are 32-bit RISC-V) only have a 64-bit
> > time_t and as such don't have the SYS_futex syscall. This patch will
> > allow us to use the SYS_futex_time64 syscall on those platforms.
> >
>
> Thanks for your patch! However, I don't think that any futex operation
> at perf has timeout. Do you plan to implement a test that use it? Or the
> idea is to get this ready for it in case someone want to do so in the
> future?
I don't have plans to implement any new tests (although I'm happy to
add one if need be).
My goal was just to get this to build for RISC-V 32-bit. The timeout
was already exposed by the old futex macro, so I was just following
that.
>
>
> Also, I faced a similar problem with the new futex2 syscalls, that
> supports exclusively 64bit timespec. But I took a different approach: I
> called __NR_clock_gettime64 for 32bit architectures so it wouldn't
> require to convert the struct:
>
> #if defined(__i386__) || __TIMESIZE == 32
> # define NR_gettime64 __NR_clock_gettime64
> #else
> # define NR_gettime64 __NR_clock_gettime
> #endif
>
> struct timespec64 {
> long long tv_sec; /* seconds */
> long long tv_nsec; /* nanoseconds */
> };
>
> int gettime64(clock_t clockid, struct timespec64 *tv)
> {
> return syscall(NR_gettime64, clockid, tv);
> }
>
> Then we can just use &timeout at __NR_futex_time64 for 32bit arch and at
> __NR_futex for 64bit arch.
So the idea is to use 64-bit time_t everywhere and only work on 5.1+ kernels.
If that's the favoured approach I can convert this series to your idea.
Alistair
>
> This might be a simpler solution to the problem that you are facing but
> I'm not entirely sure. Also, futex's selftests do use the timeout
> argument and I think that they also won't compile in 32-bit RISC-V, so
> maybe we can start from there so we can actually test the timeout
> argument and check if it's working.
>
> Thanks,
> André
Powered by blists - more mailing lists