[dpdk-dev,1/3] examples/distributor: fix build for non-x86 arch

Message ID 1454684049-27195-2-git-send-email-thomas.monjalon@6wind.com (mailing list archive)
State Rejected, archived
Headers

Commit Message

Thomas Monjalon Feb. 5, 2016, 2:54 p.m. UTC
  _mm_prefetch is defined only in x86 compilers.
rte_prefetch functions are defined in EAL for each arch,
and must be preferred over compiler intrinsics.

Fixes: 07db4a975094 ("examples/distributor: new sample app")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
 examples/distributor/main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Comments

Pattan, Reshma Feb. 5, 2016, 3:07 p.m. UTC | #1
Hi Thomas,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Thomas Monjalon
> Sent: Friday, February 5, 2016 2:54 PM
> To: Richardson, Bruce; Horton, Remy
> Cc: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH 1/3] examples/distributor: fix build for non-x86 arch
> 
> _mm_prefetch is defined only in x86 compilers.
> rte_prefetch functions are defined in EAL for each arch, and must be preferred
> over compiler intrinsics.
> 
> Fixes: 07db4a975094 ("examples/distributor: new sample app")
> 
> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
> ---
>  examples/distributor/main.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/examples/distributor/main.c b/examples/distributor/main.c index
> 4e74f8f..87344ac 100644
> --- a/examples/distributor/main.c
> +++ b/examples/distributor/main.c
> @@ -335,13 +335,13 @@ lcore_tx(struct rte_ring *in_r)
> 
>  			/* for traffic we receive, queue it up for transmit */
>  			uint16_t i;
> -			_mm_prefetch((void *)bufs[0], 0);
> -			_mm_prefetch((void *)bufs[1], 0);
> -			_mm_prefetch((void *)bufs[2], 0);
> +			rte_prefetch0((void *)bufs[0]);
> +			rte_prefetch0((void *)bufs[1]);
> +			rte_prefetch0((void *)bufs[2]);

Some time back Jerin Jacob has sent patch for replacing the _mm_prefetch  with rte_prefetch_non_temporal. This is FYI.

Thanks,
Reshma

>  			for (i = 0; i < nb_rx; i++) {
>  				struct output_buffer *outbuf;
>  				uint8_t outp;
> -				_mm_prefetch((void *)bufs[i + 3], 0);
> +				rte_prefetch0((void *)bufs[i + 3]);
>  				/*
>  				 * workers should update in_port to hold the
>  				 * output port value
> --
> 2.7.0
  
Ananyev, Konstantin Feb. 5, 2016, 3:15 p.m. UTC | #2
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Pattan, Reshma
> Sent: Friday, February 05, 2016 3:08 PM
> To: Thomas Monjalon
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 1/3] examples/distributor: fix build for non-x86 arch
> 
> Hi Thomas,
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Thomas Monjalon
> > Sent: Friday, February 5, 2016 2:54 PM
> > To: Richardson, Bruce; Horton, Remy
> > Cc: dev@dpdk.org
> > Subject: [dpdk-dev] [PATCH 1/3] examples/distributor: fix build for non-x86 arch
> >
> > _mm_prefetch is defined only in x86 compilers.
> > rte_prefetch functions are defined in EAL for each arch, and must be preferred
> > over compiler intrinsics.
> >
> > Fixes: 07db4a975094 ("examples/distributor: new sample app")
> >
> > Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
> > ---
> >  examples/distributor/main.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/examples/distributor/main.c b/examples/distributor/main.c index
> > 4e74f8f..87344ac 100644
> > --- a/examples/distributor/main.c
> > +++ b/examples/distributor/main.c
> > @@ -335,13 +335,13 @@ lcore_tx(struct rte_ring *in_r)
> >
> >  			/* for traffic we receive, queue it up for transmit */
> >  			uint16_t i;
> > -			_mm_prefetch((void *)bufs[0], 0);
> > -			_mm_prefetch((void *)bufs[1], 0);
> > -			_mm_prefetch((void *)bufs[2], 0);
> > +			rte_prefetch0((void *)bufs[0]);
> > +			rte_prefetch0((void *)bufs[1]);
> > +			rte_prefetch0((void *)bufs[2]);
> 
> Some time back Jerin Jacob has sent patch for replacing the _mm_prefetch  with rte_prefetch_non_temporal. This is FYI.

Yep:
http://dpdk.org/dev/patchwork/patch/9369/
http://dpdk.org/dev/patchwork/patch/9370/

And on IA _mm_prefetch(p, 0) != rte_prefetch0(p).
I think, as in Jacob implementation, it should be PREFETCHNTA.
Konstantin

> 
> Thanks,
> Reshma
> 
> >  			for (i = 0; i < nb_rx; i++) {
> >  				struct output_buffer *outbuf;
> >  				uint8_t outp;
> > -				_mm_prefetch((void *)bufs[i + 3], 0);
> > +				rte_prefetch0((void *)bufs[i + 3]);
> >  				/*
> >  				 * workers should update in_port to hold the
> >  				 * output port value
> > --
> > 2.7.0
  
Thomas Monjalon Feb. 5, 2016, 3:55 p.m. UTC | #3
2016-02-05 15:15, Ananyev, Konstantin:
> From: Pattan, Reshma
> > From: Thomas Monjalon
> > > _mm_prefetch is defined only in x86 compilers.
> > > rte_prefetch functions are defined in EAL for each arch, and must be preferred
> > > over compiler intrinsics.
[...]
> > > -			_mm_prefetch((void *)bufs[0], 0);
> > > -			_mm_prefetch((void *)bufs[1], 0);
> > > -			_mm_prefetch((void *)bufs[2], 0);
> > > +			rte_prefetch0((void *)bufs[0]);
> > > +			rte_prefetch0((void *)bufs[1]);
> > > +			rte_prefetch0((void *)bufs[2]);
> > 
> > Some time back Jerin Jacob has sent patch for replacing the _mm_prefetch  with rte_prefetch_non_temporal. This is FYI.
> 
> Yep:
> http://dpdk.org/dev/patchwork/patch/9369/
> http://dpdk.org/dev/patchwork/patch/9370/
> 
> And on IA _mm_prefetch(p, 0) != rte_prefetch0(p).
> I think, as in Jacob implementation, it should be PREFETCHNTA.

Oh yes, you're right. Thanks
patch rejected
  

Patch

diff --git a/examples/distributor/main.c b/examples/distributor/main.c
index 4e74f8f..87344ac 100644
--- a/examples/distributor/main.c
+++ b/examples/distributor/main.c
@@ -335,13 +335,13 @@  lcore_tx(struct rte_ring *in_r)
 
 			/* for traffic we receive, queue it up for transmit */
 			uint16_t i;
-			_mm_prefetch((void *)bufs[0], 0);
-			_mm_prefetch((void *)bufs[1], 0);
-			_mm_prefetch((void *)bufs[2], 0);
+			rte_prefetch0((void *)bufs[0]);
+			rte_prefetch0((void *)bufs[1]);
+			rte_prefetch0((void *)bufs[2]);
 			for (i = 0; i < nb_rx; i++) {
 				struct output_buffer *outbuf;
 				uint8_t outp;
-				_mm_prefetch((void *)bufs[i + 3], 0);
+				rte_prefetch0((void *)bufs[i + 3]);
 				/*
 				 * workers should update in_port to hold the
 				 * output port value