[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9db8c79a-f704-84ce-360b-84335f926a48@collabora.com>
Date: Tue, 21 Sep 2021 20:06:21 -0300
From: André Almeida <andrealmeid@...labora.com>
To: Arnd Bergmann <arnd@...db.de>
Cc: Alistair Francis <alistair.francis@...nsource.wdc.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Alistair Francis <alistair23@...il.com>,
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>,
Alistair Francis <alistair.francis@....com>
Subject: Re: [PATCH v3 2/2] perf bench: Add support for 32-bit systems with
64-bit time_t
Às 05:08 de 21/09/21, Arnd Bergmann escreveu:
> On Tue, Sep 21, 2021 at 12:47 AM André Almeida
> <andrealmeid@...labora.com> wrote:
>>
>> #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.
>
> This is still broken when you disable CONFIG_COMPAT_32BIT_TIME,
> which disables all system calls that take time32 arguments.
>
Oh, I think my point was confusing then. My suggestion was to use only
the futex entry points that accepts time64, and to always use
clock_gettime that uses time64, for all platforms. Then it will work if
we disable CONFIG_COMPAT_32BIT_TIME.
>> 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.
>
> I would love to see the wrapper that Alistair wrote as part of some kernel
> uapi header provided to user space. futex is used by tons of applications,
> and we never had a library abstraction for it, so everyone has to do these
> by hand, and they all get them slightly wrong in different ways.
Why we don't have a futex() wrapper at glibc as we do have for others
syscalls?
>
> We normally don't do this in kernel headers, but I think the benefits
> would be far greater compared to today's situation.
>
> Arnd
>
Powered by blists - more mailing lists