linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alistair Francis <alistair23@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Alistair Francis <alistair.francis@opensource.wdc.com>,
	linux-riscv <linux-riscv@lists.infradead.org>,
	linux-perf-users@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Namhyung Kim <namhyung@kernel.org>, Jiri Olsa <jolsa@redhat.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Davidlohr Bueso <dave@stgolabs.net>,
	Darren Hart <dvhart@infradead.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Atish Patra <atish.patra@wdc.com>,
	Alistair Francis <alistair.francis@wdc.com>
Subject: Re: [PATCH] perf bench: Add support for 32-bit systems with 64-bit time_t
Date: Fri, 10 Sep 2021 10:45:23 +1000	[thread overview]
Message-ID: <CAKmqyKOO5DiEBUJRY_2Be97LfqoSyatHDB_iCeZqw0toTsrkXw@mail.gmail.com> (raw)
In-Reply-To: <CAK8P3a1Udjzy=M4Vs8pGCKdedwtv-vPRjxbTcvTL6kP=yXSs0A@mail.gmail.com>

On Thu, Sep 9, 2021 at 6:20 PM Arnd Bergmann <arnd@arndb.de> wrote:
>
> On Thu, Sep 9, 2021 at 6:25 AM Alistair Francis
> <alistair.francis@opensource.wdc.com> wrote:
> >
> > From: Alistair Francis <alistair.francis@wdc.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.
> >
> > This patch does not attempt to gracefully allow 32-bit architectures
> > with both SYS_futex and SYS_futex_time64 to support a 64-bit time_t.
> > This patch only applies to 32-bit architectures with a 64-bit time_t.
> >
> > Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
>
> Hi Alistair,
>
> I know you've made this mistake before and I've pointed it out
> several times. Please don't do this again, and try to fix up the
> ones you already broke!
>
> > +/**
> > + * Some newer 32-bit architectures (such as RISC-V 32-bit) don't have
> > + * the SYS_futex syscall and instead only have the SYS_futex_time64 call.
> > + * Let's ensure that those still compile and run by just using the
> > + * SYS_futex_time64 syscall. On these systems `struct timespec` will use a
> > + * 64-bit time_t so the SYS_futex_time64 call will work.
> > + */
> > +#if !defined(SYS_futex) && defined(SYS_futex_time64)
> > + #define SYS_futex SYS_futex_time64
> > +#endif
>
> This cannot work, as two system calls take different arguments: futex() takes
> a __kernel_old_timespec and futex_time64() takes a __kernel_timespec.
>
> You cannot derive anything about the ABI of the C library based on whether
> the macros are defined or not. Either you convert the arguments passed into
> the system call into the format expected by the kernel, or you pick the
> correct system call based on sizeof(struct timespec).

Thanks Arnd. Sorry I hadn't looked at this in a while and forgot that
it's more complex.

I have some patches to fix this up. I'll send them later today.

Alistair

>
>        Arnd

      reply	other threads:[~2021-09-10  1:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-09  4:25 [PATCH] perf bench: Add support for 32-bit systems with 64-bit time_t Alistair Francis
2021-09-09  8:20 ` Arnd Bergmann
2021-09-10  0:45   ` Alistair Francis [this message]

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=CAKmqyKOO5DiEBUJRY_2Be97LfqoSyatHDB_iCeZqw0toTsrkXw@mail.gmail.com \
    --to=alistair23@gmail.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=alistair.francis@opensource.wdc.com \
    --cc=alistair.francis@wdc.com \
    --cc=arnd@arndb.de \
    --cc=atish.patra@wdc.com \
    --cc=dave@stgolabs.net \
    --cc=dvhart@infradead.org \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).