Message ID | 1474611309-20325-1-git-send-email-yuanhan.liu@linux.intel.com (mailing list archive) |
---|---|
State | Superseded, archived |
Delegated to: | Yuanhan Liu |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 006405939; Fri, 23 Sep 2016 08:14:43 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 5199058D4 for <dev@dpdk.org>; Fri, 23 Sep 2016 08:14:42 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 22 Sep 2016 23:14:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.30,380,1470726000"; d="scan'208"; a="1044535780" Received: from yliu-dev.sh.intel.com ([10.239.67.162]) by fmsmga001.fm.intel.com with ESMTP; 22 Sep 2016 23:14:41 -0700 From: Yuanhan Liu <yuanhan.liu@linux.intel.com> To: dev@dpdk.org Cc: Yuanhan Liu <yuanhan.liu@linux.intel.com>, Jerin Jacob <jerin.jacob@caviumnetworks.com> Date: Fri, 23 Sep 2016 14:15:09 +0800 Message-Id: <1474611309-20325-1-git-send-email-yuanhan.liu@linux.intel.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1471938058-12385-1-git-send-email-yuanhan.liu@linux.intel.com> References: <1471938058-12385-1-git-send-email-yuanhan.liu@linux.intel.com> Subject: [dpdk-dev] [PATCH v2] net/virtio: fix build error with clang X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK <dev.dpdk.org> List-Unsubscribe: <http://dpdk.org/ml/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://dpdk.org/ml/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <http://dpdk.org/ml/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Commit Message
Yuanhan Liu
Sept. 23, 2016, 6:15 a.m. UTC
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(-)
Comments
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 >
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
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.
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
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);