From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Joseph Myers <joseph@codesourcery.com>
Cc: carlos <carlos@redhat.com>, Florian Weimer <fweimer@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>, Ben Maurer <bmaurer@fb.com>,
Peter Zijlstra <peterz@infradead.org>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Boqun Feng <boqun.feng@gmail.com>,
Will Deacon <will.deacon@arm.com>,
Dave Watson <davejwatson@fb.com>, Paul Turner <pjt@google.com>,
libc-alpha <libc-alpha@sourceware.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
linux-api <linux-api@vger.kernel.org>
Subject: Re: [RFC PATCH] glibc: Perform rseq(2) registration at nptl init and thread creation
Date: Fri, 21 Sep 2018 12:29:24 -0400 (EDT) [thread overview]
Message-ID: <1370210961.9271.1537547364295.JavaMail.zimbra@efficios.com> (raw)
In-Reply-To: <alpine.DEB.2.21.1809202016270.17228@digraph.polyomino.org.uk>
----- On Sep 20, 2018, at 4:20 PM, Joseph Myers joseph@codesourcery.com wrote:
> On Thu, 20 Sep 2018, Mathieu Desnoyers wrote:
>
>> Are you saying glibc has an explicit check for the kernel version visible
>> from /proc before using specific features ? If so, how can this work with
>> the variety of feature backports we find in the distribution kernels out
>> there ?
>
> See sysdeps/unix/sysv/linux/dl-sysdep.c and
> sysdeps/unix/sysv/linux/dl-osinfo.h. As I said, Carlos has proposed
> removing that check.
For the system calls I implement and maintain, I typically ensure there is
a set of parameters that can be used when issuing the system call so it
can either succeed or fail with ENOSYS without having side-effects. It's
specifically meant to be used for feature discovery in a library
initialization phase. It's especially useful if the application needs to
keep state around related to the system call across its execution, e.g.
robust futexes.
>
>> For too-old headers at compile time, one possibility is that we don't event
>> expose the __rseq_abi TLS symbol. OTOH, if we need to keep exposing it anyway
>> for ABI consistency purposes, then we'd leave its cpu_id field at the initial
>> value (-1). But that would require that we copy linux/rseq.h into the glibc
>> source tree.
>
> The ABI needs to be independent of the kernel headers used. I don't think
> you need to copy linux/rseq.h; all you should need is to e.g. define an
> array of suitable size and alignment with the relevant member initialized
> and a suitable explanatory comment.
In that case, I'm thinking declaring a minimal structure in glibc code may be
clearer than the array, e.g.:
[pthreadP.h]
enum libc_rseq_cpu_id_state {
LIBC_RSEQ_CPU_ID_UNINITIALIZED = -1,
LIBC_RSEQ_CPU_ID_REGISTRATION_FAILED = -2,
};
/* linux/rseq.h defines struct rseq as aligned on 32 bytes. The kernel ABI
size is 20 bytes. For support of multiple rseq users within a process,
user-space defines an extra 4 bytes field as a reference count, for a
total of 24 bytes. */
struct libc_rseq {
/* kernel-userspace ABI. */
uint32_t cpu_id_start;
uint32_t cpu_id;
uint64_t rseq_cs;
uint32_t flags;
/* user-space ABI. */
uint32_t refcount;
} __attribute__((aligned(4 * sizeof(uint64_t))));
[pthread_create.h]
__thread volatile struct libc_rseq __rseq_abi = {
.cpu_id = LIBC_RSEQ_CPU_ID_UNINITIALIZED,
};
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
next prev parent reply other threads:[~2018-09-21 16:29 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-19 14:44 Mathieu Desnoyers
2018-09-19 16:37 ` Joseph Myers
2018-09-19 16:53 ` Mathieu Desnoyers
2018-09-19 17:10 ` Joseph Myers
2018-09-20 20:14 ` Mathieu Desnoyers
2018-09-20 20:20 ` Joseph Myers
2018-09-21 16:29 ` Mathieu Desnoyers [this message]
2018-09-20 20:04 ` Mathieu Desnoyers
2018-09-20 20:29 ` Joseph Myers
2018-09-19 17:38 ` Szabolcs Nagy
2018-09-19 19:49 ` Joseph Myers
2018-09-19 20:10 ` Mathieu Desnoyers
2018-09-19 21:01 ` Mathieu Desnoyers
2018-09-20 10:28 ` Szabolcs Nagy
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=1370210961.9271.1537547364295.JavaMail.zimbra@efficios.com \
--to=mathieu.desnoyers@efficios.com \
--cc=bmaurer@fb.com \
--cc=boqun.feng@gmail.com \
--cc=carlos@redhat.com \
--cc=davejwatson@fb.com \
--cc=fweimer@redhat.com \
--cc=joseph@codesourcery.com \
--cc=libc-alpha@sourceware.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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