[v11,01/16] eal: use rdtsc intrinsic
Checks
Commit Message
Inline assembly is not supported for MSVC x64. Convert code to use
__rdtsc intrinsic.
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
lib/eal/x86/include/rte_cycles.h | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
Comments
> -----Original Message-----
> From: Tyler Retzlaff <roretzla@linux.microsoft.com>
> Sent: Friday, August 11, 2023 10:21 PM
> To: dev@dpdk.org
> Cc: Bruce Richardson <bruce.richardson@intel.com>; Konstantin Ananyev
> <konstantin.v.ananyev@yandex.ru>; Ciara Power <ciara.power@intel.com>;
> NBU-Contact-Thomas Monjalon (EXTERNAL) <thomas@monjalon.net>;
> david.marchand@redhat.com; mb@smartsharesystems.com; Tyler Retzlaff
> <roretzla@linux.microsoft.com>
> Subject: [PATCH v11 01/16] eal: use rdtsc intrinsic
>
> Inline assembly is not supported for MSVC x64. Convert code to use
> __rdtsc intrinsic.
>
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> Acked-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
> Acked-by: Morten Brørup <mb@smartsharesystems.com>
> ---
Hello,
This patch is causing a build failure in Windows with Clang 11:
"""
[72/803] Compiling C object drivers/common/idpf/6e54547@@idpf_common_avx512_lib@sta/idpf_common_rxtx_avx512.c.obj
FAILED: drivers/common/idpf/6e54547@@idpf_common_avx512_lib@sta/idpf_common_rxtx_avx512.c.obj
clang @drivers/common/idpf/6e54547@@idpf_common_avx512_lib@sta/idpf_common_rxtx_avx512.c.obj.rsp
In file included from ../drivers/common/idpf/idpf_common_rxtx_avx512.c:6:
In file included from ..\drivers\common\idpf/idpf_common_device.h:9:
In file included from ..\drivers\common\idpf/base/idpf_prototype.h:9:
In file included from ..\drivers\common\idpf/base/idpf_osdep.h:18:
In file included from ..\lib\eal\include\rte_malloc.h:16:
In file included from ..\lib\eal\include\rte_memory.h:25:
In file included from ..\lib\eal\include\rte_fbarray.h:39:
In file included from ..\lib\eal\x86\include\rte_rwlock.h:13:
In file included from ..\lib\eal\x86\include/rte_spinlock.h:18:
In file included from ..\lib\eal\x86\include/rte_cycles.h:12:
In file included from C:\Tools\LLVM\lib\clang\11.0.0\include\x86intrin.h:24:
C:\Tools\LLVM\lib\clang\11.0.0\include\prfchwintrin.h:50:1: error: conflicting types for '__m_prefetchw'
_m_prefetchw(void *__P)
^
..\lib\eal\windows\include\rte_windows.h:28:22: note: expanded from macro '_m_prefetchw'
#define _m_prefetchw __m_prefetchw
^
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winnt.h:3324:1: note: previous declaration is here
_m_prefetchw (
^
..\lib\eal\windows\include\rte_windows.h:28:22: note: expanded from macro '_m_prefetchw'
#define _m_prefetchw __m_prefetchw
^
1 error generated.
[73/803] Generating rte_bus_auxiliary_def with a custom command
[74/803] Compiling C object drivers/a715181@@tmp_rte_common_idpf@sta/common_idpf_base_idpf_controlq.c.obj
[75/803] Compiling C object drivers/a715181@@tmp_rte_common_idpf@sta/common_idpf_idpf_common_rxtx.c.obj
[76/803] Compiling C object drivers/a715181@@tmp_rte_common_idpf@sta/common_idpf_base_idpf_controlq_setup.c.obj
[77/803] Generating rte_bus_vdev.pmd.c with a custom command
[78/803] Compiling C object drivers/a715181@@tmp_rte_bus_pci@sta/bus_pci_pci_params.c.obj
[79/803] Compiling C object drivers/a715181@@tmp_rte_bus_pci@sta/bus_pci_pci_common.c.obj
[80/803] Compiling C object drivers/a715181@@tmp_rte_common_idpf@sta/common_idpf_base_idpf_common.c.obj
[81/803] Compiling C object drivers/a715181@@tmp_rte_common_idpf@sta/common_idpf_idpf_common_virtchnl.c.obj
ninja: build stopped: subcommand failed.
"""
Cross build with x86_64-w64-mingw32-gcc 12.2.1 on Fedora Linux doesn't reproduce.
Regards,
Ali
On Sat, Aug 26, 2023 at 02:38:26PM +0000, Ali Alnubani wrote:
> > -----Original Message-----
> > From: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > Sent: Friday, August 11, 2023 10:21 PM
> > To: dev@dpdk.org
> > Cc: Bruce Richardson <bruce.richardson@intel.com>; Konstantin Ananyev
> > <konstantin.v.ananyev@yandex.ru>; Ciara Power <ciara.power@intel.com>;
> > NBU-Contact-Thomas Monjalon (EXTERNAL) <thomas@monjalon.net>;
> > david.marchand@redhat.com; mb@smartsharesystems.com; Tyler Retzlaff
> > <roretzla@linux.microsoft.com>
> > Subject: [PATCH v11 01/16] eal: use rdtsc intrinsic
> >
> > Inline assembly is not supported for MSVC x64. Convert code to use
> > __rdtsc intrinsic.
> >
> > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > Acked-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
> > Acked-by: Morten Brørup <mb@smartsharesystems.com>
> > ---
>
> Hello,
>
> This patch is causing a build failure in Windows with Clang 11:
Hi Ali,
while we don't currently document a minimum clang version required to
build the windows port i'm starting to consider establishing policy that
in effect says we may bump the required compiler version on any dpdk
release (not just long term servicing releases). but before doing that
it would be nice to understand if that would cause undue pain on the
port users.
So is there a reason you can't use LLVM 16?
Not that this information helps you but this is the background to what
is breaking here.
The failure here is due to a mistmatch in cv-qualification of the prototype
for __m_prefetchw that comes from clang VS the prototype that comes from the
Windows SDK.
The Windows SDK will not be changed to remove the volatile qualification
and even if it were removed it would be a breaking API change. The LLVM
version of the prototype could be volatile qualified without a breaking
change causing no harm.
Thanks
>
> """
> [72/803] Compiling C object drivers/common/idpf/6e54547@@idpf_common_avx512_lib@sta/idpf_common_rxtx_avx512.c.obj
> FAILED: drivers/common/idpf/6e54547@@idpf_common_avx512_lib@sta/idpf_common_rxtx_avx512.c.obj
> clang @drivers/common/idpf/6e54547@@idpf_common_avx512_lib@sta/idpf_common_rxtx_avx512.c.obj.rsp
> In file included from ../drivers/common/idpf/idpf_common_rxtx_avx512.c:6:
> In file included from ..\drivers\common\idpf/idpf_common_device.h:9:
> In file included from ..\drivers\common\idpf/base/idpf_prototype.h:9:
> In file included from ..\drivers\common\idpf/base/idpf_osdep.h:18:
> In file included from ..\lib\eal\include\rte_malloc.h:16:
> In file included from ..\lib\eal\include\rte_memory.h:25:
> In file included from ..\lib\eal\include\rte_fbarray.h:39:
> In file included from ..\lib\eal\x86\include\rte_rwlock.h:13:
> In file included from ..\lib\eal\x86\include/rte_spinlock.h:18:
> In file included from ..\lib\eal\x86\include/rte_cycles.h:12:
> In file included from C:\Tools\LLVM\lib\clang\11.0.0\include\x86intrin.h:24:
> C:\Tools\LLVM\lib\clang\11.0.0\include\prfchwintrin.h:50:1: error: conflicting types for '__m_prefetchw'
> _m_prefetchw(void *__P)
> ^
> ..\lib\eal\windows\include\rte_windows.h:28:22: note: expanded from macro '_m_prefetchw'
> #define _m_prefetchw __m_prefetchw
> ^
> C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winnt.h:3324:1: note: previous declaration is here
> _m_prefetchw (
> ^
> ..\lib\eal\windows\include\rte_windows.h:28:22: note: expanded from macro '_m_prefetchw'
> #define _m_prefetchw __m_prefetchw
> ^
> 1 error generated.
> [73/803] Generating rte_bus_auxiliary_def with a custom command
> [74/803] Compiling C object drivers/a715181@@tmp_rte_common_idpf@sta/common_idpf_base_idpf_controlq.c.obj
> [75/803] Compiling C object drivers/a715181@@tmp_rte_common_idpf@sta/common_idpf_idpf_common_rxtx.c.obj
> [76/803] Compiling C object drivers/a715181@@tmp_rte_common_idpf@sta/common_idpf_base_idpf_controlq_setup.c.obj
> [77/803] Generating rte_bus_vdev.pmd.c with a custom command
> [78/803] Compiling C object drivers/a715181@@tmp_rte_bus_pci@sta/bus_pci_pci_params.c.obj
> [79/803] Compiling C object drivers/a715181@@tmp_rte_bus_pci@sta/bus_pci_pci_common.c.obj
> [80/803] Compiling C object drivers/a715181@@tmp_rte_common_idpf@sta/common_idpf_base_idpf_common.c.obj
> [81/803] Compiling C object drivers/a715181@@tmp_rte_common_idpf@sta/common_idpf_idpf_common_virtchnl.c.obj
> ninja: build stopped: subcommand failed.
> """
>
> Cross build with x86_64-w64-mingw32-gcc 12.2.1 on Fedora Linux doesn't reproduce.
>
> Regards,
> Ali
> -----Original Message-----
> From: Tyler Retzlaff <roretzla@linux.microsoft.com>
> Sent: Tuesday, August 29, 2023 7:16 PM
> To: Ali Alnubani <alialnu@nvidia.com>
> Cc: David Marchand <david.marchand@redhat.com>; dev@dpdk.org; Bruce
> Richardson <bruce.richardson@intel.com>; Konstantin Ananyev
> <konstantin.v.ananyev@yandex.ru>; Ciara Power <ciara.power@intel.com>;
> NBU-Contact-Thomas Monjalon (EXTERNAL) <thomas@monjalon.net>;
> mb@smartsharesystems.com
> Subject: Re: [PATCH v11 01/16] eal: use rdtsc intrinsic
>
> On Sat, Aug 26, 2023 at 02:38:26PM +0000, Ali Alnubani wrote:
> > > -----Original Message-----
> > > From: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > > Sent: Friday, August 11, 2023 10:21 PM
> > > To: dev@dpdk.org
> > > Cc: Bruce Richardson <bruce.richardson@intel.com>; Konstantin Ananyev
> > > <konstantin.v.ananyev@yandex.ru>; Ciara Power
> <ciara.power@intel.com>;
> > > NBU-Contact-Thomas Monjalon (EXTERNAL) <thomas@monjalon.net>;
> > > david.marchand@redhat.com; mb@smartsharesystems.com; Tyler
> Retzlaff
> > > <roretzla@linux.microsoft.com>
> > > Subject: [PATCH v11 01/16] eal: use rdtsc intrinsic
> > >
> > > Inline assembly is not supported for MSVC x64. Convert code to use
> > > __rdtsc intrinsic.
> > >
> > > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > > Acked-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
> > > Acked-by: Morten Brørup <mb@smartsharesystems.com>
> > > ---
> >
> > Hello,
> >
> > This patch is causing a build failure in Windows with Clang 11:
>
> Hi Ali,
>
> while we don't currently document a minimum clang version required to
> build the windows port i'm starting to consider establishing policy that
> in effect says we may bump the required compiler version on any dpdk
> release (not just long term servicing releases). but before doing that
> it would be nice to understand if that would cause undue pain on the
> port users.
>
> So is there a reason you can't use LLVM 16?
No specific reason. I reported this because compilation was passing with Clang 11 prior to this patch.
Regards,
Ali
> -----Original Message-----
> From: Ali Alnubani <alialnu@nvidia.com>
> Sent: Wednesday, August 30, 2023 4:38 PM
> To: Tyler Retzlaff <roretzla@linux.microsoft.com>
> Cc: David Marchand <david.marchand@redhat.com>; dev@dpdk.org; Bruce
> Richardson <bruce.richardson@intel.com>; Konstantin Ananyev
> <konstantin.v.ananyev@yandex.ru>; Ciara Power <ciara.power@intel.com>;
> NBU-Contact-Thomas Monjalon (EXTERNAL) <thomas@monjalon.net>;
> mb@smartsharesystems.com
> Subject: RE: [PATCH v11 01/16] eal: use rdtsc intrinsic
>
> > -----Original Message-----
> > From: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > Sent: Tuesday, August 29, 2023 7:16 PM
> > To: Ali Alnubani <alialnu@nvidia.com>
> > Cc: David Marchand <david.marchand@redhat.com>; dev@dpdk.org; Bruce
> > Richardson <bruce.richardson@intel.com>; Konstantin Ananyev
> > <konstantin.v.ananyev@yandex.ru>; Ciara Power <ciara.power@intel.com>;
> > NBU-Contact-Thomas Monjalon (EXTERNAL) <thomas@monjalon.net>;
> > mb@smartsharesystems.com
> > Subject: Re: [PATCH v11 01/16] eal: use rdtsc intrinsic
> >
> > On Sat, Aug 26, 2023 at 02:38:26PM +0000, Ali Alnubani wrote:
> > > > -----Original Message-----
> > > > From: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > > > Sent: Friday, August 11, 2023 10:21 PM
> > > > To: dev@dpdk.org
> > > > Cc: Bruce Richardson <bruce.richardson@intel.com>; Konstantin
> Ananyev
> > > > <konstantin.v.ananyev@yandex.ru>; Ciara Power
> > <ciara.power@intel.com>;
> > > > NBU-Contact-Thomas Monjalon (EXTERNAL) <thomas@monjalon.net>;
> > > > david.marchand@redhat.com; mb@smartsharesystems.com; Tyler
> > Retzlaff
> > > > <roretzla@linux.microsoft.com>
> > > > Subject: [PATCH v11 01/16] eal: use rdtsc intrinsic
> > > >
> > > > Inline assembly is not supported for MSVC x64. Convert code to use
> > > > __rdtsc intrinsic.
> > > >
> > > > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > > > Acked-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
> > > > Acked-by: Morten Brørup <mb@smartsharesystems.com>
> > > > ---
> > >
> > > Hello,
> > >
> > > This patch is causing a build failure in Windows with Clang 11:
> >
> > Hi Ali,
> >
> > while we don't currently document a minimum clang version required to
> > build the windows port i'm starting to consider establishing policy that
> > in effect says we may bump the required compiler version on any dpdk
> > release (not just long term servicing releases). but before doing that
> > it would be nice to understand if that would cause undue pain on the
> > port users.
> >
> > So is there a reason you can't use LLVM 16?
>
> No specific reason. I reported this because compilation was passing with Clang
> 11 prior to this patch.
>
Building with clang version 16.0.6 fails for me with:
[..]
[405/803] Linking target lib/rte_eal-24.dll
FAILED: lib/rte_eal-24.dll
"clang" @lib/rte_eal-24.dll.rsp
clang: error: no such file or directory: 'librte_log.lib'
clang: error: no such file or directory: 'librte_kvargs.lib'
[406/803] Compiling C object lib/librte_mempool.a.p/mempool_rte_mempool_ops_default.c.obj
[..]
> -----Original Message-----
> From: Ali Alnubani
> Sent: Wednesday, August 30, 2023 6:49 PM
> To: 'Tyler Retzlaff' <roretzla@linux.microsoft.com>
> Cc: 'David Marchand' <david.marchand@redhat.com>; 'dev@dpdk.org'
> <dev@dpdk.org>; 'Bruce Richardson' <bruce.richardson@intel.com>;
> 'Konstantin Ananyev' <konstantin.v.ananyev@yandex.ru>; 'Ciara Power'
> <ciara.power@intel.com>; NBU-Contact-Thomas Monjalon (EXTERNAL)
> <thomas@monjalon.net>; 'mb@smartsharesystems.com'
> <mb@smartsharesystems.com>
> Subject: RE: [PATCH v11 01/16] eal: use rdtsc intrinsic
>
> > -----Original Message-----
> > From: Ali Alnubani <alialnu@nvidia.com>
> > Sent: Wednesday, August 30, 2023 4:38 PM
> > To: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > Cc: David Marchand <david.marchand@redhat.com>; dev@dpdk.org; Bruce
> > Richardson <bruce.richardson@intel.com>; Konstantin Ananyev
> > <konstantin.v.ananyev@yandex.ru>; Ciara Power <ciara.power@intel.com>;
> > NBU-Contact-Thomas Monjalon (EXTERNAL) <thomas@monjalon.net>;
> > mb@smartsharesystems.com
> > Subject: RE: [PATCH v11 01/16] eal: use rdtsc intrinsic
> >
> > > -----Original Message-----
> > > From: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > > Sent: Tuesday, August 29, 2023 7:16 PM
> > > To: Ali Alnubani <alialnu@nvidia.com>
> > > Cc: David Marchand <david.marchand@redhat.com>; dev@dpdk.org;
> Bruce
> > > Richardson <bruce.richardson@intel.com>; Konstantin Ananyev
> > > <konstantin.v.ananyev@yandex.ru>; Ciara Power
> <ciara.power@intel.com>;
> > > NBU-Contact-Thomas Monjalon (EXTERNAL) <thomas@monjalon.net>;
> > > mb@smartsharesystems.com
> > > Subject: Re: [PATCH v11 01/16] eal: use rdtsc intrinsic
> > >
> > > On Sat, Aug 26, 2023 at 02:38:26PM +0000, Ali Alnubani wrote:
> > > > > -----Original Message-----
> > > > > From: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > > > > Sent: Friday, August 11, 2023 10:21 PM
> > > > > To: dev@dpdk.org
> > > > > Cc: Bruce Richardson <bruce.richardson@intel.com>; Konstantin
> > Ananyev
> > > > > <konstantin.v.ananyev@yandex.ru>; Ciara Power
> > > <ciara.power@intel.com>;
> > > > > NBU-Contact-Thomas Monjalon (EXTERNAL)
> <thomas@monjalon.net>;
> > > > > david.marchand@redhat.com; mb@smartsharesystems.com; Tyler
> > > Retzlaff
> > > > > <roretzla@linux.microsoft.com>
> > > > > Subject: [PATCH v11 01/16] eal: use rdtsc intrinsic
> > > > >
> > > > > Inline assembly is not supported for MSVC x64. Convert code to use
> > > > > __rdtsc intrinsic.
> > > > >
> > > > > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > > > > Acked-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
> > > > > Acked-by: Morten Brørup <mb@smartsharesystems.com>
> > > > > ---
> > > >
> > > > Hello,
> > > >
> > > > This patch is causing a build failure in Windows with Clang 11:
> > >
> > > Hi Ali,
> > >
> > > while we don't currently document a minimum clang version required to
> > > build the windows port i'm starting to consider establishing policy that
> > > in effect says we may bump the required compiler version on any dpdk
> > > release (not just long term servicing releases). but before doing that
> > > it would be nice to understand if that would cause undue pain on the
> > > port users.
> > >
> > > So is there a reason you can't use LLVM 16?
> >
> > No specific reason. I reported this because compilation was passing with
> Clang
> > 11 prior to this patch.
> >
>
> Building with clang version 16.0.6 fails for me with:
>
> [..]
> [405/803] Linking target lib/rte_eal-24.dll
> FAILED: lib/rte_eal-24.dll
> "clang" @lib/rte_eal-24.dll.rsp
> clang: error: no such file or directory: 'librte_log.lib'
> clang: error: no such file or directory: 'librte_kvargs.lib'
> [406/803] Compiling C object
> lib/librte_mempool.a.p/mempool_rte_mempool_ops_default.c.obj
> [..]
This build failure was actually caused by upgrading Meson from 0.54.3 to 1.2.1 earlier on the environment.
The build passes with Meson 0.54.3 and Clang 16.0.6.
On Wed, Aug 30, 2023 at 04:29:07PM +0000, Ali Alnubani wrote:
> > -----Original Message-----
> > From: Ali Alnubani
> > Sent: Wednesday, August 30, 2023 6:49 PM
> > To: 'Tyler Retzlaff' <roretzla@linux.microsoft.com>
> > Cc: 'David Marchand' <david.marchand@redhat.com>; 'dev@dpdk.org'
> > <dev@dpdk.org>; 'Bruce Richardson' <bruce.richardson@intel.com>;
> > 'Konstantin Ananyev' <konstantin.v.ananyev@yandex.ru>; 'Ciara Power'
> > <ciara.power@intel.com>; NBU-Contact-Thomas Monjalon (EXTERNAL)
> > <thomas@monjalon.net>; 'mb@smartsharesystems.com'
> > <mb@smartsharesystems.com>
> > Subject: RE: [PATCH v11 01/16] eal: use rdtsc intrinsic
> >
> > > -----Original Message-----
> > > From: Ali Alnubani <alialnu@nvidia.com>
> > > Sent: Wednesday, August 30, 2023 4:38 PM
> > > To: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > > Cc: David Marchand <david.marchand@redhat.com>; dev@dpdk.org; Bruce
> > > Richardson <bruce.richardson@intel.com>; Konstantin Ananyev
> > > <konstantin.v.ananyev@yandex.ru>; Ciara Power <ciara.power@intel.com>;
> > > NBU-Contact-Thomas Monjalon (EXTERNAL) <thomas@monjalon.net>;
> > > mb@smartsharesystems.com
> > > Subject: RE: [PATCH v11 01/16] eal: use rdtsc intrinsic
> > >
> > > > -----Original Message-----
> > > > From: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > > > Sent: Tuesday, August 29, 2023 7:16 PM
> > > > To: Ali Alnubani <alialnu@nvidia.com>
> > > > Cc: David Marchand <david.marchand@redhat.com>; dev@dpdk.org;
> > Bruce
> > > > Richardson <bruce.richardson@intel.com>; Konstantin Ananyev
> > > > <konstantin.v.ananyev@yandex.ru>; Ciara Power
> > <ciara.power@intel.com>;
> > > > NBU-Contact-Thomas Monjalon (EXTERNAL) <thomas@monjalon.net>;
> > > > mb@smartsharesystems.com
> > > > Subject: Re: [PATCH v11 01/16] eal: use rdtsc intrinsic
> > > >
> > > > On Sat, Aug 26, 2023 at 02:38:26PM +0000, Ali Alnubani wrote:
> > > > > > -----Original Message-----
> > > > > > From: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > > > > > Sent: Friday, August 11, 2023 10:21 PM
> > > > > > To: dev@dpdk.org
> > > > > > Cc: Bruce Richardson <bruce.richardson@intel.com>; Konstantin
> > > Ananyev
> > > > > > <konstantin.v.ananyev@yandex.ru>; Ciara Power
> > > > <ciara.power@intel.com>;
> > > > > > NBU-Contact-Thomas Monjalon (EXTERNAL)
> > <thomas@monjalon.net>;
> > > > > > david.marchand@redhat.com; mb@smartsharesystems.com; Tyler
> > > > Retzlaff
> > > > > > <roretzla@linux.microsoft.com>
> > > > > > Subject: [PATCH v11 01/16] eal: use rdtsc intrinsic
> > > > > >
> > > > > > Inline assembly is not supported for MSVC x64. Convert code to use
> > > > > > __rdtsc intrinsic.
> > > > > >
> > > > > > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > > > > > Acked-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
> > > > > > Acked-by: Morten Brørup <mb@smartsharesystems.com>
> > > > > > ---
> > > > >
> > > > > Hello,
> > > > >
> > > > > This patch is causing a build failure in Windows with Clang 11:
> > > >
> > > > Hi Ali,
> > > >
> > > > while we don't currently document a minimum clang version required to
> > > > build the windows port i'm starting to consider establishing policy that
> > > > in effect says we may bump the required compiler version on any dpdk
> > > > release (not just long term servicing releases). but before doing that
> > > > it would be nice to understand if that would cause undue pain on the
> > > > port users.
> > > >
> > > > So is there a reason you can't use LLVM 16?
> > >
> > > No specific reason. I reported this because compilation was passing with
> > Clang
> > > 11 prior to this patch.
> > >
> >
> > Building with clang version 16.0.6 fails for me with:
> >
> > [..]
> > [405/803] Linking target lib/rte_eal-24.dll
> > FAILED: lib/rte_eal-24.dll
> > "clang" @lib/rte_eal-24.dll.rsp
> > clang: error: no such file or directory: 'librte_log.lib'
> > clang: error: no such file or directory: 'librte_kvargs.lib'
> > [406/803] Compiling C object
> > lib/librte_mempool.a.p/mempool_rte_mempool_ops_default.c.obj
> > [..]
>
> This build failure was actually caused by upgrading Meson from 0.54.3 to 1.2.1 earlier on the environment.
> The build passes with Meson 0.54.3 and Clang 16.0.6.
yes, the windows build is very sensitive to meson version. i only test
with 0.57.0 i have not had time to investigate why newer versions do not
work.
@@ -6,6 +6,12 @@
#ifndef _RTE_CYCLES_X86_64_H_
#define _RTE_CYCLES_X86_64_H_
+#ifdef RTE_TOOLCHAIN_MSVC
+#include <intrin.h>
+#else
+#include <x86intrin.h>
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -23,6 +29,7 @@
static inline uint64_t
rte_rdtsc(void)
{
+#ifdef RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT
union {
uint64_t tsc_64;
RTE_STD_C11
@@ -32,7 +39,6 @@
};
} tsc;
-#ifdef RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT
if (unlikely(rte_cycles_vmware_tsc_map)) {
/* ecx = 0x10000 corresponds to the physical TSC for VMware */
asm volatile("rdpmc" :
@@ -42,11 +48,7 @@
return tsc.tsc_64;
}
#endif
-
- asm volatile("rdtsc" :
- "=a" (tsc.lo_32),
- "=d" (tsc.hi_32));
- return tsc.tsc_64;
+ return __rdtsc();
}
static inline uint64_t