From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id +Os7F4TSgGQ0xyAAWB0awg (envelope-from ) for ; Wed, 07 Jun 2023 14:55:00 -0400 Received: by simark.ca (Postfix, from userid 112) id 5CB8F1E124; Wed, 7 Jun 2023 14:55:00 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=lists.lttng.org header.i=@lists.lttng.org header.a=rsa-sha256 header.s=default header.b=tRrIg7l/; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.lttng.org (lists.lttng.org [167.114.26.123]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 8746B1E121 for ; Wed, 7 Jun 2023 14:54:59 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lists.lttng.org; s=default; t=1686164099; bh=Qghdac1OpH+mSb03rOd1gDi/KV41H1CSRaEtGaFSwdU=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=tRrIg7l/uVNrjeSaTAwgShfezXzQKVuxcPYmThOjjUxmXasoL5Q8EdaBQv9A6cUGM uEH4727+K7BRNgqbpBmFDT+X3RBe2DnubJIyrc2TOR/YXQFMBDFKRFXBIyvN8enZub FM9kdIUmdzU7MOqHsPLFnfmtL4CqPg0QfjA6BOB60+/vnAYy1ea8TgTNgAuh8EeATP 0naAnGUWzQYx8+P/hZgG58mG7kEY6LzmlJO2dD6SvloJqdw0RizgCRkj9eT9Jj/SAW lPxVTLTihDG3adp7kGLaoDDasR7tMTnr1ONmf23ipkO7D9vGSFR2IatChkMkav67hL MsHDftHx+h30w== Received: from lists-lttng01.efficios.com (localhost [IPv6:::1]) by lists.lttng.org (Postfix) with ESMTP id 4QbxNg2nPRz1Xqt; Wed, 7 Jun 2023 14:54:59 -0400 (EDT) Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by lists.lttng.org (Postfix) with ESMTPS id 4QbxNX2Sbfz1XJt for ; Wed, 7 Jun 2023 14:54:52 -0400 (EDT) Received: from laura.hitronhub.home (modemcable094.169-200-24.mc.videotron.ca [24.200.169.94]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4QbxNX0Vfyz16yv; Wed, 7 Jun 2023 14:54:52 -0400 (EDT) To: lttng-dev@lists.lttng.org Date: Wed, 7 Jun 2023 14:53:51 -0400 Message-Id: <20230607185359.8125-5-odion@efficios.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230515201718.9809-1-odion@efficios.com> References: <20230515201718.9809-1-odion@efficios.com> MIME-Version: 1.0 Subject: [lttng-dev] [PATCH v2 04/12] urcu/system: Use atomic builtins if configured X-BeenThere: lttng-dev@lists.lttng.org X-Mailman-Version: 2.1.39 Precedence: list List-Id: LTTng development list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Olivier Dion via lttng-dev Reply-To: Olivier Dion Cc: Olivier Dion , Tony Finch , "Paul E. McKenney" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: lttng-dev-bounces@lists.lttng.org Sender: "lttng-dev" If configured to use atomic builtins, use them for implementing the CMM_LOAD_SHARED and CMM_STORE_SHARED macros. Change-Id: I3eaaaaf0d26c47aced6e94b40fd59c7b8baa6272 Co-authored-by: Mathieu Desnoyers Signed-off-by: Olivier Dion --- include/urcu/system.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/include/urcu/system.h b/include/urcu/system.h index faae390..f184aad 100644 --- a/include/urcu/system.h +++ b/include/urcu/system.h @@ -19,9 +19,28 @@ * all copies or substantial portions of the Software. */ +#include #include #include +#ifdef CONFIG_RCU_USE_ATOMIC_BUILTINS + +#define CMM_LOAD_SHARED(x) \ + __atomic_load_n(&(x), __ATOMIC_RELAXED) + +#define _CMM_LOAD_SHARED(x) CMM_LOAD_SHARED(x) + +#define CMM_STORE_SHARED(x, v) \ + __extension__ \ + ({ \ + __typeof__(v) _v = (v); \ + __atomic_store_n(&(x), _v, __ATOMIC_RELAXED); \ + _v; \ + }) + +#define _CMM_STORE_SHARED(x, v) CMM_STORE_SHARED(x, v) + +#else /* * Identify a shared load. A cmm_smp_rmc() or cmm_smp_mc() should come * before the load. @@ -56,4 +75,6 @@ _v = _v; /* Work around clang "unused result" */ \ }) +#endif /* CONFIG_RCU_USE_ATOMIC_BUILTINS */ + #endif /* _URCU_SYSTEM_H */ -- 2.40.1 _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev