netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [Intel-wired-lan] [bug ?] i40e_rx_buffer_flip should not be called for redirected xsk copy mode
       [not found] <2863b548da1d4c369bbd9d6ceb337a24@baidu.com>
@ 2020-07-06  6:13 ` Magnus Karlsson
  2020-07-06  6:38   ` 答复: " Li,Rongqing
  2020-07-14 11:05   ` Li,Rongqing
  0 siblings, 2 replies; 5+ messages in thread
From: Magnus Karlsson @ 2020-07-06  6:13 UTC (permalink / raw)
  To: Li,Rongqing
  Cc: intel-wired-lan, Björn Töpel, Karlsson, Magnus, Netdev

Thank you RongQing for reporting this. I will take a look at it and
produce a patch.

/Magnus

On Thu, Jul 2, 2020 at 11:33 AM Li,Rongqing <lirongqing@baidu.com> wrote:
>
> Hi:
>
>
>
> i40e_rx_buffer_flip to xsk copy mode can lead to data corruption, like the following flow:
>
>
>
> 1. first skb is not for xsk, and forwarded to another device or socket queue
>
> 2. seconds skb is for xsk, copy data to xsk memory, and page of skb->data is released
>
> 3. rx_buff is reusable since only first skb is in it, but i40e_rx_buffer_flip will make that page_offset is set to first skb data
>
> 4. then reuse rx buffer, first skb which still is living will be corrupted.
>
>
>
> -Li RongQing
>
>
>
> _______________________________________________
> Intel-wired-lan mailing list
> Intel-wired-lan@osuosl.org
> https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

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

* 答复: [Intel-wired-lan] [bug ?] i40e_rx_buffer_flip should not be called for redirected xsk copy mode
  2020-07-06  6:13 ` [Intel-wired-lan] [bug ?] i40e_rx_buffer_flip should not be called for redirected xsk copy mode Magnus Karlsson
@ 2020-07-06  6:38   ` Li,Rongqing
  2020-07-14 11:05   ` Li,Rongqing
  1 sibling, 0 replies; 5+ messages in thread
From: Li,Rongqing @ 2020-07-06  6:38 UTC (permalink / raw)
  To: Magnus Karlsson
  Cc: intel-wired-lan, Björn Töpel, Karlsson, Magnus, Netdev



> -----邮件原件-----
> 发件人: Magnus Karlsson [mailto:magnus.karlsson@gmail.com]
> 发送时间: 2020年7月6日 14:13
> 收件人: Li,Rongqing <lirongqing@baidu.com>
> 抄送: intel-wired-lan <intel-wired-lan@lists.osuosl.org>; Björn Töpel
> <bjorn.topel@intel.com>; Karlsson, Magnus <magnus.karlsson@intel.com>;
> Netdev <netdev@vger.kernel.org>
> 主题: Re: [Intel-wired-lan] [bug ?] i40e_rx_buffer_flip should not be called for
> redirected xsk copy mode
> 
> Thank you RongQing for reporting this. I will take a look at it and produce a
> patch.
> 
> /Magnus

Thanks, and ixgbevf/ixgbe have same issue.

drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
drivers/net/ethernet/intel/i40e/i40e_txrx.c
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

I have a RFC, it maybe not better due to adding a new variable 
http://patchwork.ozlabs.org/project/netdev/patch/1593763926-24292-1-git-send-email-lirongqing@baidu.com/

or check memory type

diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index b3836092c327..f41664e0c84e 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -2394,7 +2394,9 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget)
 
                        if (xdp_res & (I40E_XDP_TX | I40E_XDP_REDIR)) {
                                xdp_xmit |= xdp_res;
-                               i40e_rx_buffer_flip(rx_ring, rx_buffer, size);
+
+                               if (xdp->rxq->mem.type != MEM_TYPE_XSK_BUFF_POOL)
+                                       i40e_rx_buffer_flip(rx_ring, rx_buffer, size);
                        } else {
                                rx_buffer->pagecnt_bias++;
                        }
Whether,  like to see your patch

-Li RongQing

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

* 答复: [Intel-wired-lan] [bug ?] i40e_rx_buffer_flip should not be called for redirected xsk copy mode
  2020-07-06  6:13 ` [Intel-wired-lan] [bug ?] i40e_rx_buffer_flip should not be called for redirected xsk copy mode Magnus Karlsson
  2020-07-06  6:38   ` 答复: " Li,Rongqing
@ 2020-07-14 11:05   ` Li,Rongqing
  2020-07-16  4:39     ` Magnus Karlsson
  1 sibling, 1 reply; 5+ messages in thread
From: Li,Rongqing @ 2020-07-14 11:05 UTC (permalink / raw)
  To: Magnus Karlsson
  Cc: intel-wired-lan, Björn Töpel, Karlsson, Magnus, Netdev



> -----邮件原件-----
> 发件人: Li,Rongqing
> 发送时间: 2020年7月6日 14:38
> 收件人: 'Magnus Karlsson' <magnus.karlsson@gmail.com>
> 抄送: intel-wired-lan <intel-wired-lan@lists.osuosl.org>; Björn Töpel
> <bjorn.topel@intel.com>; Karlsson, Magnus <magnus.karlsson@intel.com>;
> Netdev <netdev@vger.kernel.org>
> 主题: 答复: [Intel-wired-lan] [bug ?] i40e_rx_buffer_flip should not be called
> for redirected xsk copy mode
> 
> 
> 
> > -----邮件原件-----
> > 发件人: Magnus Karlsson [mailto:magnus.karlsson@gmail.com]
> > 发送时间: 2020年7月6日 14:13
> > 收件人: Li,Rongqing <lirongqing@baidu.com>
> > 抄送: intel-wired-lan <intel-wired-lan@lists.osuosl.org>; Björn Töpel
> > <bjorn.topel@intel.com>; Karlsson, Magnus <magnus.karlsson@intel.com>;
> > Netdev <netdev@vger.kernel.org>
> > 主题: Re: [Intel-wired-lan] [bug ?] i40e_rx_buffer_flip should not be
> > called for redirected xsk copy mode
> >
> > Thank you RongQing for reporting this. I will take a look at it and
> > produce a patch.
> >
> > /Magnus
> 

Ping


-Li

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

* Re: [Intel-wired-lan] [bug ?] i40e_rx_buffer_flip should not be called for redirected xsk copy mode
  2020-07-14 11:05   ` Li,Rongqing
@ 2020-07-16  4:39     ` Magnus Karlsson
  2020-07-16  5:33       ` 答复: " Li,Rongqing
  0 siblings, 1 reply; 5+ messages in thread
From: Magnus Karlsson @ 2020-07-16  4:39 UTC (permalink / raw)
  To: Li,Rongqing
  Cc: intel-wired-lan, Björn Töpel, Karlsson, Magnus, Netdev

On Tue, Jul 14, 2020 at 1:05 PM Li,Rongqing <lirongqing@baidu.com> wrote:
>
>
>
> > -----邮件原件-----
> > 发件人: Li,Rongqing
> > 发送时间: 2020年7月6日 14:38
> > 收件人: 'Magnus Karlsson' <magnus.karlsson@gmail.com>
> > 抄送: intel-wired-lan <intel-wired-lan@lists.osuosl.org>; Björn Töpel
> > <bjorn.topel@intel.com>; Karlsson, Magnus <magnus.karlsson@intel.com>;
> > Netdev <netdev@vger.kernel.org>
> > 主题: 答复: [Intel-wired-lan] [bug ?] i40e_rx_buffer_flip should not be called
> > for redirected xsk copy mode
> >
> >
> >
> > > -----邮件原件-----
> > > 发件人: Magnus Karlsson [mailto:magnus.karlsson@gmail.com]
> > > 发送时间: 2020年7月6日 14:13
> > > 收件人: Li,Rongqing <lirongqing@baidu.com>
> > > 抄送: intel-wired-lan <intel-wired-lan@lists.osuosl.org>; Björn Töpel
> > > <bjorn.topel@intel.com>; Karlsson, Magnus <magnus.karlsson@intel.com>;
> > > Netdev <netdev@vger.kernel.org>
> > > 主题: Re: [Intel-wired-lan] [bug ?] i40e_rx_buffer_flip should not be
> > > called for redirected xsk copy mode
> > >
> > > Thank you RongQing for reporting this. I will take a look at it and
> > > produce a patch.
> > >
> > > /Magnus
> >
>
> Ping

My apologies RongQing, but it is taking longer than expected due to
key people being on vacation during this summer period. We are
debating weather the simple fix you provided covers all cases.
Hopefully it does, but we just want to make sure. The fix is needed in
four drivers: the ones you mention plus ice.

/Magnus

>
> -Li

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

* 答复: [Intel-wired-lan] [bug ?] i40e_rx_buffer_flip should not be called for redirected xsk copy mode
  2020-07-16  4:39     ` Magnus Karlsson
@ 2020-07-16  5:33       ` Li,Rongqing
  0 siblings, 0 replies; 5+ messages in thread
From: Li,Rongqing @ 2020-07-16  5:33 UTC (permalink / raw)
  To: Magnus Karlsson
  Cc: intel-wired-lan, Björn Töpel, Karlsson, Magnus, Netdev

> > > >
> > > > Thank you RongQing for reporting this. I will take a look at it
> > > > and produce a patch.
> > > >
> > > > /Magnus
> > >
> >
> > Ping
> 
> My apologies RongQing, but it is taking longer than expected due to key people
> being on vacation during this summer period. We are debating weather the
> simple fix you provided covers all cases.
> Hopefully it does, but we just want to make sure. The fix is needed in four
> drivers: the ones you mention plus ice.
> 
> /Magnus

If my RFC patch is suitable for this bug, I will resend it.

should I send four patches for four drivers, or should I send one patch for them?


Thanks

-Li



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

end of thread, other threads:[~2020-07-16  5:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <2863b548da1d4c369bbd9d6ceb337a24@baidu.com>
2020-07-06  6:13 ` [Intel-wired-lan] [bug ?] i40e_rx_buffer_flip should not be called for redirected xsk copy mode Magnus Karlsson
2020-07-06  6:38   ` 答复: " Li,Rongqing
2020-07-14 11:05   ` Li,Rongqing
2020-07-16  4:39     ` Magnus Karlsson
2020-07-16  5:33       ` 答复: " Li,Rongqing

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