DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] AVX check
@ 2018-04-26 16:06 Riccardo Ravaioli
  2018-04-26 16:34 ` Bruce Richardson
  0 siblings, 1 reply; 2+ messages in thread
From: Riccardo Ravaioli @ 2018-04-26 16:06 UTC (permalink / raw)
  To: dev

Hi all,

I need to install DPDK on 64-bit Linux machines whose processors might or
might not support AVX instructions. In my current configuration file,
defconfig_x86-64-native-linuxapp-gcc, the parameter CONFIG_RTE_MACHINE is
set to native. If I compile DPDK on a machine that supports AVX and then I
install it (along with openvswitch) on a machine that does *not* support
AVX, openvswitch won't start and will output an "illegal instruction"
error.

I'm proposing the following patch to fix this issue:

diff -r ac0f646132b8 src/lib/librte_net/rte_net_crc.c
--- a/src/lib/librte_net/rte_net_crc.c    Thu Apr 26 17:25:01 2018 +0200
+++ b/src/lib/librte_net/rte_net_crc.c    Thu Apr 26 17:25:04 2018 +0200
@@ -212,8 +212,10 @@
     rte_net_crc_scalar_init();

 #ifdef X86_64_SSE42_PCLMULQDQ
-    alg = RTE_NET_CRC_SSE42;
-    rte_net_crc_sse42_init();
+   if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX)) {
+       alg = RTE_NET_CRC_SSE42;
+       rte_net_crc_sse42_init();
+   }
 #elif defined ARM64_NEON_PMULL
     if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_PMULL)) {
         alg = RTE_NET_CRC_NEON;


The original check above is for SSE4, not for AVX, but the chosen function
rte_net_crc_sse42_init does run AVX instructions. So I suggest making the
check for AVX explicit, as outlined above.
I tested this on a machine with an Intel Atom C3000 processor and
openvswitch seems to function correctly.

Are there any potential side effects?

Thanks!

Riccardo

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH] AVX check
  2018-04-26 16:06 [dpdk-dev] [PATCH] AVX check Riccardo Ravaioli
@ 2018-04-26 16:34 ` Bruce Richardson
  0 siblings, 0 replies; 2+ messages in thread
From: Bruce Richardson @ 2018-04-26 16:34 UTC (permalink / raw)
  To: Riccardo Ravaioli; +Cc: dev

On Thu, Apr 26, 2018 at 06:06:47PM +0200, Riccardo Ravaioli wrote:
> Hi all,
> 
> I need to install DPDK on 64-bit Linux machines whose processors might or
> might not support AVX instructions. In my current configuration file,
> defconfig_x86-64-native-linuxapp-gcc, the parameter CONFIG_RTE_MACHINE is
> set to native. If I compile DPDK on a machine that supports AVX and then I
> install it (along with openvswitch) on a machine that does *not* support
> AVX, openvswitch won't start and will output an "illegal instruction"
> error.
> 
> I'm proposing the following patch to fix this issue:
> 

Hi,

rather than changing the code, the best way to handle this is to change the
build target to something other than "native" in the build config file. I
would suggest "nehalem" as a suitable MACHINE type value. This provides
SSE4.x support, but no AVX.

/Bruce

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-04-26 16:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-26 16:06 [dpdk-dev] [PATCH] AVX check Riccardo Ravaioli
2018-04-26 16:34 ` Bruce Richardson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).