DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 3/3] net: run-time function selection
@ 2017-11-06 18:05 Elza Mathew
  2017-12-11 15:31 ` Bruce Richardson
  0 siblings, 1 reply; 5+ messages in thread
From: Elza Mathew @ 2017-11-06 18:05 UTC (permalink / raw)
  To: jasvinder.singh; +Cc: dev

Compile-time function selection can potentially lead to
lower performance on generic builds done by distros.
Replaced compile time flag checks with run-time
function selection.

Signed-off-by: Elza Mathew <elza.mathew@intel.com>
---
 lib/librte_net/rte_net_crc.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/lib/librte_net/rte_net_crc.c b/lib/librte_net/rte_net_crc.c
index 661fe32..8f6a0e7 100644
--- a/lib/librte_net/rte_net_crc.c
+++ b/lib/librte_net/rte_net_crc.c
@@ -39,8 +39,8 @@
 #include <rte_common.h>
 #include <rte_net_crc.h>
 
-#if defined(RTE_ARCH_X86_64) && defined(RTE_MACHINE_CPUFLAG_PCLMULQDQ)
-#define X86_64_SSE42_PCLMULQDQ     1
+#ifdef RTE_ARCH_X86_64
+#include <net_crc_sse.h>
 #elif defined(RTE_ARCH_ARM64) && defined(RTE_MACHINE_CPUFLAG_PMULL)
 #define ARM64_NEON_PMULL           1
 #endif
@@ -71,7 +71,7 @@
 	[RTE_NET_CRC32_ETH] = rte_crc32_eth_handler,
 };
 
-#ifdef X86_64_SSE42_PCLMULQDQ
+#ifdef RTE_ARCH_X86_64
 static rte_net_crc_handler handlers_sse42[] = {
 	[RTE_NET_CRC16_CCITT] = rte_crc16_ccitt_sse42_handler,
 	[RTE_NET_CRC32_ETH] = rte_crc32_eth_sse42_handler,
@@ -169,10 +169,12 @@
 rte_net_crc_set_alg(enum rte_net_crc_alg alg)
 {
 	switch (alg) {
-#ifdef X86_64_SSE42_PCLMULQDQ
+#ifdef RTE_ARCH_X86_64
 	case RTE_NET_CRC_SSE42:
-		handlers = handlers_sse42;
-		break;
+		if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_PCLMULQDQ)) {
+			handlers = handlers_sse42;
+			break;
+		}
 #elif defined ARM64_NEON_PMULL
 		/* fall-through */
 	case RTE_NET_CRC_NEON:
@@ -212,9 +214,11 @@ static inline void __attribute__((constructor))
 
 	rte_net_crc_scalar_init();
 
-#ifdef X86_64_SSE42_PCLMULQDQ
-	alg = RTE_NET_CRC_SSE42;
-	rte_net_crc_sse42_init();
+#ifdef RTE_ARCH_X86_64
+	if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_PCLMULQDQ)) {
+		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;
-- 
1.9.1

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

* Re: [dpdk-dev] [PATCH 3/3] net: run-time function selection
  2017-11-06 18:05 [dpdk-dev] [PATCH 3/3] net: run-time function selection Elza Mathew
@ 2017-12-11 15:31 ` Bruce Richardson
  2018-01-18 23:43   ` Thomas Monjalon
  2018-01-22 17:36   ` Bruce Richardson
  0 siblings, 2 replies; 5+ messages in thread
From: Bruce Richardson @ 2017-12-11 15:31 UTC (permalink / raw)
  To: Elza Mathew; +Cc: jasvinder.singh, dev

On Mon, Nov 06, 2017 at 10:05:43AM -0800, Elza Mathew wrote:
> Compile-time function selection can potentially lead to
> lower performance on generic builds done by distros.
> Replaced compile time flag checks with run-time
> function selection.
> 
> Signed-off-by: Elza Mathew <elza.mathew@intel.com>
> ---
>  lib/librte_net/rte_net_crc.c | 22 +++++++++++++---------
>  1 file changed, 13 insertions(+), 9 deletions(-)
> 
Patch looks good to me, but unfortunately the compilation testing shows
an issue with clang compliation on FreeBSD 10. I've also tested with gcc
on both BSD 10 and 11 and saw no issues, and BSD 11 clang compilation is
also fine. 

The compilation error is due to missing _mm_clmulepi64_si128 instrinsic:
In file included from /home/patchWorkOrg/compilation/lib/librte_net/rte_net_crc.c:43:
/home/patchWorkOrg/compilation/lib/librte_net/net_crc_sse.h:81:17: error: implicit declaration of function '_mm_clmulepi64_si128' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        __m128i tmp0 = _mm_clmulepi64_si128(fold, precomp, 0x01);

/Bruce

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

* Re: [dpdk-dev] [PATCH 3/3] net: run-time function selection
  2017-12-11 15:31 ` Bruce Richardson
@ 2018-01-18 23:43   ` Thomas Monjalon
  2018-01-19  9:20     ` Bruce Richardson
  2018-01-22 17:36   ` Bruce Richardson
  1 sibling, 1 reply; 5+ messages in thread
From: Thomas Monjalon @ 2018-01-18 23:43 UTC (permalink / raw)
  To: Bruce Richardson, Elza Mathew; +Cc: dev, jasvinder.singh

11/12/2017 16:31, Bruce Richardson:
> On Mon, Nov 06, 2017 at 10:05:43AM -0800, Elza Mathew wrote:
> > Compile-time function selection can potentially lead to
> > lower performance on generic builds done by distros.
> > Replaced compile time flag checks with run-time
> > function selection.
> > 
> > Signed-off-by: Elza Mathew <elza.mathew@intel.com>
> > ---
> >  lib/librte_net/rte_net_crc.c | 22 +++++++++++++---------
> >  1 file changed, 13 insertions(+), 9 deletions(-)
> > 
> Patch looks good to me, but unfortunately the compilation testing shows
> an issue with clang compliation on FreeBSD 10. I've also tested with gcc
> on both BSD 10 and 11 and saw no issues, and BSD 11 clang compilation is
> also fine. 
> 
> The compilation error is due to missing _mm_clmulepi64_si128 instrinsic:
> In file included from /home/patchWorkOrg/compilation/lib/librte_net/rte_net_crc.c:43:
> /home/patchWorkOrg/compilation/lib/librte_net/net_crc_sse.h:81:17: error: implicit declaration of function '_mm_clmulepi64_si128' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
>         __m128i tmp0 = _mm_clmulepi64_si128(fold, precomp, 0x01);

Any update please?

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

* Re: [dpdk-dev] [PATCH 3/3] net: run-time function selection
  2018-01-18 23:43   ` Thomas Monjalon
@ 2018-01-19  9:20     ` Bruce Richardson
  0 siblings, 0 replies; 5+ messages in thread
From: Bruce Richardson @ 2018-01-19  9:20 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: Elza Mathew, dev, jasvinder.singh

On Fri, Jan 19, 2018 at 12:43:09AM +0100, Thomas Monjalon wrote:
> 11/12/2017 16:31, Bruce Richardson:
> > On Mon, Nov 06, 2017 at 10:05:43AM -0800, Elza Mathew wrote:
> > > Compile-time function selection can potentially lead to
> > > lower performance on generic builds done by distros.
> > > Replaced compile time flag checks with run-time
> > > function selection.
> > > 
> > > Signed-off-by: Elza Mathew <elza.mathew@intel.com>
> > > ---
> > >  lib/librte_net/rte_net_crc.c | 22 +++++++++++++---------
> > >  1 file changed, 13 insertions(+), 9 deletions(-)
> > > 
> > Patch looks good to me, but unfortunately the compilation testing shows
> > an issue with clang compliation on FreeBSD 10. I've also tested with gcc
> > on both BSD 10 and 11 and saw no issues, and BSD 11 clang compilation is
> > also fine. 
> > 
> > The compilation error is due to missing _mm_clmulepi64_si128 instrinsic:
> > In file included from /home/patchWorkOrg/compilation/lib/librte_net/rte_net_crc.c:43:
> > /home/patchWorkOrg/compilation/lib/librte_net/net_crc_sse.h:81:17: error: implicit declaration of function '_mm_clmulepi64_si128' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
> >         __m128i tmp0 = _mm_clmulepi64_si128(fold, precomp, 0x01);
> 
> Any update please?

I'll work with Elza to see if I can find a workaround for this compiler
issue. In the meantime, perhaps patches 1 and 2 of the set can be
applied so that we can do a new patch 3 only when we get it fixed.

/Bruce

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

* Re: [dpdk-dev] [PATCH 3/3] net: run-time function selection
  2017-12-11 15:31 ` Bruce Richardson
  2018-01-18 23:43   ` Thomas Monjalon
@ 2018-01-22 17:36   ` Bruce Richardson
  1 sibling, 0 replies; 5+ messages in thread
From: Bruce Richardson @ 2018-01-22 17:36 UTC (permalink / raw)
  To: Elza Mathew; +Cc: jasvinder.singh, dev

On Mon, Dec 11, 2017 at 03:31:16PM +0000, Bruce Richardson wrote:
> On Mon, Nov 06, 2017 at 10:05:43AM -0800, Elza Mathew wrote:
> > Compile-time function selection can potentially lead to
> > lower performance on generic builds done by distros.
> > Replaced compile time flag checks with run-time
> > function selection.
> > 
> > Signed-off-by: Elza Mathew <elza.mathew@intel.com>
> > ---
> >  lib/librte_net/rte_net_crc.c | 22 +++++++++++++---------
> >  1 file changed, 13 insertions(+), 9 deletions(-)
> > 
> Patch looks good to me, but unfortunately the compilation testing shows
> an issue with clang compliation on FreeBSD 10. I've also tested with gcc
> on both BSD 10 and 11 and saw no issues, and BSD 11 clang compilation is
> also fine. 
> 
> The compilation error is due to missing _mm_clmulepi64_si128 instrinsic:
> In file included from /home/patchWorkOrg/compilation/lib/librte_net/rte_net_crc.c:43:
> /home/patchWorkOrg/compilation/lib/librte_net/net_crc_sse.h:81:17: error: implicit declaration of function '_mm_clmulepi64_si128' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
>         __m128i tmp0 = _mm_clmulepi64_si128(fold, precomp, 0x01);
> 
> /Bruce

Checking with latest images for 10.3 or 10.4 no longer shows this
problem. I think the patch can be merged as-is.

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

Thomas, do you need a resubmit to appear as a new patch in patchwork?

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

end of thread, other threads:[~2018-01-22 17:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-06 18:05 [dpdk-dev] [PATCH 3/3] net: run-time function selection Elza Mathew
2017-12-11 15:31 ` Bruce Richardson
2018-01-18 23:43   ` Thomas Monjalon
2018-01-19  9:20     ` Bruce Richardson
2018-01-22 17:36   ` 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).