DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2 0/3] net: fix out of order Rx read issue
@ 2016-10-17 18:29 Qi Zhang
  2016-10-17 18:29 ` [dpdk-dev] [PATCH v2 1/3] net/i40e: " Qi Zhang
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Qi Zhang @ 2016-10-17 18:29 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Qi Zhang

In vPMD, when load Rx desc with _mm_loadu_si128, 
volatile point will be cast into non-volatile point.
So GCC is allowed to reorder the load instructions, 
while Rx read's correctness is reply on these load 
instructions to follow a backward sequence strictly, 
so we add compile barrier to prevent compiler reorder.
We already met this issue on i40e with GCC6 and we 
fixed this on ixgbe and fm10k also.

v2: 
- fix check-git-log.sh warning.
- add more detail commit message.

Qi Zhang (3):
  net/i40e: fix out of order Rx read issue
  net/ixgbe: fix out of order Rx read issue
  net/fm10k: fix out of ofder Rx read issue

 drivers/net/fm10k/fm10k_rxtx_vec.c     | 3 +++
 drivers/net/i40e/i40e_rxtx_vec.c       | 3 +++
 drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 3 +++
 3 files changed, 9 insertions(+)

-- 
2.7.4

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

* [dpdk-dev] [PATCH v2 1/3] net/i40e: fix out of order Rx read issue
  2016-10-17 18:29 [dpdk-dev] [PATCH v2 0/3] net: fix out of order Rx read issue Qi Zhang
@ 2016-10-17 18:29 ` Qi Zhang
  2016-10-17 18:29 ` [dpdk-dev] [PATCH v2 2/3] net/ixgbe: " Qi Zhang
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Qi Zhang @ 2016-10-17 18:29 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Qi Zhang

In vPMD, when load Rx desc with _mm_loadu_si128,
volatile point will be cast into non-volatile point.
So GCC is allowed to reorder the load instructions,
while Rx read's correctness is reply on these load
instructions to follow a backward sequence strictly,
so we add compile barrier to prevent compiler reorder.

Fixes: 9ed94e5bb04e ("i40e: add vector Rx")

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---

v2:
- fix check-git-log.sh warning.
- add more detail commit message.

 drivers/net/i40e/i40e_rxtx_vec.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/i40e/i40e_rxtx_vec.c b/drivers/net/i40e/i40e_rxtx_vec.c
index 0ee0241..ab63501 100644
--- a/drivers/net/i40e/i40e_rxtx_vec.c
+++ b/drivers/net/i40e/i40e_rxtx_vec.c
@@ -305,6 +305,7 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
 		/* Read desc statuses backwards to avoid race condition */
 		/* A.1 load 4 pkts desc */
 		descs[3] = _mm_loadu_si128((__m128i *)(rxdp + 3));
+		rte_compiler_barrier();
 
 		/* B.2 copy 2 mbuf point into rx_pkts  */
 		_mm_storeu_si128((__m128i *)&rx_pkts[pos], mbp1);
@@ -313,8 +314,10 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
 		mbp2 = _mm_loadu_si128((__m128i *)&sw_ring[pos+2]);
 
 		descs[2] = _mm_loadu_si128((__m128i *)(rxdp + 2));
+		rte_compiler_barrier();
 		/* B.1 load 2 mbuf point */
 		descs[1] = _mm_loadu_si128((__m128i *)(rxdp + 1));
+		rte_compiler_barrier();
 		descs[0] = _mm_loadu_si128((__m128i *)(rxdp));
 
 		/* B.2 copy 2 mbuf point into rx_pkts  */
-- 
2.7.4

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

* [dpdk-dev] [PATCH v2 2/3] net/ixgbe: fix out of order Rx read issue
  2016-10-17 18:29 [dpdk-dev] [PATCH v2 0/3] net: fix out of order Rx read issue Qi Zhang
  2016-10-17 18:29 ` [dpdk-dev] [PATCH v2 1/3] net/i40e: " Qi Zhang
@ 2016-10-17 18:29 ` Qi Zhang
  2016-10-17 18:29 ` [dpdk-dev] [PATCH v2 3/3] net/fm10k: fix out of ofder " Qi Zhang
  2016-10-18 11:33 ` [dpdk-dev] [PATCH v2 0/3] net: fix out of order " Ananyev, Konstantin
  3 siblings, 0 replies; 6+ messages in thread
From: Qi Zhang @ 2016-10-17 18:29 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Qi Zhang

In vPMD, when load Rx desc with _mm_loadu_si128,
volatile point will be cast into non-volatile point.
So GCC is allowed to reorder the load instructions,
while Rx read's correctness is reply on these load
instructions to follow a backward sequence strictly,
so we add compile barrier to prevent compiler reorder.

Fixes: c95584dc2b18 ("ixgbe: new vectorized functions for Rx/Tx")

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---

v2:
- fix check-git-log.sh warning.
- add more detail commit message.

 drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
index ad8a9ff..abbf284 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
@@ -343,6 +343,7 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts,
 		/* Read desc statuses backwards to avoid race condition */
 		/* A.1 load 4 pkts desc */
 		descs[3] = _mm_loadu_si128((__m128i *)(rxdp + 3));
+		rte_compiler_barrier();
 
 		/* B.2 copy 2 mbuf point into rx_pkts  */
 		_mm_storeu_si128((__m128i *)&rx_pkts[pos], mbp1);
@@ -351,8 +352,10 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts,
 		mbp2 = _mm_loadu_si128((__m128i *)&sw_ring[pos+2]);
 
 		descs[2] = _mm_loadu_si128((__m128i *)(rxdp + 2));
+		rte_compiler_barrier();
 		/* B.1 load 2 mbuf point */
 		descs[1] = _mm_loadu_si128((__m128i *)(rxdp + 1));
+		rte_compiler_barrier();
 		descs[0] = _mm_loadu_si128((__m128i *)(rxdp));
 
 		/* B.2 copy 2 mbuf point into rx_pkts  */
-- 
2.7.4

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

* [dpdk-dev] [PATCH v2 3/3] net/fm10k: fix out of ofder Rx read issue
  2016-10-17 18:29 [dpdk-dev] [PATCH v2 0/3] net: fix out of order Rx read issue Qi Zhang
  2016-10-17 18:29 ` [dpdk-dev] [PATCH v2 1/3] net/i40e: " Qi Zhang
  2016-10-17 18:29 ` [dpdk-dev] [PATCH v2 2/3] net/ixgbe: " Qi Zhang
@ 2016-10-17 18:29 ` Qi Zhang
  2016-10-18 11:33 ` [dpdk-dev] [PATCH v2 0/3] net: fix out of order " Ananyev, Konstantin
  3 siblings, 0 replies; 6+ messages in thread
From: Qi Zhang @ 2016-10-17 18:29 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Qi Zhang

In vPMD, when load Rx desc with _mm_loadu_si128,
volatile point will be cast into non-volatile point.
So GCC is allowed to reorder the load instructions,
while Rx read's correctness is reply on these load
instructions to follow a backward sequence strictly,
so we add compile barrier to prevent compiler reorder.

Fixes: 7092be8437bd ("fm10k: add vector Rx")

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---

v2:
- fix check-git-log.sh warning.
- add more detail commit message.

 drivers/net/fm10k/fm10k_rxtx_vec.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/fm10k/fm10k_rxtx_vec.c b/drivers/net/fm10k/fm10k_rxtx_vec.c
index b724486..27f3e43 100644
--- a/drivers/net/fm10k/fm10k_rxtx_vec.c
+++ b/drivers/net/fm10k/fm10k_rxtx_vec.c
@@ -478,6 +478,7 @@ fm10k_recv_raw_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 		/* Read desc statuses backwards to avoid race condition */
 		/* A.1 load 4 pkts desc */
 		descs0[3] = _mm_loadu_si128((__m128i *)(rxdp + 3));
+		rte_compiler_barrier();
 
 		/* B.2 copy 2 mbuf point into rx_pkts  */
 		_mm_storeu_si128((__m128i *)&rx_pkts[pos], mbp1);
@@ -486,8 +487,10 @@ fm10k_recv_raw_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 		mbp2 = _mm_loadu_si128((__m128i *)&mbufp[pos+2]);
 
 		descs0[2] = _mm_loadu_si128((__m128i *)(rxdp + 2));
+		rte_compiler_barrier();
 		/* B.1 load 2 mbuf point */
 		descs0[1] = _mm_loadu_si128((__m128i *)(rxdp + 1));
+		rte_compiler_barrier();
 		descs0[0] = _mm_loadu_si128((__m128i *)(rxdp));
 
 		/* B.2 copy 2 mbuf point into rx_pkts  */
-- 
2.7.4

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

* Re: [dpdk-dev] [PATCH v2 0/3] net: fix out of order Rx read issue
  2016-10-17 18:29 [dpdk-dev] [PATCH v2 0/3] net: fix out of order Rx read issue Qi Zhang
                   ` (2 preceding siblings ...)
  2016-10-17 18:29 ` [dpdk-dev] [PATCH v2 3/3] net/fm10k: fix out of ofder " Qi Zhang
@ 2016-10-18 11:33 ` Ananyev, Konstantin
  2016-10-19  9:52   ` Bruce Richardson
  3 siblings, 1 reply; 6+ messages in thread
From: Ananyev, Konstantin @ 2016-10-18 11:33 UTC (permalink / raw)
  To: Zhang, Qi Z, Wu, Jingjing, Zhang, Helin; +Cc: dev, Zhang, Qi Z



> 
> In vPMD, when load Rx desc with _mm_loadu_si128,
> volatile point will be cast into non-volatile point.
> So GCC is allowed to reorder the load instructions,
> while Rx read's correctness is reply on these load
> instructions to follow a backward sequence strictly,
> so we add compile barrier to prevent compiler reorder.
> We already met this issue on i40e with GCC6 and we
> fixed this on ixgbe and fm10k also.
> 
> v2:
> - fix check-git-log.sh warning.
> - add more detail commit message.
> 
> Qi Zhang (3):
>   net/i40e: fix out of order Rx read issue
>   net/ixgbe: fix out of order Rx read issue
>   net/fm10k: fix out of ofder Rx read issue
> 
>  drivers/net/fm10k/fm10k_rxtx_vec.c     | 3 +++
>  drivers/net/i40e/i40e_rxtx_vec.c       | 3 +++
>  drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 3 +++
>  3 files changed, 9 insertions(+)
> 
> --

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

> 2.7.4

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

* Re: [dpdk-dev] [PATCH v2 0/3] net: fix out of order Rx read issue
  2016-10-18 11:33 ` [dpdk-dev] [PATCH v2 0/3] net: fix out of order " Ananyev, Konstantin
@ 2016-10-19  9:52   ` Bruce Richardson
  0 siblings, 0 replies; 6+ messages in thread
From: Bruce Richardson @ 2016-10-19  9:52 UTC (permalink / raw)
  To: Ananyev, Konstantin; +Cc: Zhang, Qi Z, Wu, Jingjing, Zhang, Helin, dev

On Tue, Oct 18, 2016 at 11:33:43AM +0000, Ananyev, Konstantin wrote:
> 
> 
> > 
> > In vPMD, when load Rx desc with _mm_loadu_si128,
> > volatile point will be cast into non-volatile point.
> > So GCC is allowed to reorder the load instructions,
> > while Rx read's correctness is reply on these load
> > instructions to follow a backward sequence strictly,
> > so we add compile barrier to prevent compiler reorder.
> > We already met this issue on i40e with GCC6 and we
> > fixed this on ixgbe and fm10k also.
> > 
> > v2:
> > - fix check-git-log.sh warning.
> > - add more detail commit message.
> > 
> > Qi Zhang (3):
> >   net/i40e: fix out of order Rx read issue
> >   net/ixgbe: fix out of order Rx read issue
> >   net/fm10k: fix out of ofder Rx read issue
> > 
> >  drivers/net/fm10k/fm10k_rxtx_vec.c     | 3 +++
> >  drivers/net/i40e/i40e_rxtx_vec.c       | 3 +++
> >  drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 3 +++
> >  3 files changed, 9 insertions(+)
> > 
> > --
> 
> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> 
Applied to dpdk-next_net/rel_16_11

/Bruce

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

end of thread, other threads:[~2016-10-19  9:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-17 18:29 [dpdk-dev] [PATCH v2 0/3] net: fix out of order Rx read issue Qi Zhang
2016-10-17 18:29 ` [dpdk-dev] [PATCH v2 1/3] net/i40e: " Qi Zhang
2016-10-17 18:29 ` [dpdk-dev] [PATCH v2 2/3] net/ixgbe: " Qi Zhang
2016-10-17 18:29 ` [dpdk-dev] [PATCH v2 3/3] net/fm10k: fix out of ofder " Qi Zhang
2016-10-18 11:33 ` [dpdk-dev] [PATCH v2 0/3] net: fix out of order " Ananyev, Konstantin
2016-10-19  9:52   ` 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).