From: "Paul E. McKenney" <paulmck@kernel.org>
To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Jonas Oberhauser <jonas.oberhauser@huawei.com>,
Jonas Oberhauser <jonas.oberhauser@huaweicloud.com>,
Boqun Feng <boqun.feng@gmail.com>,
"lkmm@lists.linux.dev" <lkmm@lists.linux.dev>,
Olivier Dion <odion@efficios.com>
Subject: Re: [RFC PATCH 1/1] hpref: Hazard Pointers with Reference Counter
Date: Wed, 7 Jan 2026 09:48:41 -0800 [thread overview]
Message-ID: <c284bd91-c27a-4e12-8d7d-82def9798fc8@paulmck-laptop> (raw)
In-Reply-To: <9b839ad6-eeb4-4b95-b471-ff1058e1ecd8@efficios.com>
On Wed, Jan 07, 2026 at 09:40:56AM -0500, Mathieu Desnoyers wrote:
> On 2026-01-07 04:38, Jonas Oberhauser wrote:
> >
> > > liburcu uatomics and "cmm_*" API initially aimed to replicate the LKMM in userspace (note: this was done circa 2009). However, starting from liburcu 0.15, we extended the uatomics API to support the C11 model
> >
> > I expect the C11-style-semantics will have a lot of friction with RCU (at the least because of missing dependency ordering).
>
> * RCU publication guarantee:
>
> C11 has the "consume" MO (which we call CMM_CONSUME in liburcu) for the
> dependency required by rcu_dereference. AFAIK it is implemented as the
> stronger "acquire" MO on most toolchains today though. For those who
> really want to keep using a volatile access for rcu_dereference in
> liburcu for performance reasons, we introduced the
> URCU_DEREFERENCE_USE_VOLATILE define in liburcu. This pairs with a C11
> store-release on rcu_assign_pointer.
>
> Note that the CONSUME MO with store-release pairing is required to
> let threadsanitizer know about RCU publication guarantee ordering.
Sadly, memory_order_consume is being deprecated in both C++ and C.
Given that (as you say) it was always promoted to memory_order_acquire,
this is not as much a tragedy as it might be.
Yes, I am thinking of replacements, as I have been for more than ten
years, but this is not an easy one. Lifetime-end pointer zap and OOTA
have higher priority. So if you have ideas, please do not keep them
secret!
> * RCU grace period guarantee:
>
> For the read-side critical section (rcu_read_{lock,unlock}) pairing with
> synchronize_rcu, we've updated the liburcu read lock/unlock
> implementation to use either atomic thread fence as full barrier or
> SEQ_CST stores. We've also introduced a urcu/annotate.h header to help
> annotating memory access groups. This helps threadsanitizer track the
> dependency ordering inherent to RCU grace periods.
The atomic thread fence is for threadsanitizer's benefit? In the MB
rcu_read_lock() and rcu_read_unlock() case, is barrier() or a light-weight
asymmetric fence still used?
> > Things like rmb and wmb may also not have a clean formalization in a C11-style semantics.
>
> Right. We've been moving away from cmm_smp_rmb() and cmm_smp_wmb() in
> favor of explicit C11 acquire/release dependency chains within the
> liburcu implementation as of liburcu 0.15. This facilitates integration
> with tools like threadsanitizer. The rmb/wmb APIs are still there for
> legacy reasons, but users are encouraged to move to a acquire/release
> model when it makes sense.
Sounds good to me!
Thanx, Paul
next prev parent reply other threads:[~2026-01-07 17:48 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-21 16:42 [RFC PATCH 1/1] hpref: Hazard Pointers with Reference Counter Mathieu Desnoyers
2024-09-21 21:07 ` Lai Jiangshan
2024-09-22 7:47 ` Mathieu Desnoyers
2024-09-25 5:57 ` Jonas Oberhauser
2024-09-25 6:35 ` Mathieu Desnoyers
2024-09-25 10:06 ` Jonas Oberhauser
2024-09-25 11:36 ` Mathieu Desnoyers
2024-09-25 12:02 ` Jonas Oberhauser
2024-09-28 11:22 ` Jonas Oberhauser
2024-09-28 11:33 ` Mathieu Desnoyers
2024-09-28 11:50 ` Jonas Oberhauser
2024-09-30 13:31 ` Jonas Oberhauser
2024-10-01 15:24 ` Paul E. McKenney
2026-01-06 14:52 ` Mathieu Desnoyers
2026-01-07 9:38 ` Jonas Oberhauser
2026-01-07 14:40 ` Mathieu Desnoyers
2026-01-07 17:48 ` Paul E. McKenney [this message]
2026-01-07 20:04 ` 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=c284bd91-c27a-4e12-8d7d-82def9798fc8@paulmck-laptop \
--to=paulmck@kernel.org \
--cc=boqun.feng@gmail.com \
--cc=jonas.oberhauser@huawei.com \
--cc=jonas.oberhauser@huaweicloud.com \
--cc=lkmm@lists.linux.dev \
--cc=mathieu.desnoyers@efficios.com \
--cc=odion@efficios.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).