From: Florian Weimer <fweimer@redhat.com>
To: Thomas Gleixner <tglx@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
LKML <linux-kernel@vger.kernel.org>,
"Paul E. McKenney" <paulmck@kernel.org>,
Boqun Feng <boqun.feng@gmail.com>,
Jonathan Corbet <corbet@lwn.net>,
Prakash Sangappa <prakash.sangappa@oracle.com>,
Madadi Vineeth Reddy <vineethr@linux.ibm.com>,
K Prateek Nayak <kprateek.nayak@amd.com>,
Steven Rostedt <rostedt@goodmis.org>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Arnd Bergmann <arnd@arndb.de>,
linux-arch@vger.kernel.org, Randy Dunlap <rdunlap@infradead.org>,
Peter Zijlstra <peterz@infradead.org>,
Ron Geva <rongevarg@gmail.com>,
Waiman Long <longman@redhat.com>,
"carlos@redhat.com" <carlos@redhat.com>,
Michael Jeanson <mjeanson@efficios.com>
Subject: Re: [patch V6 01/11] rseq: Add fields and constants for time slice extension
Date: Wed, 14 Jan 2026 00:45:54 +0100 [thread overview]
Message-ID: <lhua4yhcc0d.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <87ldi4gjm3.ffs@tglx> (Thomas Gleixner's message of "Sun, 11 Jan 2026 18:11:16 +0100")
* Thomas Gleixner:
> I'm not completely opposed to make it process wide. For threads created
> after enablement, that's trivial because that can be done when the per
> thread RSEQ is registered. But when it gets enabled _after_ threads have
> been created already then we need code to chase the threads and enable
> it after the fact because we are not going to query the enablement in
> curr->mm::whatever just to have another conditional and another
> cacheline to access.
In glibc, we make sure that the registration for restartable sequences
happens before any user code (with the exception of IFUNC resolvers) can
run. This includes code from signal handlers. We started masking
signals on newly created threads for this reason, to make these
partially initialized states unobservable.
It's not clear to me what the expected outcome is. If we ever want to
offer deadline extension as a mutex attribute (for example), then we
have to switch this on at process start unconditionally because we don't
know if this new API will be used by the new process (potentially after
dlopen, so we can't even use things likely analyzing the symbol
footprint ahead of time).
> The only option is to reject enablement when there is already more than
> one thread in the process, but there is a reasonable argument that a
> process might only enable it for a subset of threads, which have actual
> lock interaction and not bother with it for other things. I'm not seeing
> a reason to restrict the flexibility of configuration just because you
> envision magic use cases all over the place.
Sure, but it looks like this needs a custom/minimal libc. It's like
repurposing set_robust_list for something else. It can be done, but it
has a significant cost in terms of compatibility because some
functionality (that other libraries in the process depend on) will stop
working.
> On the other hand there is no guarantee that libc registers RSEQ when a
> thread is started as it can be disabled or not supported, so you have
> exactly the same problem there that the code which wants to use it needs
> to ensure that a RSEQ area is registered, no?
With glibc, if RSEQ is registered on the main thread, it will be
registered on all other threads, too. Technically, it's possible to
unregister RSEQ with the kernel, of course, but that's totally
undefined, like unmapping memory originally returned from malloc.
>>> The prctl allows you to query the state, so all parties can make
>>> informed decisions. It's not any different from other mechanisms, which
>>> require coordination between different parts.
>>
>> I'm fine with having prctl enable the feature (for the whole process)
>> and query its state.
>>
>> The part I'm concerned with is the prctl disabling the feature, as
>> we're losing the availability invariant after setup.
>
> close(0);
>
> has the same problem. How many instances of bugs in that area have you
> seen so far?
We've had significant issues due to incorrect close calls (maybe not
close(0) in particular, but definitely with double-closes removing
descriptors created by other threads.
We need the prctl to unregister for CRIU, though, otherwise CRIU won't
be able to use glibc directly (or would have to re-exec itself in a new
configuration).
Thanks,
Florian
next prev parent reply other threads:[~2026-01-13 23:46 UTC|newest]
Thread overview: 78+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-15 16:52 [patch V6 00/11] rseq: Implement time slice extension mechanism Thomas Gleixner
2025-12-15 16:52 ` [patch V6 01/11] rseq: Add fields and constants for time slice extension Thomas Gleixner
2025-12-15 18:24 ` Thomas Gleixner
2025-12-16 14:36 ` Mathieu Desnoyers
2025-12-18 23:21 ` Thomas Gleixner
2026-01-07 21:11 ` Mathieu Desnoyers
2026-01-11 17:11 ` Thomas Gleixner
2026-01-13 23:45 ` Florian Weimer [this message]
2026-01-14 21:59 ` Thomas Gleixner
2026-01-17 16:16 ` Mathieu Desnoyers
2026-01-19 10:21 ` Peter Zijlstra
2026-01-19 10:30 ` Mathieu Desnoyers
2026-01-19 11:03 ` Peter Zijlstra
2026-01-19 11:10 ` Mathieu Desnoyers
2026-01-19 11:27 ` Peter Zijlstra
2026-01-19 10:46 ` Florian Weimer
2026-01-17 9:36 ` Peter Zijlstra
2026-01-19 10:10 ` Peter Zijlstra
2026-01-22 10:16 ` [tip: sched/core] " tip-bot2 for Thomas Gleixner
2025-12-15 16:52 ` [patch V6 02/11] rseq: Provide static branch for time slice extensions Thomas Gleixner
2025-12-15 18:24 ` Thomas Gleixner
2026-01-22 10:16 ` [tip: sched/core] " tip-bot2 for Thomas Gleixner
2025-12-15 16:52 ` [patch V6 03/11] rseq: Add statistics " Thomas Gleixner
2025-12-15 18:24 ` Thomas Gleixner
2026-01-22 10:16 ` [tip: sched/core] " tip-bot2 for Thomas Gleixner
2025-12-15 16:52 ` [patch V6 04/11] rseq: Add prctl() to enable " Thomas Gleixner
2025-12-15 18:24 ` Thomas Gleixner
2026-01-22 10:16 ` [tip: sched/core] " tip-bot2 for Thomas Gleixner
2025-12-15 16:52 ` [patch V6 05/11] rseq: Implement sys_rseq_slice_yield() Thomas Gleixner
2025-12-15 18:24 ` Thomas Gleixner
2025-12-16 14:59 ` Mathieu Desnoyers
2026-01-22 10:16 ` [tip: sched/core] " tip-bot2 for Thomas Gleixner
2025-12-15 16:52 ` [patch V6 06/11] rseq: Implement syscall entry work for time slice extensions Thomas Gleixner
2025-12-15 18:24 ` Thomas Gleixner
2025-12-16 15:05 ` Mathieu Desnoyers
2025-12-18 22:28 ` Thomas Gleixner
2025-12-18 22:30 ` Mathieu Desnoyers
2026-01-22 10:16 ` [tip: sched/core] " tip-bot2 for Thomas Gleixner
2025-12-15 16:52 ` [patch V6 07/11] rseq: Implement time slice extension enforcement timer Thomas Gleixner
2025-12-15 18:24 ` Thomas Gleixner
2025-12-16 7:18 ` Randy Dunlap
2025-12-16 17:55 ` Prakash Sangappa
2025-12-16 8:26 ` [patch V6.1 " Thomas Gleixner
2025-12-16 15:13 ` [patch V6 " Mathieu Desnoyers
2025-12-18 15:05 ` Peter Zijlstra
2025-12-18 23:26 ` Thomas Gleixner
2025-12-19 10:05 ` Peter Zijlstra
2026-01-16 18:15 ` Peter Zijlstra
2026-01-18 10:46 ` Thomas Gleixner
2026-01-19 10:01 ` Peter Zijlstra
2025-12-18 15:18 ` Peter Zijlstra
2025-12-18 23:25 ` Thomas Gleixner
2026-01-17 9:57 ` Peter Zijlstra
2026-01-23 17:38 ` Prakash Sangappa
2026-01-23 17:41 ` Prakash Sangappa
2026-01-27 18:48 ` Peter Zijlstra
2026-01-22 10:16 ` [tip: sched/core] " tip-bot2 for Thomas Gleixner
2025-12-15 16:52 ` [patch V6 08/11] rseq: Reset slice extension when scheduled Thomas Gleixner
2025-12-15 18:24 ` Thomas Gleixner
2025-12-16 15:17 ` Mathieu Desnoyers
2026-01-22 10:16 ` [tip: sched/core] " tip-bot2 for Thomas Gleixner
2025-12-15 16:52 ` [patch V6 09/11] rseq: Implement rseq_grant_slice_extension() Thomas Gleixner
2025-12-15 18:24 ` Thomas Gleixner
2025-12-16 15:25 ` Mathieu Desnoyers
2025-12-18 23:28 ` Thomas Gleixner
2026-01-11 10:22 ` Thomas Gleixner
2026-01-22 10:15 ` [tip: sched/core] " tip-bot2 for Thomas Gleixner
2025-12-15 16:52 ` [patch V6 10/11] entry: Hook up rseq time slice extension Thomas Gleixner
2025-12-15 18:24 ` Thomas Gleixner
2025-12-16 15:37 ` Mathieu Desnoyers
2025-12-19 11:07 ` Peter Zijlstra
2026-01-11 11:01 ` Thomas Gleixner
2026-01-17 9:51 ` Peter Zijlstra
2026-01-22 10:15 ` [tip: sched/core] " tip-bot2 for Thomas Gleixner
2025-12-15 16:52 ` [patch V6 11/11] selftests/rseq: Implement time slice extension test Thomas Gleixner
2025-12-15 18:24 ` Thomas Gleixner
2026-01-22 10:15 ` [tip: sched/core] " tip-bot2 for Thomas Gleixner
2025-12-15 18:24 ` [patch V6 00/11] rseq: Implement time slice extension mechanism Thomas Gleixner
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=lhua4yhcc0d.fsf@oldenburg.str.redhat.com \
--to=fweimer@redhat.com \
--cc=arnd@arndb.de \
--cc=bigeasy@linutronix.de \
--cc=boqun.feng@gmail.com \
--cc=carlos@redhat.com \
--cc=corbet@lwn.net \
--cc=kprateek.nayak@amd.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mjeanson@efficios.com \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=prakash.sangappa@oracle.com \
--cc=rdunlap@infradead.org \
--cc=rongevarg@gmail.com \
--cc=rostedt@goodmis.org \
--cc=tglx@kernel.org \
--cc=vineethr@linux.ibm.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