From: "Ondřej Surý via lttng-dev" <lttng-dev@lists.lttng.org>
To: lttng-dev@lists.lttng.org
Subject: [lttng-dev] [PATCH 6/7] Use __atomic builtins to implement CMM_{LOAD, STORE}_SHARED
Date: Tue, 21 Mar 2023 14:31:01 +0100 [thread overview]
Message-ID: <20230321133102.1054238-7-ondrej@sury.org> (raw)
In-Reply-To: <20230321133102.1054238-1-ondrej@sury.org>
Instead of using CMM_ACCESS_ONCE() with memory barriers, use __atomic
builtins with relaxed memory ordering to implement CMM_LOAD_SHARED() and
CMM_STORE_SHARED().
Signed-off-by: Ondřej Surý <ondrej@sury.org>
---
include/urcu/system.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/urcu/system.h b/include/urcu/system.h
index faae390..4302253 100644
--- a/include/urcu/system.h
+++ b/include/urcu/system.h
@@ -26,7 +26,7 @@
* Identify a shared load. A cmm_smp_rmc() or cmm_smp_mc() should come
* before the load.
*/
-#define _CMM_LOAD_SHARED(p) CMM_ACCESS_ONCE(p)
+#define _CMM_LOAD_SHARED(p) __atomic_load_n(&(p), __ATOMIC_RELAXED)
/*
* Load a data from shared memory, doing a cache flush if required.
@@ -42,7 +42,7 @@
* Identify a shared store. A cmm_smp_wmc() or cmm_smp_mc() should
* follow the store.
*/
-#define _CMM_STORE_SHARED(x, v) __extension__ ({ CMM_ACCESS_ONCE(x) = (v); })
+#define _CMM_STORE_SHARED(x, v) __extension__ ({ __atomic_store_n(&(x), v, __ATOMIC_RELAXED); v; })
/*
* Store v into x, where x is located in shared memory. Performs the
--
2.39.2
_______________________________________________
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:[~2023-03-21 13:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-21 13:30 [lttng-dev] (no subject) Ondřej Surý via lttng-dev
2023-03-21 13:30 ` [lttng-dev] [PATCH 1/7] Require __atomic builtins to build Ondřej Surý via lttng-dev
2023-03-21 19:26 ` Mathieu Desnoyers via lttng-dev
2023-03-21 13:30 ` [lttng-dev] [PATCH 2/7] Use gcc __atomic builtis for <urcu/uatomic.h> implementation Ondřej Surý via lttng-dev
2023-03-21 20:03 ` Mathieu Desnoyers via lttng-dev
2023-03-21 13:30 ` [lttng-dev] [PATCH 3/7] Use __atomic_signal_fence() for cmm_barrier() Ondřej Surý via lttng-dev
2023-03-21 13:30 ` [lttng-dev] [PATCH 4/7] Replace the internal pointer manipulation with __atomic builtins Ondřej Surý via lttng-dev
2023-03-21 13:31 ` [lttng-dev] [PATCH 5/7] Replace the arch-specific memory barriers " Ondřej Surý via lttng-dev
2023-03-21 20:19 ` Mathieu Desnoyers via lttng-dev
2023-03-21 13:31 ` Ondřej Surý via lttng-dev [this message]
2023-03-21 13:31 ` [lttng-dev] [PATCH 7/7] Fix: uatomic_or() need retyping to uintptr_t in rculfhash.c Ondřej Surý 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=20230321133102.1054238-7-ondrej@sury.org \
--to=lttng-dev@lists.lttng.org \
--cc=ondrej@sury.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).