All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Carlos O'Donell <carlos@redhat.com>,
	Joseph Myers <joseph@codesourcery.com>,
	Szabolcs Nagy <szabolcs.nagy@arm.com>,
	libc-alpha@sourceware.org, 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>,
	Rich Felker <dalias@libc.org>,
	linux-kernel@vger.kernel.org, linux-api@vger.kernel.org
Subject: Re: [RFC PATCH glibc 1/4] glibc: Perform rseq(2) registration at nptl init and thread creation (v4)
Date: Tue, 11 Dec 2018 11:40:22 +0100	[thread overview]
Message-ID: <87h8fkz6qx.fsf@oldenburg2.str.redhat.com> (raw)
In-Reply-To: 20181204192141.4684-1-mathieu.desnoyers@efficios.com

* Mathieu Desnoyers:

> I want to keep the __rseq_refcount symbol so out-of-libc users can
> register rseq if they are linked against a pre-2.29 libc.

Sorry, I was confused.

> diff --git a/csu/Makefile b/csu/Makefile
> index 88fc77662e..81d471587f 100644
> --- a/csu/Makefile
> +++ b/csu/Makefile
> @@ -28,7 +28,7 @@ include ../Makeconfig
>  
>  routines = init-first libc-start $(libc-init) sysdep version check_fds \
>  	   libc-tls elf-init dso_handle
> -aux	 = errno
> +aux	 = errno rseq
>  elide-routines.os = libc-tls
>  static-only-routines = elf-init
>  csu-dummies = $(filter-out $(start-installed-name),crt1.o Mcrt1.o)

Do we plan to add Hurd support for this?

> diff --git a/sysdeps/unix/sysv/linux/rseq-internal.h b/sysdeps/unix/sysv/linux/rseq-internal.h
> new file mode 100644
> index 0000000000..2367926def
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/rseq-internal.h

> +#define RSEQ_SIG 0x53053053

What's this?  This needs a comment.

> +extern __thread volatile struct rseq __rseq_abi
> +__attribute__ ((tls_model ("initial-exec")));
> +
> +extern __thread volatile uint32_t __rseq_refcount
> +__attribute__ ((tls_model ("initial-exec")));

The volatile qualifier needs justification in a comment.  (Usually,
volatile is wrong. and it is difficult to get rid of it.)

We need to document these public symbols somewhere.  There should be an
installed header file.

> diff --git a/nptl/Versions b/nptl/Versions
> index e7f691da7a..f7890f73fc 100644
> --- a/nptl/Versions
> +++ b/nptl/Versions
> @@ -277,6 +277,10 @@ libpthread {
>      cnd_timedwait; cnd_wait; tss_create; tss_delete; tss_get; tss_set;
>    }
>  
> +  GLIBC_2.29 {
> +    __rseq_refcount;
> +  }

Why put this into libpthread, and __rseq_abi into libc?

What, exactly, is the benefit of having __rseq_refcount defined by
glibc?  Have you actually got this working?  If an rseq library is
linked against glibc 2.29, it will reference the GLIBC_2.29 symbol
version, so it cannot be loaded by older glibcs.  In this case,
__rseq_refcount is not needed.

If you build against pre-2.29, then the __rseq_refcount symbol will be
unversioned.  But then you don't need it glibc, either.

So it seems to me that the addition to glibc is useless in both
scenarios.  Am I missing something?

By the way, you could avoid the need for unregistration if you allocated
the rseq areas persistently, index by TID.  They are quite small, so
with the typical PID range, maybe the wasted memory due to changing TIDs
would be acceptable?

I guess things would be so much easier if the kernel simply provided a
means to obtain the address of a previously registered rseq area.

Thanks,
Florian

  parent reply	other threads:[~2018-12-11 10:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-04 19:21 [RFC PATCH glibc 1/4] glibc: Perform rseq(2) registration at nptl init and thread creation (v4) Mathieu Desnoyers
2018-12-04 19:21 ` [RFC PATCH glibc 2/4] glibc: sched_getcpu(): use rseq cpu_id TLS on Linux Mathieu Desnoyers
2018-12-04 19:44 ` [RFC PATCH glibc 1/4] glibc: Perform rseq(2) registration at nptl init and thread creation (v4) Florian Weimer
2018-12-04 19:50   ` Mathieu Desnoyers
2018-12-11 10:40 ` Florian Weimer [this message]
2019-01-10 20:31   ` Mathieu Desnoyers
2019-01-11  1:11     ` Mathieu Desnoyers
2019-01-14 18:57       ` Florian Weimer
2019-01-14 18:55     ` Florian Weimer
2019-01-14 19:22       ` Mathieu Desnoyers
2019-01-14 19:37         ` Florian Weimer
2019-01-14 20:27           ` Mathieu Desnoyers

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=87h8fkz6qx.fsf@oldenburg2.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=bmaurer@fb.com \
    --cc=boqun.feng@gmail.com \
    --cc=carlos@redhat.com \
    --cc=dalias@libc.org \
    --cc=davejwatson@fb.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=szabolcs.nagy@arm.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 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.