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 0C58942927; Wed, 12 Apr 2023 14:31:45 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BEEB9410F2; Wed, 12 Apr 2023 14:31:43 +0200 (CEST) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by mails.dpdk.org (Postfix) with ESMTP id 714BD406A2 for ; Wed, 12 Apr 2023 14:31:42 +0200 (CEST) Received: from frapeml500006.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4PxMTV3gSKz6J6Cs; Wed, 12 Apr 2023 20:29:18 +0800 (CST) Received: from frapeml500007.china.huawei.com (7.182.85.172) by frapeml500006.china.huawei.com (7.182.85.219) 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 14:31:40 +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 14:31:40 +0200 From: Konstantin Ananyev To: Bruce Richardson , Tyler Retzlaff CC: "dev@dpdk.org" , "david.marchand@redhat.com" , "thomas@monjalon.net" , "mb@smartsharesystems.com" Subject: RE: [PATCH v4 06/14] eal: use prefetch intrinsics Thread-Topic: [PATCH v4 06/14] eal: use prefetch intrinsics Thread-Index: AQHZbLpenItyBAiXAUWSgf38Kqlqn68nQQCAgABa6lA= Date: Wed, 12 Apr 2023 12:31:40 +0000 Message-ID: <49d55ed0c2b8485a899be9f7fb40a5b8@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-7-git-send-email-roretzla@linux.microsoft.com> In-Reply-To: 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 > On Tue, Apr 11, 2023 at 02:12:20PM -0700, Tyler Retzlaff wrote: > > Inline assembly is not supported for MSVC x64 instead use _mm_prefetch > > and _mm_cldemote intrinsics. > > > > Signed-off-by: Tyler Retzlaff > > --- >=20 > Acked-by: Bruce Richardson >=20 > One comment inline below for future consideration. >=20 > > lib/eal/x86/include/rte_prefetch.h | 29 +++++++++++++++++++++++++++++ > > 1 file changed, 29 insertions(+) > > > > diff --git a/lib/eal/x86/include/rte_prefetch.h b/lib/eal/x86/include/r= te_prefetch.h > > index 7fd01c4..1391af0 100644 > > --- a/lib/eal/x86/include/rte_prefetch.h > > +++ b/lib/eal/x86/include/rte_prefetch.h > > @@ -13,6 +13,7 @@ > > #include > > #include "generic/rte_prefetch.h" > > > > +#ifndef RTE_TOOLCHAIN_MSVC > > static inline void rte_prefetch0(const volatile void *p) > > { > > asm volatile ("prefetcht0 %[p]" : : [p] "m" (*(const volatile char *)= p)); > > @@ -43,6 +44,34 @@ static inline void rte_prefetch_non_temporal(const v= olatile void *p) > > { > > asm volatile(".byte 0x0f, 0x1c, 0x06" :: "S" (p)); > > } > > +#else > > +static inline void rte_prefetch0(const volatile void *p) > > +{ > > + _mm_prefetch(p, 1); > > +} > > + > > +static inline void rte_prefetch1(const volatile void *p) > > +{ > > + _mm_prefetch(p, 2); > > +} > > + > > +static inline void rte_prefetch2(const volatile void *p) > > +{ > > + _mm_prefetch(p, 3); > > +} > > + > > +static inline void rte_prefetch_non_temporal(const volatile void *p) > > +{ > > + _mm_prefetch(p, 0); > > +} >=20 > For these prefetch instructions, I'm not sure there is any reason why we > can't drop the inline assembly versions. The instructions are very old at > this point and should be widely supported by all compilers we use. >=20 > Rather than using hard-coded 1, 2, 3 values in the prefetch calls, I > believe there should be defines for the levels: "_MM_HINT_T0", > "_MM_HINT_T1" etc. +1 =20 >=20 > > +__rte_experimental > > +static inline void > > +rte_cldemote(const volatile void *p) > > +{ > > + _mm_cldemote(p); > > +} > > +#endif > > + > > > > #ifdef __cplusplus > > } > > -- > > 1.8.3.1 > >