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 C6F9C42926; Wed, 12 Apr 2023 12:27:56 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B0A5D40FAE; Wed, 12 Apr 2023 12:27:56 +0200 (CEST) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by mails.dpdk.org (Postfix) with ESMTP id 41F944067B for ; Wed, 12 Apr 2023 12:27:55 +0200 (CEST) Received: from frapeml500005.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4PxJkf6WzGz6J7HF; Wed, 12 Apr 2023 18:25:30 +0800 (CST) Received: from frapeml500007.china.huawei.com (7.182.85.172) by frapeml500005.china.huawei.com (7.182.85.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Wed, 12 Apr 2023 12:27:52 +0200 Received: from frapeml500007.china.huawei.com ([7.182.85.172]) by frapeml500007.china.huawei.com ([7.182.85.172]) with mapi id 15.01.2507.023; Wed, 12 Apr 2023 12:27:52 +0200 From: Konstantin Ananyev To: Tyler Retzlaff , "dev@dpdk.org" CC: "bruce.richardson@intel.com" , "david.marchand@redhat.com" , "thomas@monjalon.net" , "mb@smartsharesystems.com" Subject: RE: [PATCH v4 02/14] eal: use rtm and xtest intrinsics Thread-Topic: [PATCH v4 02/14] eal: use rtm and xtest intrinsics Thread-Index: AQHZbLpgMT6gnv4FRkC1czygLN3V0K8neT9Q Date: Wed, 12 Apr 2023 10:27:52 +0000 Message-ID: <95cef08bb73142c588fabd2836d991dc@huawei.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1681247548-18590-1-git-send-email-roretzla@linux.microsoft.com> <1681247548-18590-3-git-send-email-roretzla@linux.microsoft.com> In-Reply-To: <1681247548-18590-3-git-send-email-roretzla@linux.microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.206.138.42] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-CFilter-Loop: Reflected 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. Convert code to use > _xend, _xabort and _xtest intrinsics. >=20 > Signed-off-by: Tyler Retzlaff > --- > config/x86/meson.build | 6 ++++++ > lib/eal/x86/include/rte_rtm.h | 18 +++++------------- > 2 files changed, 11 insertions(+), 13 deletions(-) >=20 > diff --git a/config/x86/meson.build b/config/x86/meson.build > index 54345c4..4c0b06c 100644 > --- a/config/x86/meson.build > +++ b/config/x86/meson.build > @@ -30,6 +30,12 @@ if cc.get_define('__SSE4_2__', args: machine_args) =3D= =3D '' > machine_args +=3D '-msse4' > endif >=20 > +# enable restricted transactional memory intrinsics > +# https://gcc.gnu.org/onlinedocs/gcc/x86-transactional-memory-intrinsics= .html > +if cc.get_id() !=3D 'msvc' > + machine_args +=3D '-mrtm' > +endif > + > base_flags =3D ['SSE', 'SSE2', 'SSE3','SSSE3', 'SSE4_1', 'SSE4_2'] > foreach f:base_flags > compile_time_cpuflags +=3D ['RTE_CPUFLAG_' + f] > diff --git a/lib/eal/x86/include/rte_rtm.h b/lib/eal/x86/include/rte_rtm.= h > index 36bf498..b84e58e 100644 > --- a/lib/eal/x86/include/rte_rtm.h > +++ b/lib/eal/x86/include/rte_rtm.h > @@ -5,6 +5,7 @@ > #ifndef _RTE_RTM_H_ > #define _RTE_RTM_H_ 1 >=20 > +#include >=20 > /* Official RTM intrinsics interface matching gcc/icc, but works > on older gcc compatible compilers and binutils. */ > @@ -28,31 +29,22 @@ > static __rte_always_inline > unsigned int rte_xbegin(void) > { > - unsigned int ret =3D RTE_XBEGIN_STARTED; > - > - asm volatile(".byte 0xc7,0xf8 ; .long 0" : "+a" (ret) :: "memory"); > - return ret; > + return _xbegin(); > } >=20 > static __rte_always_inline > void rte_xend(void) > { > - asm volatile(".byte 0x0f,0x01,0xd5" ::: "memory"); > + _xend(); > } >=20 > /* not an inline function to workaround a clang bug with -O0 */ > -#define rte_xabort(status) do { \ > - asm volatile(".byte 0xc6,0xf8,%P0" :: "i" (status) : "memory"); \ > -} while (0) > +#define rte_xabort(status) _xabort(status) >=20 > static __rte_always_inline > int rte_xtest(void) > { > - unsigned char out; > - > - asm volatile(".byte 0x0f,0x01,0xd6 ; setnz %0" : > - "=3Dr" (out) :: "memory"); > - return out; > + return _xtest(); > } >=20 > #ifdef __cplusplus > -- Acked-by: Konstantin Ananyev =20 > 1.8.3.1