net/virtio: fix AVX512 datapath selection
Subsystems (2)
PATCH 1/1 net/virtio: fix AVX512 datapath selection
The AVX512 packed ring datapath selection was only done at build time, but it should also be checked at runtime that the CPU supports it.
This patch add a CPU flags check so that non-vectorized path is selected at runtime if AVX512 is not supported.
--- drivers/net/virtio/virtio_ethdev.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/virtio/virtio_ethdev.c +4 -2
@@ -1965,8 +1965,10 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)PMD_DRV_LOG (INFO ,"building environment do not support packed ring vectorized" );#else - hw->use_vec_rx =1 ; - hw->use_vec_tx =1 ; +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F )) { + hw->use_vec_rx =1 ; + hw->use_vec_tx =1 ; + }#endif } }
Signature · 1 line
2.25.4
Quoted 22 lines · Maxime Coquelin
The AVX512 packed ring datapath selection was only done at build time, but it should also be checked at runtime that the CPU supports it.
This patch add a CPU flags check so that non-vectorized path is selected at runtime if AVX512 is not supported.
Fixes ccb10995c2ad ("net/virtio: add election for vectorized path")Signed-off-by Maxime Coquelin <[email protected]>--- drivers/net/virtio/virtio_ethdev.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/net/virtio/virtio_ethdev.c +0
-0@@ -1965,8 +1965,10 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)PMD_DRV_LOG (INFO ,"building environment do not support packed ring vectorized" );
drivers/net/virtio/virtio_ethdev.c eth_virtio_dev_init(struct rte_eth_dev *eth_dev) · line 1974
Quoted 10 lines
drivers/net/virtio/virtio_ethdev.c +4
-2#else - hw->use_vec_rx =1 ; - hw->use_vec_tx =1 ; +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F )) { + hw->use_vec_rx =1 ; + hw->use_vec_tx =1 ; + }#endif } }
Bruce & Radu also highlighted that the in meson, instead of updating 'cflags', which is for all driver, the cflags for 'virtio_rxtx_packed_avx.c' should be updated.
PATCH v2 1/1 net/virtio: fix AVX512 datapath selection
In reply to Maxime CoquelinFrom: Maxime Coquelin <[email protected]>
The AVX512 packed ring datapath selection was only done at build time, but it should also be checked at runtime that the CPU supports it.
This patch add a CPU flags check so that non-vectorized path is selected at runtime if AVX512 is not supported.
Also in meson build enable vectorization only for relevant file, not for all driver.
---
Cc: Bruce Richardson <[email protected]>
Cc: Radu Nicolau <[email protected]>
Cc: Luca Boccassi <[email protected]>
For meson I mainly adapted implementation from other driver, not able to test or verify myself.
--- drivers/net/virtio/meson.build | 9 +++++++-- drivers/net/virtio/virtio_ethdev.c | 6 ++++-- 2 files changed, 11 insertions(+), 4 deletions(-)
drivers/net/virtio/meson.build +7 -2
@@ -11,8 +11,14 @@ deps += ['kvargs', 'bus_pci'] if arch_subdir == 'x86' if not machine_args.contains('-mno-avx512f') if cc.has_argument('-mavx512f') and cc.has_argument('-mavx512vl') and cc.has_argument('-mavx512bw') - cflags += ['-mavx512f', '-mavx512bw', '-mavx512vl'] cflags += ['-DCC_AVX512_SUPPORT'] + virtio_avx512_lib = static_library('virtio_avx512_lib', + 'virtio_rxtx_packed_avx.c', + dependencies: [static_rte_ethdev, + static_rte_kvargs, static_rte_bus_pci], + include_directories: includes, + c_args: [cflags, '-mavx512f', '-mavx512bw', '-mavx512vl']) + objs += virtio_avx512_lib.extract_objects('virtio_rxtx_packed_avx.c') if (toolchain == 'gcc' and cc.version().version_compare('>=8.3.0')) cflags += '-DVHOST_GCC_UNROLL_PRAGMA' elif (toolchain == 'clang' and cc.version().version_compare('>=3.7.0'))
@@ -20,7 +26,6 @@ if arch_subdir == 'x86' elif (toolchain == 'icc' and cc.version().version_compare('>=16.0.0')) cflags += '-DVHOST_ICC_UNROLL_PRAGMA' endif - sources += files('virtio_rxtx_packed_avx.c') endif endif sources += files('virtio_rxtx_simple_sse.c')
drivers/net/virtio/virtio_ethdev.c +4 -2
@@ -1965,8 +1965,10 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)PMD_DRV_LOG (INFO ,"building environment do not support packed ring vectorized" );#else - hw->use_vec_rx =1 ; - hw->use_vec_tx =1 ; +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F )) { + hw->use_vec_rx =1 ; + hw->use_vec_tx =1 ; + }#endif } }
Signature · 1 line
2.25.4
Quoted 21 lines · Ferruh Yigit
From: Maxime Coquelin <[email protected]>
The AVX512 packed ring datapath selection was only done at build time, but it should also be checked at runtime that the CPU supports it.
This patch add a CPU flags check so that non-vectorized path is selected at runtime if AVX512 is not supported.
Also in meson build enable vectorization only for relevant file, not for all driver.
Fixes ccb10995c2ad ("net/virtio: add election for vectorized path")Signed-off-by Maxime Coquelin <[email protected]>Signed-off-by Ferruh Yigit <[email protected]>---
Cc: Bruce Richardson <[email protected]>
Cc: Radu Nicolau <[email protected]>
Cc: Luca Boccassi <[email protected]>
Quoted 6 lines
For meson I mainly adapted implementation from other driver, not able to test or verify myself.
--- drivers/net/virtio/meson.build | 9 +++++++-- drivers/net/virtio/virtio_ethdev.c | 6 ++++-- 2 files changed, 11 insertions(+), 4 deletions(-)
Thanks Ferruh, I cannot test either right now but it looks good to me:
In case you're waiting for it:
Maxime
Ferruh Yigit
AppliedQuoted 31 lines · Maxime Coquelin
Quoted 21 lines · Ferruh Yigit
From: Maxime Coquelin <[email protected]>
The AVX512 packed ring datapath selection was only done at build time, but it should also be checked at runtime that the CPU supports it.
This patch add a CPU flags check so that non-vectorized path is selected at runtime if AVX512 is not supported.
Also in meson build enable vectorization only for relevant file, not for all driver.
Fixes ccb10995c2ad ("net/virtio: add election for vectorized path")Signed-off-by Maxime Coquelin <[email protected]>Signed-off-by Ferruh Yigit <[email protected]>---
Cc: Bruce Richardson <[email protected]>
Cc: Radu Nicolau <[email protected]>
Cc: Luca Boccassi <[email protected]>Quoted 6 lines
For meson I mainly adapted implementation from other driver, not able to test or verify myself.
--- drivers/net/virtio/meson.build | 9 +++++++-- drivers/net/virtio/virtio_ethdev.c | 6 ++++-- 2 files changed, 11 insertions(+), 4 deletions(-)
Quoted 5 lines
Thanks Ferruh, I cannot test either right now but it looks good to me:
In case you're waiting for it:
Acked-by Maxime Coquelin <[email protected]>
Applied to dpdk-next-net/master, thanks.
Quoted 39 lines
-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Tuesday, May 12, 2020 3:50 AM
To: Yigit, Ferruh <[email protected]>; Wang, Zhihong <[email protected]>; Ye, Xiaolong <[email protected]>; Liu, Yong <[email protected]>
Cc: [email protected]; Thomas Monjalon <[email protected]>; David Marchand <[email protected]>; Richardson, Bruce <[email protected]>; Nicolau, Radu <[email protected]>; Luca Boccassi <[email protected]>
Subject: Re: [PATCH v2] net/virtio: fix AVX512 datapath selectionQuoted 14 lines · Ferruh Yigit
From: Maxime Coquelin <[email protected]>
The AVX512 packed ring datapath selection was only done at build time, but it should also be checked at runtime that the CPU supports it.
This patch add a CPU flags check so that non-vectorized path is selected at runtime if AVX512 is not supported.
Also in meson build enable vectorization only for relevant file, not for all driver.
Fixes ccb10995c2ad ("net/virtio: add election for vectorized path")Quoted 8 lines
Signed-off-by Maxime Coquelin <[email protected]>Signed-off-by Ferruh Yigit <[email protected]>---
Cc: Bruce Richardson <[email protected]>
Cc: Radu Nicolau <[email protected]>
Cc: Luca Boccassi <[email protected]>For meson I mainly adapted implementation from other driver, not able
Quoted 9 lines
to
Quoted 5 lines
test or verify myself.
--- drivers/net/virtio/meson.build | 9 +++++++-- drivers/net/virtio/virtio_ethdev.c | 6 ++++-- 2 files changed, 11 insertions(+), 4 deletions(-)Thanks Ferruh, I cannot test either right now but it looks good to me:
Hi Maxime & Ferruh,
IMHO, meson build update is the essential part for fixing unexpected AVX512 instructions.
Change in virtio_ethdev may cause building issues on ppc and arm platform. Is it convenient to revert that change?
Regards,
Marvin
Quoted 4 lines
In case you're waiting for it:
Acked-by Maxime Coquelin <[email protected]>Maxime
Quoted 46 lines · Yong
Quoted 46 lines
-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Tuesday, May 12, 2020 3:50 AM
To: Yigit, Ferruh <[email protected]>; Wang, Zhihong <[email protected]>; Ye, Xiaolong <[email protected]>; Liu, Yong <[email protected]>
Cc: [email protected]; Thomas Monjalon <[email protected]>; David Marchand <[email protected]>; Richardson, Bruce <[email protected]>; Nicolau, Radu <[email protected]>; Luca Boccassi <[email protected]>
Subject: Re: [PATCH v2] net/virtio: fix AVX512 datapath selectionQuoted 14 lines · Ferruh Yigit
From: Maxime Coquelin <[email protected]>
The AVX512 packed ring datapath selection was only done at build time, but it should also be checked at runtime that the CPU supports it.
This patch add a CPU flags check so that non-vectorized path is selected at runtime if AVX512 is not supported.
Also in meson build enable vectorization only for relevant file, not for all driver.
Fixes ccb10995c2ad ("net/virtio: add election for vectorized path")Quoted 8 lines
Signed-off-by Maxime Coquelin <[email protected]>Signed-off-by Ferruh Yigit <[email protected]>---
Cc: Bruce Richardson <[email protected]>
Cc: Radu Nicolau <[email protected]>
Cc: Luca Boccassi <[email protected]>For meson I mainly adapted implementation from other driver, not able
to
Quoted 5 lines
test or verify myself.
--- drivers/net/virtio/meson.build | 9 +++++++-- drivers/net/virtio/virtio_ethdev.c | 6 ++++-- 2 files changed, 11 insertions(+), 4 deletions(-)
Quoted 6 lines
Quoted 2 lines
Thanks Ferruh, I cannot test either right now but it looks good to me:
Hi Maxime & Ferruh,
IMHO, meson build update is the essential part for fixing unexpected AVX512 instructions.
Change invirtio_ethdevmay cause building issues on ppc and arm platform. Is it convenient to revert that change?
As replied to v1:
With a bit more of context, we can see that it only affects packed ring when CC_AVX512_SUPPORT is set. So it does break neither split ring nor ARM/PPC:
if (vectorized) {
if (!vtpci_packed_queue(hw)) {
hw->use_vec_rx = 1;
} else {
#if !defined(CC_AVX512_SUPPORT)
PMD_DRV_LOG(INFO,
"building environment do not support packed ring vectorized");
#else
if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F)) {
hw->use_vec_rx = 1;
hw->use_vec_tx = 1;
}
#endif
}
}So IMO, no revert has to be done.
Quoted 8 lines
Regards,
MarvinQuoted 4 lines
In case you're waiting for it:
Acked-by Maxime Coquelin <[email protected]>Maxime
Quoted 96 lines
-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Tuesday, May 12, 2020 4:36 PM
To: Liu, Yong <[email protected]>; Yigit, Ferruh <[email protected]>
Cc: [email protected]; Thomas Monjalon <[email protected]>; David Marchand <[email protected]>; Richardson, Bruce <[email protected]>; Nicolau, Radu <[email protected]>; Luca Boccassi <[email protected]>; Wang, Zhihong <[email protected]>; Ye, Xiaolong <[email protected]>
Subject: Re: [PATCH v2] net/virtio: fix AVX512 datapath selectionQuoted 31 lines · Yong
Quoted 31 lines
-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Tuesday, May 12, 2020 3:50 AM
To: Yigit, Ferruh <[email protected]>; Wang, Zhihong <[email protected]>; Ye, Xiaolong <[email protected]>; Liu, Yong <[email protected]>
Cc: [email protected]; Thomas Monjalon <[email protected]>; David Marchand <[email protected]>; Richardson, Bruce <[email protected]>; Nicolau, Radu <[email protected]>; Luca Boccassi <[email protected]>
Subject: Re: [PATCH v2] net/virtio: fix AVX512 datapath selectionQuoted 14 lines · Ferruh Yigit
From: Maxime Coquelin <[email protected]>
The AVX512 packed ring datapath selection was only done at build time, but it should also be checked at runtime that the CPU supports it.
This patch add a CPU flags check so that non-vectorized path is selected at runtime if AVX512 is not supported.
Also in meson build enable vectorization only for relevant file, not for all driver.
Fixes ccb10995c2ad ("net/virtio: add election for vectorized path")Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Signed-off-by Maxime Coquelin <[email protected]>Signed-off-by Ferruh Yigit <[email protected]>---
Cc: Bruce Richardson <[email protected]>
Cc: Radu Nicolau <[email protected]>
Cc: Luca Boccassi <[email protected]>For meson I mainly adapted implementation from other driver, not
able
Quoted 7 lines
Quoted 7 lines
to
Quoted 5 lines
test or verify myself.
--- drivers/net/virtio/meson.build | 9 +++++++-- drivers/net/virtio/virtio_ethdev.c | 6 ++++-- 2 files changed, 11 insertions(+), 4 deletions(-)Quoted 5 lines
Quoted 2 lines
Thanks Ferruh, I cannot test either right now but it looks good to me:
Hi Maxime & Ferruh,
IMHO, meson build update is the essential part for fixing unexpectedAVX512 instructions.
Quoted 1 line
Change in
virtio_ethdevmay cause building issues on ppc and armplatform. Is it convenient to revert that change?
As replied to v1:
With a bit more of context, we can see that it only affects packed ring when
CC_AVX512_SUPPORTis set. So it does break neither split ring nor ARM/PPC:if (vectorized) { if (!vtpci_packed_queue(hw)) { hw->use_vec_rx = 1; } else {#if !defined(CC_AVX512_SUPPORT)
PMD_DRV_LOG(INFO,
"building environment do not support
packed ring vectorized");
#else
if(rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F)) { hw->use_vec_rx = 1; hw->use_vec_tx = 1; } #endif } }
Quoted 2 lines
So IMO, no revert has to be done.
Ok, I messed it with my previous building fix. It will be no harm for this double check.
Quoted 8 lines
Quoted 8 lines
Regards,
MarvinQuoted 4 lines
In case you're waiting for it:
Acked-by Maxime Coquelin <[email protected]>Maxime
Quoted 96 lines · Yong
Quoted 96 lines
-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Tuesday, May 12, 2020 4:36 PM
To: Liu, Yong <[email protected]>; Yigit, Ferruh <[email protected]>
Cc: [email protected]; Thomas Monjalon <[email protected]>; David Marchand <[email protected]>; Richardson, Bruce <[email protected]>; Nicolau, Radu <[email protected]>; Luca Boccassi <[email protected]>; Wang, Zhihong <[email protected]>; Ye, Xiaolong <[email protected]>
Subject: Re: [PATCH v2] net/virtio: fix AVX512 datapath selectionQuoted 31 lines · Yong
Quoted 31 lines
-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Tuesday, May 12, 2020 3:50 AM
To: Yigit, Ferruh <[email protected]>; Wang, Zhihong <[email protected]>; Ye, Xiaolong <[email protected]>; Liu, Yong <[email protected]>
Cc: [email protected]; Thomas Monjalon <[email protected]>; David Marchand <[email protected]>; Richardson, Bruce <[email protected]>; Nicolau, Radu <[email protected]>; Luca Boccassi <[email protected]>
Subject: Re: [PATCH v2] net/virtio: fix AVX512 datapath selectionQuoted 14 lines · Ferruh Yigit
From: Maxime Coquelin <[email protected]>
The AVX512 packed ring datapath selection was only done at build time, but it should also be checked at runtime that the CPU supports it.
This patch add a CPU flags check so that non-vectorized path is selected at runtime if AVX512 is not supported.
Also in meson build enable vectorization only for relevant file, not for all driver.
Fixes ccb10995c2ad ("net/virtio: add election for vectorized path")Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Signed-off-by Maxime Coquelin <[email protected]>Signed-off-by Ferruh Yigit <[email protected]>---
Cc: Bruce Richardson <[email protected]>
Cc: Radu Nicolau <[email protected]>
Cc: Luca Boccassi <[email protected]>For meson I mainly adapted implementation from other driver, not
able
Quoted 7 lines
Quoted 7 lines
to
Quoted 5 lines
test or verify myself.
--- drivers/net/virtio/meson.build | 9 +++++++-- drivers/net/virtio/virtio_ethdev.c | 6 ++++-- 2 files changed, 11 insertions(+), 4 deletions(-)Quoted 5 lines
Quoted 2 lines
Thanks Ferruh, I cannot test either right now but it looks good to me:
Hi Maxime & Ferruh,
IMHO, meson build update is the essential part for fixing unexpectedAVX512 instructions.
Quoted 1 line
Change in
virtio_ethdevmay cause building issues on ppc and armplatform. Is it convenient to revert that change?
As replied to v1:
With a bit more of context, we can see that it only affects packed ring when
CC_AVX512_SUPPORTis set. So it does break neither split ring nor ARM/PPC:if (vectorized) { if (!vtpci_packed_queue(hw)) { hw->use_vec_rx = 1; } else {#if !defined(CC_AVX512_SUPPORT)
PMD_DRV_LOG(INFO,
"building environment do not support
packed ring vectorized");
#else
if(rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F)) { hw->use_vec_rx = 1; hw->use_vec_tx = 1; } #endif } }
Quoted 4 lines
Quoted 2 lines
So IMO, no revert has to be done.
Ok, I messed it with my previous building fix. It will be no harm for this double check.
While it does not break, I agree for the unnecessary double-check. You can send a clean-up patch to remove this part in -rc3.
Thanks,
Maxime
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
Regards,
MarvinQuoted 4 lines
In case you're waiting for it:
Acked-by Maxime Coquelin <[email protected]>Maxime
Quoted 115 lines
-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Tuesday, May 12, 2020 6:04 PM
To: Liu, Yong <[email protected]>; Yigit, Ferruh <[email protected]>
Cc: [email protected]; Thomas Monjalon <[email protected]>; David Marchand <[email protected]>; Richardson, Bruce <[email protected]>; Nicolau, Radu <[email protected]>; Luca Boccassi <[email protected]>; Wang, Zhihong <[email protected]>; Ye, Xiaolong <[email protected]>
Subject: Re: [PATCH v2] net/virtio: fix AVX512 datapath selectionQuoted 15 lines · Yong
Quoted 15 lines
-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Tuesday, May 12, 2020 4:36 PM
To: Liu, Yong <[email protected]>; Yigit, Ferruh <[email protected]>
Cc: [email protected]; Thomas Monjalon <[email protected]>; David Marchand <[email protected]>; Richardson, Bruce <[email protected]>; Nicolau, Radu <[email protected]>; Luca Boccassi <[email protected]>; Wang, Zhihong <[email protected]>; Ye, Xiaolong <[email protected]>
Subject: Re: [PATCH v2] net/virtio: fix AVX512 datapath selectionQuoted 8 lines
Quoted 8 lines · Yong
Quoted 7 lines
Quoted 7 lines
-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Tuesday, May 12, 2020 3:50 AM
To: Yigit, Ferruh <[email protected]>; Wang, Zhihong <[email protected]>; Ye, Xiaolong <[email protected]>;Liu,
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Yong <[email protected]>
Cc: [email protected]; Thomas Monjalon <[email protected]>; David Marchand <[email protected]>; Richardson, Bruce <[email protected]>; Nicolau, RaduQuoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Luca Boccassi <[email protected]>
Subject: Re: [PATCH v2] net/virtio: fix AVX512 datapath selectionQuoted 2 lines · Ferruh Yigit
From: Maxime Coquelin <[email protected]>
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
The AVX512 packed ring datapath selection was only done at build time, but it should also be checked at runtime that the CPU supports it.
This patch add a CPU flags check so that non-vectorized path is selected at runtime if AVX512 is not supported.
Also in meson build enable vectorization only for relevant file, not
for
Quoted 53 lines
Quoted 53 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
all driver.
Fixes ccb10995c2ad ("net/virtio: add election for vectorized path")Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Signed-off-by Maxime Coquelin <[email protected]>Signed-off-by Ferruh Yigit <[email protected]>---
Cc: Bruce Richardson <[email protected]>
Cc: Radu Nicolau <[email protected]>
Cc: Luca Boccassi <[email protected]>For meson I mainly adapted implementation from other driver, not
able
Quoted 7 lines
Quoted 7 lines
to
Quoted 5 lines
test or verify myself.
--- drivers/net/virtio/meson.build | 9 +++++++-- drivers/net/virtio/virtio_ethdev.c | 6 ++++-- 2 files changed, 11 insertions(+), 4 deletions(-)Quoted 5 lines
Quoted 2 lines
Thanks Ferruh, I cannot test either right now but it looks good to me:
Hi Maxime & Ferruh,
IMHO, meson build update is the essential part for fixing unexpectedAVX512 instructions.
Quoted 1 line
Change in
virtio_ethdevmay cause building issues on ppc and armplatform. Is it convenient to revert that change?
As replied to v1:
With a bit more of context, we can see that it only affects packed ring when
CC_AVX512_SUPPORTis set. So it does break neither split ring nor ARM/PPC:if (vectorized) { if (!vtpci_packed_queue(hw)) { hw->use_vec_rx = 1; } else {#if !defined(CC_AVX512_SUPPORT)
PMD_DRV_LOG(INFO,
"building environment do not support
packed ring vectorized");
#else
if(rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F)) { hw->use_vec_rx = 1; hw->use_vec_tx = 1; } #endif } }
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines
So IMO, no revert has to be done.
Ok, I messed it with my previous building fix. It will be no harm for this
double check.
While it does not break, I agree for the unnecessary double-check. You can send a clean-up patch to remove this part in -rc3.
Thanks a lot, have sent clean-up patch.
Quoted 12 lines
Thanks,
MaximeQuoted 9 lines
Quoted 8 lines
Quoted 8 lines
Regards,
MarvinQuoted 4 lines
In case you're waiting for it:
Acked-by Maxime Coquelin <[email protected]>Maxime
Quoted 32 lines
-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Monday, May 11, 2020 10:47 PM
To: Liu, Yong <[email protected]>; Ye, Xiaolong <[email protected]>; Yigit, Ferruh <[email protected]>; [email protected]
Cc: Maxime Coquelin <[email protected]>
Subject: [PATCH] net/virtio: fix AVX512 datapath selectionThe AVX512 packed ring datapath selection was only done at build time, but it should also be checked at runtime that the CPU supports it.
This patch add a CPU flags check so that non-vectorized path is selected at runtime if AVX512 is not supported.
Fixes ccb10995c2ad ("net/virtio: add election for vectorized path")Signed-off-by Maxime Coquelin <[email protected]>--- drivers/net/virtio/virtio_ethdev.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/net/virtio/virtio_ethdev.c +0
-0@@ -1965,8 +1965,10 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev) PMD_DRV_LOG(INFO, "building environment do not support
drivers/net/virtio/virtio_ethdev.c eth_virtio_dev_init(struct rte_eth_dev *eth_dev) · line 1974
Quoted 10 lines
drivers/net/virtio/virtio_ethdev.c +4
-2packed ring vectorized");#else - hw->use_vec_rx = 1; - hw->use_vec_tx = 1; +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F )) { + hw->use_vec_rx =1 ; + hw->use_vec_tx =1 ; + }#endif
Hi Maxime,
Here is pre-setting for vectorized path selection, virtio_dev_configure will do second time check.
Running environment will be checked in second time check. We can move some checks from virtio_dev_configure to here, but is it needed to do that?
BTW, both split ring and packed ring will utilized this setting, it will break split vectorized datapath is server not has AVX512F flag. And it may cause building issue on those platforms which not defined RTE_CPUFLAG_AVX512F.
Thanks,
Marvin
Quoted 4 lines
drivers/net/virtio/virtio_ethdev.c +0
-1} } --2.25.4
Quoted 47 lines · Yong
Quoted 32 lines
-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Monday, May 11, 2020 10:47 PM
To: Liu, Yong <[email protected]>; Ye, Xiaolong <[email protected]>; Yigit, Ferruh <[email protected]>; [email protected]
Cc: Maxime Coquelin <[email protected]>
Subject: [PATCH] net/virtio: fix AVX512 datapath selectionThe AVX512 packed ring datapath selection was only done at build time, but it should also be checked at runtime that the CPU supports it.
This patch add a CPU flags check so that non-vectorized path is selected at runtime if AVX512 is not supported.
Fixes ccb10995c2ad ("net/virtio: add election for vectorized path")Signed-off-by Maxime Coquelin <[email protected]>--- drivers/net/virtio/virtio_ethdev.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/net/virtio/virtio_ethdev.c +0
-0@@ -1965,8 +1965,10 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev) PMD_DRV_LOG(INFO, "building environment do not supportdrivers/net/virtio/virtio_ethdev.c eth_virtio_dev_init(struct rte_eth_dev *eth_dev) · line 1974
Quoted 10 lines
drivers/net/virtio/virtio_ethdev.c +4
-2packed ring vectorized");#else - hw->use_vec_rx = 1; - hw->use_vec_tx = 1; +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F )) { + hw->use_vec_rx =1 ; + hw->use_vec_tx =1 ; + }#endif Hi Maxime,
Here is pre-setting for vectorized path selection,virtio_dev_configurewill do second time check.
Running environment will be checked in second time check. We can move some checks fromvirtio_dev_configureto here, but is it needed to do that?
Quoted 2 lines
BTW, both split ring and packed ring will utilized this setting, it will break split vectorized datapath is server not has AVX512F flag. And it may cause building issue on those platforms which not defined
RTE_CPUFLAG_AVX512F.
With a bit more of context, we can see that it only affects packed ring when CC_AVX512_SUPPORT is set. So it does break neither split ring nor ARM/PPC:
if (vectorized) {
if (!vtpci_packed_queue(hw)) {
hw->use_vec_rx = 1;
} else {
#if !defined(CC_AVX512_SUPPORT)
PMD_DRV_LOG(INFO,
"building environment do not support packed ring vectorized");
#else
if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F)) {
hw->use_vec_rx = 1;
hw->use_vec_tx = 1;
}
#endif
}
}Quoted 8 lines
Thanks,
MarvinQuoted 4 lines
drivers/net/virtio/virtio_ethdev.c +0
-1} } --2.25.4