From: Mathieu Desnoyers via lttng-dev <lttng-dev@lists.lttng.org>
To: paulmck <paulmck@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
Will Deacon <will@kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
lttng-dev <lttng-dev@lists.lttng.org>,
Carlos O'Donell <carlos@redhat.com>
Subject: Re: [lttng-dev] liburcu: LTO breaking rcu_dereference on arm64 and possibly other architectures ?
Date: Fri, 16 Apr 2021 15:30:53 -0400 (EDT) [thread overview]
Message-ID: <2056094038.84390.1618601453585.JavaMail.zimbra@efficios.com> (raw)
In-Reply-To: <20210416190244.GJ4212@paulmck-ThinkPad-P17-Gen-1>
----- On Apr 16, 2021, at 3:02 PM, paulmck paulmck@kernel.org wrote:
[...]
>
> If it can be done reasonably, I suggest also having some way for the
> person building userspace RCU to say "I know what I am doing, so do
> it with volatile rather than memory_order_consume."
Like so ?
#define CMM_ACCESS_ONCE(x) (*(__volatile__ __typeof__(x) *)&(x))
#define CMM_LOAD_SHARED(p) CMM_ACCESS_ONCE(p)
/*
* By defining URCU_DEREFERENCE_USE_VOLATILE, the user requires use of
* volatile access to implement rcu_dereference rather than
* memory_order_consume load from the C11/C++11 standards.
*
* This may improve performance on weakly-ordered architectures where
* the compiler implements memory_order_consume as a
* memory_order_acquire, which is stricter than required by the
* standard.
*
* Note that using volatile accesses for rcu_dereference may cause
* LTO to generate incorrectly ordered code starting from C11/C++11.
*/
#ifdef URCU_DEREFERENCE_USE_VOLATILE
# define rcu_dereference(x) CMM_LOAD_SHARED(x)
#else
# if defined (__cplusplus)
# if __cplusplus >= 201103L
# include <atomic>
# define rcu_dereference(x) ((std::atomic<__typeof__(x)>)(x)).load(std::memory_order_consume)
# else
# define rcu_dereference(x) CMM_LOAD_SHARED(x)
# endif
# else
# if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L)
# include <stdatomic.h>
# define rcu_dereference(x) atomic_load_explicit(&(x), memory_order_consume)
# else
# define rcu_dereference(x) CMM_LOAD_SHARED(x)
# endif
# endif
#endif
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
next prev parent reply other threads:[~2021-04-16 19:31 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-16 14:52 [lttng-dev] liburcu: LTO breaking rcu_dereference on arm64 and possibly other architectures ? Mathieu Desnoyers via lttng-dev
2021-04-16 15:17 ` Peter Zijlstra via lttng-dev
2021-04-16 16:01 ` Paul E. McKenney via lttng-dev
2021-04-16 18:40 ` Mathieu Desnoyers via lttng-dev
2021-04-16 19:02 ` Paul E. McKenney via lttng-dev
2021-04-16 19:30 ` Mathieu Desnoyers via lttng-dev [this message]
2021-04-16 20:01 ` Paul E. McKenney via lttng-dev
2021-04-16 15:22 ` Duncan Sands via lttng-dev
2021-04-16 20:39 ` Mathieu Desnoyers via lttng-dev
[not found] ` <7972b031-59b9-7fb5-6379-58bcec13a769@free.fr>
2021-04-19 15:31 ` Mathieu Desnoyers via lttng-dev
2021-04-19 15:41 ` Duncan Sands via lttng-dev
2021-04-19 15:54 ` Mathieu Desnoyers via lttng-dev
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=2056094038.84390.1618601453585.JavaMail.zimbra@efficios.com \
--to=lttng-dev@lists.lttng.org \
--cc=carlos@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=will@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).