From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Florian Weimer <fweimer@redhat.com>
Cc: linux-api <linux-api@vger.kernel.org>,
Jann Horn <jannh@google.com>,
libc-alpha <libc-alpha@sourceware.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: rseq + membarrier programming model
Date: Mon, 13 Dec 2021 14:31:44 -0500 (EST) [thread overview]
Message-ID: <1221393005.30508.1639423904918.JavaMail.zimbra@efficios.com> (raw)
In-Reply-To: <87tufctk82.fsf@oldenburg.str.redhat.com>
----- On Dec 13, 2021, at 1:47 PM, Florian Weimer fweimer@redhat.com wrote:
> I've been studying Jann Horn's biased locking example:
>
> Re: [PATCH 0/4 POC] Allow executing code and syscalls in another address space
> <https://lore.kernel.org/linux-api/CAG48ez02UDn_yeLuLF4c=kX0=h2Qq8Fdb0cer1yN8atbXSNjkQ@mail.gmail.com/>
>
> It uses MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ as part of the biased lock
> revocation.
By the way, there might be something good to salvage from this prototype I did a
while back:
https://github.com/compudj/rseq-test/blob/adapt-lock/test-rseq-adaptative-lock.c
The neat trick there is to use a combination of the Zero Flag and rbx==0/1 to detect
whether the rseq critical section was aborted before or after successful execution
of the CAS. This allows the rseq c.s. to cover an entire loop, which contains a CAS
instruction, without requiring that the critical section ends with a "commit"
instruction.
Some characteristics of this prototype:
- Don't busy-wait in user-space if the lock owner belongs to the same CPU where the
waiter executes. Immediately use futex.
- Adaptative busy-wait delay (per-lock).
- If busy-spinning is preempted, it jumps to abort immediately when resumed. Therefore,
the loop count for adaptative busy-spinning is very precise.
Of course, much more work would be needed, but I suspect a few ideas there can be
useful.
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
prev parent reply other threads:[~2021-12-13 19:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-13 18:47 rseq + membarrier programming model Florian Weimer
2021-12-13 19:19 ` Mathieu Desnoyers
2021-12-13 19:29 ` Florian Weimer
2021-12-13 19:56 ` Mathieu Desnoyers
2021-12-13 20:12 ` Florian Weimer
2021-12-14 20:25 ` Mathieu Desnoyers
2021-12-13 19:27 ` Jann Horn
2021-12-13 19:31 ` Mathieu Desnoyers [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=1221393005.30508.1639423904918.JavaMail.zimbra@efficios.com \
--to=mathieu.desnoyers@efficios.com \
--cc=fweimer@redhat.com \
--cc=jannh@google.com \
--cc=libc-alpha@sourceware.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).