net/virtio: fix build error with clang
PATCH 1/1 net/virtio: fix build error with clang
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.
--- drivers/net/virtio/virtio_rxtx_simple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/virtio/virtio_rxtx_simple.c +1 -1
@@ -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);
Signature · 1 line
1.9.0
Quoted 19 lines · Yuanhan Liu
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)))
Quoted 6 lines
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
Quoted 24 lines
Fixes fc3d66212fed ("virtio: add vector Rx")Cc Jerin Jacob <[email protected]>Signed-off-by Yuanhan Liu <[email protected]>--- drivers/net/virtio/virtio_rxtx_simple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/virtio/virtio_rxtx_simple.c +1
-1@@ -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);Signature · 1 line
1.9.0
PATCH v2 1/1 net/virtio: fix build error with clang
In reply to Yuanhan LiuInterestingly, 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.
---
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(-)
drivers/net/virtio/virtio_rxtx_simple.c +1 -1
@@ -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);
Signature · 1 line
1.9.0
On Fri, Sep 23, 2016 at 02:15:09PM +0800, Yuanhan Liu wrote:
Hi Yuanhan,
Thanks for this patch.
Quoted 19 lines
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)))
Quoted 6 lines
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/
Quoted 27 lines
Fixes fc3d66212fed ("virtio: add vector Rx")Cc Jerin Jacob <[email protected]>Signed-off-by Yuanhan Liu <[email protected]>---
v2: replace_mm_prefetchwithrte_prefetch0to make icc happy--- drivers/net/virtio/virtio_rxtx_simple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/virtio/virtio_rxtx_simple.c +1
-1@@ -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);Signature · 1 line
1.9.0
Quoted 29 lines · Jerin Jacob
On Fri, Sep 23, 2016 at 02:15:09PM +0800, Yuanhan Liu wrote:
Hi Yuanhan,
Thanks for this patch.
Quoted 23 lines
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.
Quoted 5 lines
Quoted 2 lines
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.
Quoted 4 lines
This patch review is holding the virtio arm NEON support. Appreciate any help in reviewing this patch.
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
2016-09-23 14:15, Yuanhan Liu:
drivers/net/virtio/virtio_rxtx_simple.c virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, · line 203
Quoted 2 lines
drivers/net/virtio/virtio_rxtx_simple.c +1
-1-_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.
Quoted 6 lines · Thomas Monjalon
2016-09-23 14:15, Yuanhan Liu:
drivers/net/virtio/virtio_rxtx_simple.c virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, · line 203
Quoted 2 lines
drivers/net/virtio/virtio_rxtx_simple.c +1
-1-_mm_prefetch ((const void *)rused, _MM_HINT_T0); +rte_prefetch0 (rused);There are other occurences of
_mm_prefetchin other drivers. It could deserve a patch.
Indeed. I could make a patch to replace them all if you think that's appropriate.
--yliu
PATCH v3 1/1 net: fix build error with clang
In reply to Yuanhan LiuInterestingly, 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.
---
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(-)
drivers/net/fm10k/fm10k_rxtx_vec.c +1 -1
@@ -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
drivers/net/i40e/i40e_rxtx_vec.c +1 -1
@@ -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
drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c +1 -1
@@ -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
drivers/net/virtio/virtio_rxtx_simple.c +1 -1
@@ -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);
Signature · 1 line
1.9.0
Re: [PATCH v3] net: fix build error with clang
Can any PMD guys review it? It blocks a virtio patchset apply...
Thanks.
--yliu
Quoted 103 lines · Yuanhan Liu
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_prefetchusers, 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 <[email protected]>Cc Chen Jing D(Mark) <[email protected]>Cc Cunming Liang <[email protected]>Cc Bruce Richardson <[email protected]>CC Thomas Monjalon <[email protected]>Signed-off-by Yuanhan Liu <[email protected]>---
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(-)drivers/net/fm10k/fm10k_rxtx_vec.c +1
-1@@ -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 drivers/net/i40e/i40e_rxtx_vec.c +1
-1@@ -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 drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c +1
-1@@ -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 drivers/net/virtio/virtio_rxtx_simple.c +1
-1@@ -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);Signature · 1 line
1.9.0
Chen, Jing D
Acked-byRe: [PATCH v3] net: fix build error with clang
Hi,
Quoted 10 lines
-----Original Message-----
From: Yuanhan Liu [mailto:[email protected]]
Sent: Tuesday, September 27, 2016 5:20 AM
To: [email protected]
Cc: Jerin Jacob <[email protected]>; Chen, Jing D <[email protected]>; Liang, Cunming <[email protected]>; Richardson, Bruce <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [PATCH v3] net: fix build error with clang
Quoted 48 lines
Can any PMD guys review it? It blocks a virtio patchset apply...
Thanks.
--yliuQuoted 41 lines · Yuanhan Liu
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_prefetchusers, 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 <[email protected]>Cc Chen Jing D(Mark) <[email protected]>Cc Cunming Liang <[email protected]>Cc Bruce Richardson <[email protected]>CC Thomas Monjalon <[email protected]>Signed-off-by Yuanhan Liu <[email protected]>
Yuanhan Liu
AppliedRe: [PATCH v3] net: fix build error with clang
Quoted 30 lines · Jing D
Quoted 30 lines · Yuanhan Liu
Quoted 29 lines
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_prefetchusers, just in case this weird issue shows up again somehow later.
...
Quoted 2 lines
Quoted 1 line
Quoted 1 line
Signed-off-by Yuanhan Liu <[email protected]>Acked-by Jing Chen <[email protected]>
Mark, thank you!
Applied to dpdk-next-virtio.
--yliu