From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Peter Oskolkov <posk@posk.io>
Cc: Peter Zijlstra <peterz@infradead.org>,
Peter Oskolkov <posk@google.com>, paulmck <paulmck@kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
Paul Turner <pjt@google.com>,
Chris Kennelly <ckennelly@google.com>
Subject: Re: [PATCH 1/2] membarrier: add MEMBARRIER_CMD_PRIVATE_RESTART_RSEQ_ON_CPU
Date: Thu, 6 Aug 2020 13:37:05 -0400 (EDT) [thread overview]
Message-ID: <1668913120.1621.1596735425601.JavaMail.zimbra@efficios.com> (raw)
In-Reply-To: <CAFTs51Ufyds5mypiysL=2ZwtyMk9hjLm-9tJbYz=xciY1f2=5g@mail.gmail.com>
----- On Aug 6, 2020, at 1:07 PM, Peter Oskolkov posk@posk.io wrote:
> On Thu, Aug 6, 2020 at 6:48 AM <peterz@infradead.org> wrote:
>>
>> On Wed, Aug 05, 2020 at 05:08:58PM -0700, Peter Oskolkov wrote:
>>
>> Thanks for the Cc!
>
> Always a pleasure!
>
> (Sorry, included only membarrier maintainers in v1; in v2 included
> both membarrier and rseq maintainers).
>
>>
>> > + * @MEMBARRIER_CMD_PRIVATE_RESTART_RSEQ_ON_CPU:
>> > + * If a thread belonging to the current process
>> > + * is currently in an RSEQ critical section on the
>> > + * CPU identified by flags parameter, restart it.
>> > + * @flags: if @flags >= 0, identifies the CPU to
>> > + * restart RSEQ CS on; if == -1, restarts
>> > + * RSEQ CSs on all CPUs.
>>
>> > + } else if (cpu_id == -1) {
>> > + on_each_cpu(membarrier_rseq_ipi,
>> > + current->group_leader, true);
>>
>> This is an unpriv IPI the world. That's a big no-no.
>
> removed in v2.
I don't think the feature must be removed, but its implementation needs adjustment.
How about we simply piggy-back on the membarrier schemes we already have, and
implement:
membarrier_register_private_expedited(MEMBARRIER_FLAG_RSEQ)
membarrier_private_expedited(MEMBARRIER_FLAG_RSEQ)
All the logic is there to prevent sending IPIs to runqueues which are not running
threads associated with the same mm. Considering that preemption does an rseq abort,
running a thread belonging to a different mm should mean that this CPU is not
currently executing an rseq critical section, or if it was, it has already been
aborted, so it is quiescent.
Then you'll probably want to change membarrier_private_expedited so it takes an
extra "cpu" argument. If cpu=-1, iterate on all runqueues like we currently do.
If cpu >= 0, only IPI that CPU if the thread currently running has the same mm.
Also, should this belong to the membarrier or the rseq system call ? It just
looks like the membarrier happens to implement very similar things for barriers,
but arguably this is really about rseq. I wonder if we should expose this through
rseq instead, even if we end up using membarrier code.
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
next prev parent reply other threads:[~2020-08-06 17:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-06 0:08 [PATCH 1/2] membarrier: add MEMBARRIER_CMD_PRIVATE_RESTART_RSEQ_ON_CPU Peter Oskolkov
2020-08-06 0:08 ` [PATCH 2/2] selftests/rseq: test MEMBARRIER_CMD_PRIVATE_RESTART_RSEQ_ON_CPU Peter Oskolkov
2020-08-06 13:48 ` [PATCH 1/2] membarrier: add MEMBARRIER_CMD_PRIVATE_RESTART_RSEQ_ON_CPU peterz
2020-08-06 17:07 ` Peter Oskolkov
2020-08-06 17:37 ` Mathieu Desnoyers [this message]
2020-08-07 17:48 ` Peter Oskolkov
2020-08-07 18:07 ` Mathieu Desnoyers
2020-08-07 19:02 ` peterz
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=1668913120.1621.1596735425601.JavaMail.zimbra@efficios.com \
--to=mathieu.desnoyers@efficios.com \
--cc=ckennelly@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=pjt@google.com \
--cc=posk@google.com \
--cc=posk@posk.io \
/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