All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: "André Almeida" <andrealmeid@collabora.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Alistair Francis <alistair.francis@opensource.wdc.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Alistair Francis <alistair23@gmail.com>,
	linux-riscv <linux-riscv@lists.infradead.org>,
	Namhyung Kim <namhyung@kernel.org>, Jiri Olsa <jolsa@redhat.com>,
	linux-perf-users@vger.kernel.org,
	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 v3 2/2] perf bench: Add support for 32-bit systems with 64-bit time_t
Date: Wed, 22 Sep 2021 13:27:55 +0200	[thread overview]
Message-ID: <CAK8P3a0w4EOsSUThTAxrARPSyt+CGJTV4V4eeNmDNdG2Qrbq9w@mail.gmail.com> (raw)
In-Reply-To: <9db8c79a-f704-84ce-360b-84335f926a48@collabora.com>

On Wed, Sep 22, 2021 at 1:06 AM André Almeida <andrealmeid@collabora.com> wrote:
> Às 05:08 de 21/09/21, Arnd Bergmann escreveu:
> > On Tue, Sep 21, 2021 at 12:47 AM André Almeida
> > <andrealmeid@collabora.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.

Yes, that would be ok. It does require using at least linux-5.1, but we
perf is already sort-of tied to the kernel version.

        Arnd

WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd@arndb.de>
To: "André Almeida" <andrealmeid@collabora.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Alistair Francis <alistair.francis@opensource.wdc.com>,
	 Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Alistair Francis <alistair23@gmail.com>,
	 linux-riscv <linux-riscv@lists.infradead.org>,
	Namhyung Kim <namhyung@kernel.org>,  Jiri Olsa <jolsa@redhat.com>,
	linux-perf-users@vger.kernel.org,
	 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 v3 2/2] perf bench: Add support for 32-bit systems with 64-bit time_t
Date: Wed, 22 Sep 2021 13:27:55 +0200	[thread overview]
Message-ID: <CAK8P3a0w4EOsSUThTAxrARPSyt+CGJTV4V4eeNmDNdG2Qrbq9w@mail.gmail.com> (raw)
In-Reply-To: <9db8c79a-f704-84ce-360b-84335f926a48@collabora.com>

On Wed, Sep 22, 2021 at 1:06 AM André Almeida <andrealmeid@collabora.com> wrote:
> Às 05:08 de 21/09/21, Arnd Bergmann escreveu:
> > On Tue, Sep 21, 2021 at 12:47 AM André Almeida
> > <andrealmeid@collabora.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.

Yes, that would be ok. It does require using at least linux-5.1, but we
perf is already sort-of tied to the kernel version.

        Arnd

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  parent reply	other threads:[~2021-09-22 11:28 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-17  6:10 [PATCH v3 1/2] perf benchmark: Call the futex syscall from a function Alistair Francis
2021-09-17  6:10 ` Alistair Francis
2021-09-17  6:10 ` [PATCH v3 2/2] perf bench: Add support for 32-bit systems with 64-bit time_t Alistair Francis
2021-09-17  6:10   ` Alistair Francis
2021-09-17  7:33   ` Arnd Bergmann
2021-09-17  7:33     ` Arnd Bergmann
2021-09-17 18:33   ` Davidlohr Bueso
2021-09-17 18:33     ` Davidlohr Bueso
2021-09-20 22:47   ` André Almeida
2021-09-20 22:47     ` André Almeida
2021-09-21  8:08     ` Arnd Bergmann
2021-09-21  8:08       ` Arnd Bergmann
2021-09-21 23:06       ` André Almeida
2021-09-21 23:06         ` André Almeida
2021-09-22 11:26         ` Arnd Bergmann
2021-09-22 11:26           ` Arnd Bergmann
2021-09-22 11:27         ` Arnd Bergmann [this message]
2021-09-22 11:27           ` Arnd Bergmann
2021-09-24  4:34       ` Alistair Francis
2021-09-24  4:34         ` Alistair Francis
2021-09-24  4:34     ` Alistair Francis
2021-09-24  4:34       ` Alistair Francis
2021-09-26 21:32       ` André Almeida
2021-09-26 21:32         ` André Almeida
2021-09-17 18:21 ` [PATCH v3 1/2] perf benchmark: Call the futex syscall from a function Davidlohr Bueso
2021-09-17 18:21   ` Davidlohr Bueso

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=CAK8P3a0w4EOsSUThTAxrARPSyt+CGJTV4V4eeNmDNdG2Qrbq9w@mail.gmail.com \
    --to=arnd@arndb.de \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=alistair.francis@opensource.wdc.com \
    --cc=alistair.francis@wdc.com \
    --cc=alistair23@gmail.com \
    --cc=andrealmeid@collabora.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.