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 48CD942A31; Mon, 1 May 2023 14:55:13 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C90DC40EE5; Mon, 1 May 2023 14:55:12 +0200 (CEST) Received: from forward500b.mail.yandex.net (forward500b.mail.yandex.net [178.154.239.144]) by mails.dpdk.org (Postfix) with ESMTP id 86C7B40EE3 for ; Mon, 1 May 2023 14:55:11 +0200 (CEST) Received: from mail-nwsmtp-smtp-production-main-73.iva.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-73.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:a810:0:640:6b9b:0]) by forward500b.mail.yandex.net (Yandex) with ESMTP id 9CBE05E843; Mon, 1 May 2023 15:55:10 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-73.iva.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id 7tLAlWeDfqM0-GCP0Qpc2; Mon, 01 May 2023 15:55:09 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1682945709; bh=PkLbFQW28ymZgzqft2L57ajpBHkm4rA7vtRHreX1Xeo=; h=From:Subject:In-Reply-To:Cc:Date:References:To:Message-ID; b=qAVcazHg8Nfd2haXRhoKMR9i25tUTQK+Tw/BcMuL6OXMh2bxR6T1SyIul5kaMWacH u7/jZ5SnQzP0st8cv+YvBJh7Hmd2Y0wCOd6z36LbxFPwDZQhunSgfYU29avExTwsnz 1SkyQQyXcV8wROJHrGqaUs05isYywXsjUn0hd3l8= Authentication-Results: mail-nwsmtp-smtp-production-main-73.iva.yp-c.yandex.net; dkim=pass header.i=@yandex.ru Message-ID: <597e73ff-683c-cf5e-db5d-d2d6c129ab26@yandex.ru> Date: Mon, 1 May 2023 13:55:07 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 To: roretzla@linux.microsoft.com Cc: bruce.richardson@intel.com, david.marchand@redhat.com, dev@dpdk.org, konstantin.ananyev@huawei.com, mb@smartsharesystems.com, thomas@monjalon.net References: <1681747838-12778-6-git-send-email-roretzla@linux.microsoft.com> Subject: Re: [PATCH v7 05/14] eal: use umonitor umwait and tpause intrinsics Content-Language: en-US From: Konstantin Ananyev In-Reply-To: <1681747838-12778-6-git-send-email-roretzla@linux.microsoft.com> Content-Type: text/plain; charset=UTF-8; format=flowed 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 use _umonitor, > _umwait and _tpause intrinsics. > > Signed-off-by: Tyler Retzlaff > Acked-by: Morten Brørup > --- > lib/eal/x86/rte_power_intrinsics.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/lib/eal/x86/rte_power_intrinsics.c b/lib/eal/x86/rte_power_intrinsics.c > index f749da9..7d83c24 100644 > --- a/lib/eal/x86/rte_power_intrinsics.c > +++ b/lib/eal/x86/rte_power_intrinsics.c > @@ -109,9 +109,13 @@ > */ > > /* set address for UMONITOR */ > +#ifndef RTE_TOOLCHAIN_MSVC > asm volatile(".byte 0xf3, 0x0f, 0xae, 0xf7;" > : > : "D"(pmc->addr)); > +#else > + _umonitor(pmc->addr); > +#endif > > /* now that we've put this address into monitor, we can unlock */ > rte_spinlock_unlock(&s->lock); > @@ -123,10 +127,14 @@ > goto end; > > /* execute UMWAIT */ > +#ifndef RTE_TOOLCHAIN_MSVC > asm volatile(".byte 0xf2, 0x0f, 0xae, 0xf7;" > : /* ignore rflags */ > : "D"(0), /* enter C0.2 */ > "a"(tsc_l), "d"(tsc_h)); > +#else > + _umwait(tsc_l, tsc_h); > +#endif > > end: > /* erase sleep address */ > @@ -153,10 +161,14 @@ > return -ENOTSUP; > > /* execute TPAUSE */ > +#ifndef RTE_TOOLCHAIN_MSVC > asm volatile(".byte 0x66, 0x0f, 0xae, 0xf7;" > : /* ignore rflags */ > : "D"(0), /* enter C0.2 */ > "a"(tsc_l), "d"(tsc_h)); > +#else > + _tpause(tsc_l, tsc_h); > +#endif > > return 0; > } > -- > 1.8.3.1 AFAIK, with GCC (and CLANG?) these instrincts are controlled by __WAITPKG__ macro. So might be it is possible to have sort of 'unite' code: #if defined (RTE_TOOLCHAIN_MSVC) || defined (__WAITPKG__) #else #endif Apart from that, LGTM Acked-by: Konstantin Ananyev