mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Florian Weimer <fw@deneb.enyo.de>
To: Mathieu Desnoyers via Libc-alpha <libc-alpha@sourceware.org>
Cc: Carlos O'Donell <carlos@redhat.com>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	linux-api@vger.kernel.org, Boqun Feng <boqun.feng@gmail.com>,
	Will Deacon <will.deacon@arm.com>,
	linux-kernel@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>,
	Ben Maurer <bmaurer@fb.com>, Thomas Gleixner <tglx@linutronix.de>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Paul Turner <pjt@google.com>,
	Joseph Myers <joseph@codesourcery.com>
Subject: Re: [PATCH glibc 6/9] glibc: sched_getcpu(): use rseq cpu_id TLS on Linux (v7)
Date: Mon, 27 Apr 2020 11:13:33 +0200	[thread overview]
Message-ID: <87a72xz3ya.fsf@mid.deneb.enyo.de> (raw)
In-Reply-To: <20200326155633.18236-7-mathieu.desnoyers@efficios.com> (Mathieu Desnoyers via Libc-alpha's message of "Thu, 26 Mar 2020 11:56:30 -0400")

* Mathieu Desnoyers via Libc-alpha:

> diff --git a/sysdeps/unix/sysv/linux/sched_getcpu.c b/sysdeps/unix/sysv/linux/sched_getcpu.c
> index c019cfb3cf..2269c4f2bd 100644
> --- a/sysdeps/unix/sysv/linux/sched_getcpu.c
> +++ b/sysdeps/unix/sysv/linux/sched_getcpu.c
> @@ -18,10 +18,15 @@
>  #include <errno.h>
>  #include <sched.h>
>  #include <sysdep.h>
> +#include <atomic.h>
>  #include <sysdep-vdso.h>
>  
> -int
> -sched_getcpu (void)
> +#ifdef HAVE_GETCPU_VSYSCALL
> +# define HAVE_VSYSCALL
> +#endif
> +
> +static int
> +vsyscall_sched_getcpu (void)
>  {
>    unsigned int cpu;
>    int r = -1;
> @@ -32,3 +37,21 @@ sched_getcpu (void)
>  #endif
>    return r == -1 ? r : cpu;
>  }
> +
> +#include <sys/rseq.h>
> +
> +#ifdef RSEQ_SIG
> +int
> +sched_getcpu (void)
> +{
> +  int cpu_id = atomic_load_relaxed (&__rseq_abi.cpu_id);
> +
> +  return cpu_id >= 0 ? cpu_id : vsyscall_sched_getcpu ();
> +}
> +#else
> +int
> +sched_getcpu (void)
> +{
> +  return vsyscall_sched_getcpu ();
> +}
> +#endif

This patch needs to be rebased on current master, but the direction
looks right to me.

      reply	other threads:[~2020-04-27  9:13 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200326155633.18236-1-mathieu.desnoyers@efficios.com>
2020-03-26 15:56 ` [PATCH glibc 5/9] glibc: Perform rseq(2) registration at C startup and thread creation (v17) Mathieu Desnoyers
2020-04-27  9:11   ` Florian Weimer
2020-04-27 16:40     ` Mathieu Desnoyers
2020-04-27 16:54       ` Florian Weimer
2020-04-27 17:26         ` Mathieu Desnoyers
2020-04-27 20:27           ` Mathieu Desnoyers
2020-04-28 12:02           ` Florian Weimer
2020-04-28 12:33             ` Mathieu Desnoyers
2020-04-28 12:35               ` Florian Weimer
2020-04-28 12:43                 ` Mathieu Desnoyers
2020-04-28 12:54                   ` Florian Weimer
2020-04-28 14:58                     ` Mathieu Desnoyers
2020-04-29  8:16                       ` Szabolcs Nagy
2020-04-29  8:18                         ` Florian Weimer
2020-04-29  8:52                           ` Szabolcs Nagy
2020-04-28 12:56               ` Mathieu Desnoyers
2020-04-29 12:19                 ` Florian Weimer
2020-04-27 11:59   ` Florian Weimer
2020-04-27 16:47     ` Mathieu Desnoyers
2020-04-27 16:59       ` Florian Weimer
2020-03-26 15:56 ` [PATCH glibc 6/9] glibc: sched_getcpu(): use rseq cpu_id TLS on Linux (v7) Mathieu Desnoyers
2020-04-27  9:13   ` Florian Weimer [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=87a72xz3ya.fsf@mid.deneb.enyo.de \
    --to=fw@deneb.enyo.de \
    --cc=bmaurer@fb.com \
    --cc=boqun.feng@gmail.com \
    --cc=carlos@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=pjt@google.com \
    --cc=tglx@linutronix.de \
    --cc=will.deacon@arm.com \
    /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

Powered by JetHome