From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 97CEC42E48; Tue, 11 Jul 2023 18:49:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2D0F442C4D; Tue, 11 Jul 2023 18:49:24 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 593BE40C35 for ; Tue, 11 Jul 2023 18:49:19 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id A91EA21C3A93; Tue, 11 Jul 2023 09:49:18 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com A91EA21C3A93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1689094158; bh=vY0QQgx3OOWa3+3NNuFfxU1b3j/IYPW0l1t9dJWYM7w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F7wB7lGekTDWOP+vbPk4xhLeEuCJpXDa49VH71Xy/Anr+afi9+Z0GwtNwRrz7X6S8 5XZMnua30GAB3ONAK3zS6IYVQoloBCOkLF7cuH8q6+Cfw9TPdWVbVNu0jvRL8+sveF 0q8vUJjsOrkx1ejbtH2DDHhqw+g1DbdY2FVPsgmQ= From: Tyler Retzlaff To: dev@dpdk.org Cc: Bruce Richardson , Konstantin Ananyev , Ciara Power , thomas@monjalon.net, david.marchand@redhat.com, mb@smartsharesystems.com, Tyler Retzlaff Subject: [PATCH v9 03/14] eal: use barrier intrinsics Date: Tue, 11 Jul 2023 09:49:06 -0700 Message-Id: <1689094157-16873-4-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1689094157-16873-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1689094157-16873-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Inline assembly is not supported for MSVC x64 instead expand rte_compiler_barrier as _ReadWriteBarrier and for rte_smp_mb _m_mfence intrinsics. Signed-off-by: Tyler Retzlaff Acked-by: Bruce Richardson Acked-by: Konstantin Ananyev Acked-by: Morten Brørup --- lib/eal/include/generic/rte_atomic.h | 4 ++++ lib/eal/x86/include/rte_atomic.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/lib/eal/include/generic/rte_atomic.h b/lib/eal/include/generic/rte_atomic.h index 58df843..6a6c394 100644 --- a/lib/eal/include/generic/rte_atomic.h +++ b/lib/eal/include/generic/rte_atomic.h @@ -116,9 +116,13 @@ * Guarantees that operation reordering does not occur at compile time * for operations directly before and after the barrier. */ +#ifdef RTE_TOOLCHAIN_MSVC +#define rte_compiler_barrier() _ReadWriteBarrier() +#else #define rte_compiler_barrier() do { \ asm volatile ("" : : : "memory"); \ } while(0) +#endif /** * Synchronization fence between threads based on the specified memory order. diff --git a/lib/eal/x86/include/rte_atomic.h b/lib/eal/x86/include/rte_atomic.h index f2ee1a9..7aba1c3 100644 --- a/lib/eal/x86/include/rte_atomic.h +++ b/lib/eal/x86/include/rte_atomic.h @@ -66,11 +66,15 @@ static __rte_always_inline void rte_smp_mb(void) { +#ifdef RTE_TOOLCHAIN_MSVC + _mm_mfence(); +#else #ifdef RTE_ARCH_I686 asm volatile("lock addl $0, -128(%%esp); " ::: "memory"); #else asm volatile("lock addl $0, -128(%%rsp); " ::: "memory"); #endif +#endif } #define rte_io_mb() rte_mb() -- 1.8.3.1