DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/virtio: fix build error with clang
@ 2016-08-23  7:40 Yuanhan Liu
  2016-09-23  6:11 ` Yuanhan Liu
  2016-09-23  6:15 ` [dpdk-dev] [PATCH v2] " Yuanhan Liu
  0 siblings, 2 replies; 11+ messages in thread
From: Yuanhan Liu @ 2016-08-23  7:40 UTC (permalink / raw)
  To: dev; +Cc: Yuanhan Liu, Jerin Jacob

Interestingly, clang and gcc has different prototype for _mm_prefetch().
For gcc, we have

   _mm_prefetch (const void *__P, enum _mm_hint __I)

While for clang, it's

   #define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), 0, (sel)))

That how the following error comes with clang:

   error: cast from 'const void *' to 'void *' drops const qualifier
   [-Werror,-Wcast-qual]
           _mm_prefetch((const void *)rused, _MM_HINT_T0);
   /usr/lib/llvm-3.8/bin/../lib/clang/3.8.0/include/xmmintrin.h:684:58:
   note: expanded from macro '_mm_prefetch'
            #define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a),
                                          0, (sel)))

What's weird is that the build was actaully Okay before. I met it while
apply Jerin's vector support for ARM patch set: he just move this peiece
of code to another file, nothing else changed.

This patch fix the issue when Jerin's patchset is applied. Thus, I think
it's still needed.

Fixes: fc3d66212fed ("virtio: add vector Rx")

Cc: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
 drivers/net/virtio/virtio_rxtx_simple.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/virtio/virtio_rxtx_simple.c b/drivers/net/virtio/virtio_rxtx_simple.c
index 6517aa8..56195e5 100644
--- a/drivers/net/virtio/virtio_rxtx_simple.c
+++ b/drivers/net/virtio/virtio_rxtx_simple.c
@@ -200,7 +200,7 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 	sw_ring  = &vq->sw_ring[desc_idx];
 	sw_ring_end = &vq->sw_ring[vq->vq_nentries];
 
-	_mm_prefetch((const void *)rused, _MM_HINT_T0);
+	_mm_prefetch(rused, _MM_HINT_T0);
 
 	if (vq->vq_free_cnt >= RTE_VIRTIO_VPMD_RX_REARM_THRESH) {
 		virtio_rxq_rearm_vec(rxvq);
-- 
1.9.0

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

* Re: [dpdk-dev] [PATCH] net/virtio: fix build error with clang
  2016-08-23  7:40 [dpdk-dev] [PATCH] net/virtio: fix build error with clang Yuanhan Liu
@ 2016-09-23  6:11 ` Yuanhan Liu
  2016-09-23  6:15 ` [dpdk-dev] [PATCH v2] " Yuanhan Liu
  1 sibling, 0 replies; 11+ messages in thread
From: Yuanhan Liu @ 2016-09-23  6:11 UTC (permalink / raw)
  To: dev; +Cc: Jerin Jacob

On Tue, Aug 23, 2016 at 03:40:58PM +0800, Yuanhan Liu wrote:
> Interestingly, clang and gcc has different prototype for _mm_prefetch().
> For gcc, we have
> 
>    _mm_prefetch (const void *__P, enum _mm_hint __I)
> 
> While for clang, it's
> 
>    #define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), 0, (sel)))
> 
> That how the following error comes with clang:
> 
>    error: cast from 'const void *' to 'void *' drops const qualifier
>    [-Werror,-Wcast-qual]
>            _mm_prefetch((const void *)rused, _MM_HINT_T0);
>    /usr/lib/llvm-3.8/bin/../lib/clang/3.8.0/include/xmmintrin.h:684:58:
>    note: expanded from macro '_mm_prefetch'
>             #define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a),
>                                           0, (sel)))
> 
> What's weird is that the build was actaully Okay before. I met it while
> apply Jerin's vector support for ARM patch set: he just move this peiece
> of code to another file, nothing else changed.
> 
> This patch fix the issue when Jerin's patchset is applied. Thus, I think
> it's still needed.

Unfortunately, it makes the icc build fail. I will submit another patch
to simply change _mm_prefetch to rte_prefetch0.

	--yliu
> 
> Fixes: fc3d66212fed ("virtio: add vector Rx")
> 
> Cc: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
> ---
>  drivers/net/virtio/virtio_rxtx_simple.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/virtio/virtio_rxtx_simple.c b/drivers/net/virtio/virtio_rxtx_simple.c
> index 6517aa8..56195e5 100644
> --- a/drivers/net/virtio/virtio_rxtx_simple.c
> +++ b/drivers/net/virtio/virtio_rxtx_simple.c
> @@ -200,7 +200,7 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
>  	sw_ring  = &vq->sw_ring[desc_idx];
>  	sw_ring_end = &vq->sw_ring[vq->vq_nentries];
>  
> -	_mm_prefetch((const void *)rused, _MM_HINT_T0);
> +	_mm_prefetch(rused, _MM_HINT_T0);
>  
>  	if (vq->vq_free_cnt >= RTE_VIRTIO_VPMD_RX_REARM_THRESH) {
>  		virtio_rxq_rearm_vec(rxvq);
> -- 
> 1.9.0

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

* [dpdk-dev] [PATCH v2] net/virtio: fix build error with clang
  2016-08-23  7:40 [dpdk-dev] [PATCH] net/virtio: fix build error with clang Yuanhan Liu
  2016-09-23  6:11 ` Yuanhan Liu
@ 2016-09-23  6:15 ` Yuanhan Liu
  2016-09-23  6:35   ` Jerin Jacob
                     ` (2 more replies)
  1 sibling, 3 replies; 11+ messages in thread
From: Yuanhan Liu @ 2016-09-23  6:15 UTC (permalink / raw)
  To: dev; +Cc: Yuanhan Liu, Jerin Jacob

Interestingly, clang and gcc has different prototype for _mm_prefetch().
For gcc, we have

   _mm_prefetch (const void *__P, enum _mm_hint __I)

While for clang, it's

   #define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), 0, (sel)))

That how the following error comes with clang:

   error: cast from 'const void *' to 'void *' drops const qualifier
   [-Werror,-Wcast-qual]
           _mm_prefetch((const void *)rused, _MM_HINT_T0);
   /usr/lib/llvm-3.8/bin/../lib/clang/3.8.0/include/xmmintrin.h:684:58:
   note: expanded from macro '_mm_prefetch'
            #define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a),
                                          0, (sel)))

What's weird is that the build was actaully Okay before. I met it while
apply Jerin's vector support for ARM patch set: he just move this peiece
of code to another file, nothing else changed.

This patch fix the issue when Jerin's patchset is applied. Thus, I think
it's still needed.

Fixes: fc3d66212fed ("virtio: add vector Rx")

Cc: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
v2: replace _mm_prefetch with rte_prefetch0 to make icc happy
---
 drivers/net/virtio/virtio_rxtx_simple.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/virtio/virtio_rxtx_simple.c b/drivers/net/virtio/virtio_rxtx_simple.c
index 6517aa8..d8dd17c 100644
--- a/drivers/net/virtio/virtio_rxtx_simple.c
+++ b/drivers/net/virtio/virtio_rxtx_simple.c
@@ -200,7 +200,7 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 	sw_ring  = &vq->sw_ring[desc_idx];
 	sw_ring_end = &vq->sw_ring[vq->vq_nentries];
 
-	_mm_prefetch((const void *)rused, _MM_HINT_T0);
+	rte_prefetch0(rused);
 
 	if (vq->vq_free_cnt >= RTE_VIRTIO_VPMD_RX_REARM_THRESH) {
 		virtio_rxq_rearm_vec(rxvq);
-- 
1.9.0

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

* Re: [dpdk-dev] [PATCH v2] net/virtio: fix build error with clang
  2016-09-23  6:15 ` [dpdk-dev] [PATCH v2] " Yuanhan Liu
@ 2016-09-23  6:35   ` Jerin Jacob
  2016-09-23  6:43     ` Yuanhan Liu
  2016-09-23  8:31   ` Thomas Monjalon
  2016-09-26  4:29   ` [dpdk-dev] [PATCH v3] net: " Yuanhan Liu
  2 siblings, 1 reply; 11+ messages in thread
From: Jerin Jacob @ 2016-09-23  6:35 UTC (permalink / raw)
  To: Yuanhan Liu; +Cc: dev

On Fri, Sep 23, 2016 at 02:15:09PM +0800, Yuanhan Liu wrote:

Hi Yuanhan,

Thanks for this patch.

> Interestingly, clang and gcc has different prototype for _mm_prefetch().
> For gcc, we have
> 
>    _mm_prefetch (const void *__P, enum _mm_hint __I)
> 
> While for clang, it's
> 
>    #define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), 0, (sel)))
> 
> That how the following error comes with clang:
> 
>    error: cast from 'const void *' to 'void *' drops const qualifier
>    [-Werror,-Wcast-qual]
>            _mm_prefetch((const void *)rused, _MM_HINT_T0);
>    /usr/lib/llvm-3.8/bin/../lib/clang/3.8.0/include/xmmintrin.h:684:58:
>    note: expanded from macro '_mm_prefetch'
>             #define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a),
>                                           0, (sel)))
> 
> What's weird is that the build was actaully Okay before. I met it while
> apply Jerin's vector support for ARM patch set: he just move this peiece
> of code to another file, nothing else changed.
> 
> This patch fix the issue when Jerin's patchset is applied. Thus, I think
> it's still needed.

The info notes can be moved under the "---" marker line to make git log
clean.

This patch review is holding the virtio arm NEON support. Appreciate any help
in reviewing this patch.

http://dpdk.org/dev/patchwork/patch/14567/

> 
> Fixes: fc3d66212fed ("virtio: add vector Rx")
> 
> Cc: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
> ---
> v2: replace _mm_prefetch with rte_prefetch0 to make icc happy
> ---
>  drivers/net/virtio/virtio_rxtx_simple.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/virtio/virtio_rxtx_simple.c b/drivers/net/virtio/virtio_rxtx_simple.c
> index 6517aa8..d8dd17c 100644
> --- a/drivers/net/virtio/virtio_rxtx_simple.c
> +++ b/drivers/net/virtio/virtio_rxtx_simple.c
> @@ -200,7 +200,7 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
>  	sw_ring  = &vq->sw_ring[desc_idx];
>  	sw_ring_end = &vq->sw_ring[vq->vq_nentries];
>  
> -	_mm_prefetch((const void *)rused, _MM_HINT_T0);
> +	rte_prefetch0(rused);
>  
>  	if (vq->vq_free_cnt >= RTE_VIRTIO_VPMD_RX_REARM_THRESH) {
>  		virtio_rxq_rearm_vec(rxvq);
> -- 
> 1.9.0
> 

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

* Re: [dpdk-dev] [PATCH v2] net/virtio: fix build error with clang
  2016-09-23  6:35   ` Jerin Jacob
@ 2016-09-23  6:43     ` Yuanhan Liu
  0 siblings, 0 replies; 11+ messages in thread
From: Yuanhan Liu @ 2016-09-23  6:43 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: dev

On Fri, Sep 23, 2016 at 12:05:14PM +0530, Jerin Jacob wrote:
> On Fri, Sep 23, 2016 at 02:15:09PM +0800, Yuanhan Liu wrote:
> 
> Hi Yuanhan,
> 
> Thanks for this patch.
> 
> > Interestingly, clang and gcc has different prototype for _mm_prefetch().
> > For gcc, we have
> > 
> >    _mm_prefetch (const void *__P, enum _mm_hint __I)
> > 
> > While for clang, it's
> > 
> >    #define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), 0, (sel)))
> > 
> > That how the following error comes with clang:
> > 
> >    error: cast from 'const void *' to 'void *' drops const qualifier
> >    [-Werror,-Wcast-qual]
> >            _mm_prefetch((const void *)rused, _MM_HINT_T0);
> >    /usr/lib/llvm-3.8/bin/../lib/clang/3.8.0/include/xmmintrin.h:684:58:
> >    note: expanded from macro '_mm_prefetch'
> >             #define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a),
> >                                           0, (sel)))
> > 
> > What's weird is that the build was actaully Okay before. I met it while
> > apply Jerin's vector support for ARM patch set: he just move this peiece
> > of code to another file, nothing else changed.
> > 
> > This patch fix the issue when Jerin's patchset is applied. Thus, I think
> > it's still needed.
> 
> The info notes can be moved under the "---" marker line to make git log
> clean.

Yes, kind of. The reason I want to put it here is to stree "how weird
this issue it is" :)

Without this piece, people may be confused why this patch is necessary,
because they may simply can't reproduce this issue.

> This patch review is holding the virtio arm NEON support. Appreciate any help
> in reviewing this patch.
> 
> http://dpdk.org/dev/patchwork/patch/14567/

I meant to apply this series long time ago, until I found a build issue.
I tried to fix it once, as you saw. But it somehow broke the icc.

And here is my 2nd try (sorry for being a bit late though).

	--yliu

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

* Re: [dpdk-dev] [PATCH v2] net/virtio: fix build error with clang
  2016-09-23  6:15 ` [dpdk-dev] [PATCH v2] " Yuanhan Liu
  2016-09-23  6:35   ` Jerin Jacob
@ 2016-09-23  8:31   ` Thomas Monjalon
  2016-09-23  9:17     ` Yuanhan Liu
  2016-09-26  4:29   ` [dpdk-dev] [PATCH v3] net: " Yuanhan Liu
  2 siblings, 1 reply; 11+ messages in thread
From: Thomas Monjalon @ 2016-09-23  8:31 UTC (permalink / raw)
  To: Yuanhan Liu; +Cc: dev, Jerin Jacob

2016-09-23 14:15, Yuanhan Liu:
> -	_mm_prefetch((const void *)rused, _MM_HINT_T0);
> +	rte_prefetch0(rused);

There are other occurences of _mm_prefetch in other drivers.
It could deserve a patch.

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

* Re: [dpdk-dev] [PATCH v2] net/virtio: fix build error with clang
  2016-09-23  8:31   ` Thomas Monjalon
@ 2016-09-23  9:17     ` Yuanhan Liu
  0 siblings, 0 replies; 11+ messages in thread
From: Yuanhan Liu @ 2016-09-23  9:17 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, Jerin Jacob

On Fri, Sep 23, 2016 at 10:31:12AM +0200, Thomas Monjalon wrote:
> 2016-09-23 14:15, Yuanhan Liu:
> > -	_mm_prefetch((const void *)rused, _MM_HINT_T0);
> > +	rte_prefetch0(rused);
> 
> There are other occurences of _mm_prefetch in other drivers.
> It could deserve a patch.

Indeed. I could make a patch to replace them all if you think that's
appropriate.

	--yliu

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

* [dpdk-dev] [PATCH v3] net: fix build error with clang
  2016-09-23  6:15 ` [dpdk-dev] [PATCH v2] " Yuanhan Liu
  2016-09-23  6:35   ` Jerin Jacob
  2016-09-23  8:31   ` Thomas Monjalon
@ 2016-09-26  4:29   ` Yuanhan Liu
  2016-09-27 12:19     ` Yuanhan Liu
  2 siblings, 1 reply; 11+ messages in thread
From: Yuanhan Liu @ 2016-09-26  4:29 UTC (permalink / raw)
  To: dev
  Cc: Yuanhan Liu, Jerin Jacob, Chen Jing D(Mark),
	Cunming Liang, Bruce Richardson, Thomas Monjalon

Interestingly, clang and gcc has different prototype for _mm_prefetch().
For gcc, we have

   _mm_prefetch (const void *__P, enum _mm_hint __I)

While for clang, it's

   #define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), 0, (sel)))

That's how the following error comes with clang:

   error: cast from 'const void *' to 'void *' drops const qualifier
   [-Werror,-Wcast-qual]
           _mm_prefetch((const void *)rused, _MM_HINT_T0);
   /usr/lib/llvm-3.8/bin/../lib/clang/3.8.0/include/xmmintrin.h:684:58:
   note: expanded from macro '_mm_prefetch'
            #define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a),
                                          0, (sel)))

What's weird is that the build was actaully Okay before. I met it while
apply Jerin's vector support for ARM patch set: he just move this peiece
of code to another file, nothing else changed.

This patch fix the issue when Jerin's patchset is applied. Thus, I think
it's still needed.

Similarly, make the same change to other _mm_prefetch users, just in case
this weird issue shows up again somehow later.

Fixes: fc3d66212fed ("virtio: add vector Rx")
Fixes: c95584dc2b18 ("ixgbe: new vectorized functions for Rx/Tx")
Fixes: 9ed94e5bb04e ("i40e: add vector Rx")
Fixes: 7092be8437bd ("fm10k: add vector Rx")

Cc: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Cc: Chen Jing D(Mark) <jing.d.chen@intel.com>
Cc: Cunming Liang <cunming.liang@intel.com>
Cc: Bruce Richardson <bruce.richardson@intel.com>
CC: Thomas Monjalon <thomas.monjalon@6wind.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
v3: make the similar replace to other PMD
---
 drivers/net/fm10k/fm10k_rxtx_vec.c      | 2 +-
 drivers/net/i40e/i40e_rxtx_vec.c        | 2 +-
 drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c  | 2 +-
 drivers/net/virtio/virtio_rxtx_simple.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/fm10k/fm10k_rxtx_vec.c b/drivers/net/fm10k/fm10k_rxtx_vec.c
index 9ea747e..6b78c0f 100644
--- a/drivers/net/fm10k/fm10k_rxtx_vec.c
+++ b/drivers/net/fm10k/fm10k_rxtx_vec.c
@@ -406,7 +406,7 @@ fm10k_recv_raw_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 	 */
 	rxdp = rxq->hw_ring + next_dd;
 
-	_mm_prefetch((const void *)rxdp, _MM_HINT_T0);
+	rte_prefetch0(rxdp);
 
 	/* See if we need to rearm the RX queue - gives the prefetch a bit
 	 * of time to act
diff --git a/drivers/net/i40e/i40e_rxtx_vec.c b/drivers/net/i40e/i40e_rxtx_vec.c
index 51fb282..a9ca515 100644
--- a/drivers/net/i40e/i40e_rxtx_vec.c
+++ b/drivers/net/i40e/i40e_rxtx_vec.c
@@ -224,7 +224,7 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
 	 */
 	rxdp = rxq->rx_ring + rxq->rx_tail;
 
-	_mm_prefetch((const void *)rxdp, _MM_HINT_T0);
+	rte_prefetch0(rxdp);
 
 	/* See if we need to rearm the RX queue - gives the prefetch a bit
 	 * of time to act
diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
index 1c4fd7c..94dfbd6 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
@@ -243,7 +243,7 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts,
 	 */
 	rxdp = rxq->rx_ring + rxq->rx_tail;
 
-	_mm_prefetch((const void *)rxdp, _MM_HINT_T0);
+	rte_prefetch0(rxdp);
 
 	/* See if we need to rearm the RX queue - gives the prefetch a bit
 	 * of time to act
diff --git a/drivers/net/virtio/virtio_rxtx_simple.c b/drivers/net/virtio/virtio_rxtx_simple.c
index 6517aa8..d8dd17c 100644
--- a/drivers/net/virtio/virtio_rxtx_simple.c
+++ b/drivers/net/virtio/virtio_rxtx_simple.c
@@ -200,7 +200,7 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 	sw_ring  = &vq->sw_ring[desc_idx];
 	sw_ring_end = &vq->sw_ring[vq->vq_nentries];
 
-	_mm_prefetch((const void *)rused, _MM_HINT_T0);
+	rte_prefetch0(rused);
 
 	if (vq->vq_free_cnt >= RTE_VIRTIO_VPMD_RX_REARM_THRESH) {
 		virtio_rxq_rearm_vec(rxvq);
-- 
1.9.0

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

* Re: [dpdk-dev] [PATCH v3] net: fix build error with clang
  2016-09-26  4:29   ` [dpdk-dev] [PATCH v3] net: " Yuanhan Liu
@ 2016-09-27 12:19     ` Yuanhan Liu
  2016-09-27 17:24       ` Chen, Jing D
  0 siblings, 1 reply; 11+ messages in thread
From: Yuanhan Liu @ 2016-09-27 12:19 UTC (permalink / raw)
  To: dev
  Cc: Jerin Jacob, Chen Jing D(Mark),
	Cunming Liang, Bruce Richardson, Thomas Monjalon

Can any PMD guys review it? It blocks a virtio patchset apply...

Thanks.

	--yliu

On Mon, Sep 26, 2016 at 12:29:13PM +0800, Yuanhan Liu wrote:
> Interestingly, clang and gcc has different prototype for _mm_prefetch().
> For gcc, we have
> 
>    _mm_prefetch (const void *__P, enum _mm_hint __I)
> 
> While for clang, it's
> 
>    #define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), 0, (sel)))
> 
> That's how the following error comes with clang:
> 
>    error: cast from 'const void *' to 'void *' drops const qualifier
>    [-Werror,-Wcast-qual]
>            _mm_prefetch((const void *)rused, _MM_HINT_T0);
>    /usr/lib/llvm-3.8/bin/../lib/clang/3.8.0/include/xmmintrin.h:684:58:
>    note: expanded from macro '_mm_prefetch'
>             #define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a),
>                                           0, (sel)))
> 
> What's weird is that the build was actaully Okay before. I met it while
> apply Jerin's vector support for ARM patch set: he just move this peiece
> of code to another file, nothing else changed.
> 
> This patch fix the issue when Jerin's patchset is applied. Thus, I think
> it's still needed.
> 
> Similarly, make the same change to other _mm_prefetch users, just in case
> this weird issue shows up again somehow later.
> 
> Fixes: fc3d66212fed ("virtio: add vector Rx")
> Fixes: c95584dc2b18 ("ixgbe: new vectorized functions for Rx/Tx")
> Fixes: 9ed94e5bb04e ("i40e: add vector Rx")
> Fixes: 7092be8437bd ("fm10k: add vector Rx")
> 
> Cc: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> Cc: Chen Jing D(Mark) <jing.d.chen@intel.com>
> Cc: Cunming Liang <cunming.liang@intel.com>
> Cc: Bruce Richardson <bruce.richardson@intel.com>
> CC: Thomas Monjalon <thomas.monjalon@6wind.com>
> Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
> ---
> v3: make the similar replace to other PMD
> ---
>  drivers/net/fm10k/fm10k_rxtx_vec.c      | 2 +-
>  drivers/net/i40e/i40e_rxtx_vec.c        | 2 +-
>  drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c  | 2 +-
>  drivers/net/virtio/virtio_rxtx_simple.c | 2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/fm10k/fm10k_rxtx_vec.c b/drivers/net/fm10k/fm10k_rxtx_vec.c
> index 9ea747e..6b78c0f 100644
> --- a/drivers/net/fm10k/fm10k_rxtx_vec.c
> +++ b/drivers/net/fm10k/fm10k_rxtx_vec.c
> @@ -406,7 +406,7 @@ fm10k_recv_raw_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
>  	 */
>  	rxdp = rxq->hw_ring + next_dd;
>  
> -	_mm_prefetch((const void *)rxdp, _MM_HINT_T0);
> +	rte_prefetch0(rxdp);
>  
>  	/* See if we need to rearm the RX queue - gives the prefetch a bit
>  	 * of time to act
> diff --git a/drivers/net/i40e/i40e_rxtx_vec.c b/drivers/net/i40e/i40e_rxtx_vec.c
> index 51fb282..a9ca515 100644
> --- a/drivers/net/i40e/i40e_rxtx_vec.c
> +++ b/drivers/net/i40e/i40e_rxtx_vec.c
> @@ -224,7 +224,7 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
>  	 */
>  	rxdp = rxq->rx_ring + rxq->rx_tail;
>  
> -	_mm_prefetch((const void *)rxdp, _MM_HINT_T0);
> +	rte_prefetch0(rxdp);
>  
>  	/* See if we need to rearm the RX queue - gives the prefetch a bit
>  	 * of time to act
> diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
> index 1c4fd7c..94dfbd6 100644
> --- a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
> +++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
> @@ -243,7 +243,7 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts,
>  	 */
>  	rxdp = rxq->rx_ring + rxq->rx_tail;
>  
> -	_mm_prefetch((const void *)rxdp, _MM_HINT_T0);
> +	rte_prefetch0(rxdp);
>  
>  	/* See if we need to rearm the RX queue - gives the prefetch a bit
>  	 * of time to act
> diff --git a/drivers/net/virtio/virtio_rxtx_simple.c b/drivers/net/virtio/virtio_rxtx_simple.c
> index 6517aa8..d8dd17c 100644
> --- a/drivers/net/virtio/virtio_rxtx_simple.c
> +++ b/drivers/net/virtio/virtio_rxtx_simple.c
> @@ -200,7 +200,7 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
>  	sw_ring  = &vq->sw_ring[desc_idx];
>  	sw_ring_end = &vq->sw_ring[vq->vq_nentries];
>  
> -	_mm_prefetch((const void *)rused, _MM_HINT_T0);
> +	rte_prefetch0(rused);
>  
>  	if (vq->vq_free_cnt >= RTE_VIRTIO_VPMD_RX_REARM_THRESH) {
>  		virtio_rxq_rearm_vec(rxvq);
> -- 
> 1.9.0

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

* Re: [dpdk-dev] [PATCH v3] net: fix build error with clang
  2016-09-27 12:19     ` Yuanhan Liu
@ 2016-09-27 17:24       ` Chen, Jing D
  2016-09-28  0:09         ` Yuanhan Liu
  0 siblings, 1 reply; 11+ messages in thread
From: Chen, Jing D @ 2016-09-27 17:24 UTC (permalink / raw)
  To: Yuanhan Liu, dev
  Cc: Jerin Jacob, Liang, Cunming, Richardson, Bruce, Thomas Monjalon

Hi, 

> -----Original Message-----
> From: Yuanhan Liu [mailto:yuanhan.liu@linux.intel.com]
> Sent: Tuesday, September 27, 2016 5:20 AM
> To: dev@dpdk.org
> Cc: Jerin Jacob <jerin.jacob@caviumnetworks.com>; Chen, Jing D
> <jing.d.chen@intel.com>; Liang, Cunming <cunming.liang@intel.com>;
> Richardson, Bruce <bruce.richardson@intel.com>; Thomas Monjalon
> <thomas.monjalon@6wind.com>
> Subject: Re: [PATCH v3] net: fix build error with clang
> 
> Can any PMD guys review it? It blocks a virtio patchset apply...
> 
> Thanks.
> 
> 	--yliu
> 
> On Mon, Sep 26, 2016 at 12:29:13PM +0800, Yuanhan Liu wrote:
> > Interestingly, clang and gcc has different prototype for _mm_prefetch().
> > For gcc, we have
> >
> >    _mm_prefetch (const void *__P, enum _mm_hint __I)
> >
> > While for clang, it's
> >
> >    #define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), 0,
> > (sel)))
> >
> > That's how the following error comes with clang:
> >
> >    error: cast from 'const void *' to 'void *' drops const qualifier
> >    [-Werror,-Wcast-qual]
> >            _mm_prefetch((const void *)rused, _MM_HINT_T0);
> >    /usr/lib/llvm-3.8/bin/../lib/clang/3.8.0/include/xmmintrin.h:684:58:
> >    note: expanded from macro '_mm_prefetch'
> >             #define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a),
> >                                           0, (sel)))
> >
> > What's weird is that the build was actaully Okay before. I met it
> > while apply Jerin's vector support for ARM patch set: he just move
> > this peiece of code to another file, nothing else changed.
> >
> > This patch fix the issue when Jerin's patchset is applied. Thus, I
> > think it's still needed.
> >
> > Similarly, make the same change to other _mm_prefetch users, just in
> > case this weird issue shows up again somehow later.
> >
> > Fixes: fc3d66212fed ("virtio: add vector Rx")
> > Fixes: c95584dc2b18 ("ixgbe: new vectorized functions for Rx/Tx")
> > Fixes: 9ed94e5bb04e ("i40e: add vector Rx")
> > Fixes: 7092be8437bd ("fm10k: add vector Rx")
> >
> > Cc: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> > Cc: Chen Jing D(Mark) <jing.d.chen@intel.com>
> > Cc: Cunming Liang <cunming.liang@intel.com>
> > Cc: Bruce Richardson <bruce.richardson@intel.com>
> > CC: Thomas Monjalon <thomas.monjalon@6wind.com>
> > Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Jing Chen <jing.d.chen@intel.com>

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

* Re: [dpdk-dev] [PATCH v3] net: fix build error with clang
  2016-09-27 17:24       ` Chen, Jing D
@ 2016-09-28  0:09         ` Yuanhan Liu
  0 siblings, 0 replies; 11+ messages in thread
From: Yuanhan Liu @ 2016-09-28  0:09 UTC (permalink / raw)
  To: Chen, Jing D
  Cc: dev, Jerin Jacob, Liang, Cunming, Richardson, Bruce, Thomas Monjalon

On Tue, Sep 27, 2016 at 05:24:35PM +0000, Chen, Jing D wrote:
> > On Mon, Sep 26, 2016 at 12:29:13PM +0800, Yuanhan Liu wrote:
> > > Interestingly, clang and gcc has different prototype for _mm_prefetch().
> > > For gcc, we have
> > >
> > >    _mm_prefetch (const void *__P, enum _mm_hint __I)
> > >
> > > While for clang, it's
> > >
> > >    #define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), 0,
> > > (sel)))
> > >
> > > That's how the following error comes with clang:
> > >
> > >    error: cast from 'const void *' to 'void *' drops const qualifier
> > >    [-Werror,-Wcast-qual]
> > >            _mm_prefetch((const void *)rused, _MM_HINT_T0);
> > >    /usr/lib/llvm-3.8/bin/../lib/clang/3.8.0/include/xmmintrin.h:684:58:
> > >    note: expanded from macro '_mm_prefetch'
> > >             #define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a),
> > >                                           0, (sel)))
> > >
> > > What's weird is that the build was actaully Okay before. I met it
> > > while apply Jerin's vector support for ARM patch set: he just move
> > > this peiece of code to another file, nothing else changed.
> > >
> > > This patch fix the issue when Jerin's patchset is applied. Thus, I
> > > think it's still needed.
> > >
> > > Similarly, make the same change to other _mm_prefetch users, just in
> > > case this weird issue shows up again somehow later.
...
> > > Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
> Acked-by: Jing Chen <jing.d.chen@intel.com>

Mark, thank you!

Applied to dpdk-next-virtio.

	--yliu

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

end of thread, other threads:[~2016-09-28  0:08 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-23  7:40 [dpdk-dev] [PATCH] net/virtio: fix build error with clang Yuanhan Liu
2016-09-23  6:11 ` Yuanhan Liu
2016-09-23  6:15 ` [dpdk-dev] [PATCH v2] " Yuanhan Liu
2016-09-23  6:35   ` Jerin Jacob
2016-09-23  6:43     ` Yuanhan Liu
2016-09-23  8:31   ` Thomas Monjalon
2016-09-23  9:17     ` Yuanhan Liu
2016-09-26  4:29   ` [dpdk-dev] [PATCH v3] net: " Yuanhan Liu
2016-09-27 12:19     ` Yuanhan Liu
2016-09-27 17:24       ` Chen, Jing D
2016-09-28  0:09         ` Yuanhan Liu

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).