Re: [PATCH net-next v2 1/3] xsk: Remove non-zero 'dma_page' check in xp_assign_dev

2024-03-04 Thread Magnus Karlsson
On Thu, 29 Feb 2024 at 13:52, wangyunjian wrote: > > > -Original Message- > > From: Paolo Abeni [mailto:pab...@redhat.com] > > Sent: Thursday, February 29, 2024 6:43 PM > > To: wangyunjian ; m...@redhat.com; > > willemdebruijn.ker...@gmail.com; jasow...@redhat.com; k...@kernel.org; > >

Re: [PATCH v2 bpf-next 0/2] xsk: introduce generic almost-zerocopy xmit

2021-04-13 Thread Magnus Karlsson
On Tue, Apr 13, 2021 at 3:49 AM Xuan Zhuo wrote: > > On Mon, 12 Apr 2021 16:13:12 +0200, Magnus Karlsson > wrote: > > On Wed, Mar 31, 2021 at 2:27 PM Alexander Lobakin wrote: > > > > > > This series is based on the exceptional generic zerocopy xmit logics &

Re: [PATCH v2 bpf-next 0/2] xsk: introduce generic almost-zerocopy xmit

2021-04-12 Thread Magnus Karlsson
On Wed, Mar 31, 2021 at 2:27 PM Alexander Lobakin wrote: > > This series is based on the exceptional generic zerocopy xmit logics > initially introduced by Xuan Zhuo. It extends it the way that it > could cover all the sane drivers, not only the ones that are capable > of xmitting skbs with no

Re: [PATCH bpf-next 0/2] xsk: introduce generic almost-zerocopy xmit

2021-03-31 Thread Magnus Karlsson
On Wed, Mar 31, 2021 at 1:17 AM Alexander Lobakin wrote: > > This series is based on the exceptional generic zerocopy xmit logics > initially introduced by Xuan Zhuo. It extends it the way that it > could cover all the sane drivers, not only the ones that are capable > of xmitting skbs with no

Re: [PATCH] net: xdp: fix error return code of xsk_generic_xmit()

2021-03-05 Thread Magnus Karlsson
On Fri, Mar 5, 2021 at 10:28 AM Jia-Ju Bai wrote: > > When err is zero but xskq_prod_reserve() fails, no error return code of > xsk_generic_xmit() is assigned. > To fix this bug, err is assigned with the return value of > xskq_prod_reserve(), and then err is checked. This error is ignored by

Re: [PATCH v4 bpf-next 5/6] xsk: respect device's headroom and tailroom on generic xmit path

2021-02-16 Thread Magnus Karlsson
less than driver requests > for headroom. NET_SKB_PAD here is to double-insure there will be > no reallocations even when the driver advertises no needed_headroom, > but in fact need it (not so rare case). > > Fixes: 35fcde7f8deb ("xsk: support for Tx") > Signed-off-by: Alexander

Re: [PATCH v4 bpf-next 6/6] xsk: build skb by page (aka generic zerocopy xmit)

2021-02-16 Thread Magnus Karlsson
-by: Dust Li > [ alobakin: > - expand subject to make it clearer; > - improve skb->truesize calculation; > - reserve some headroom in skb for drivers; > - tailroom is not needed as skb is non-linear ] > Signed-off-by: Alexander Lobakin Thank you Alexander! Acked-by: Magnus Kar

Re: [PATCH bpf-next v3 3/3] xsk: build skb by page

2021-01-26 Thread Magnus Karlsson
On Mon, Jan 25, 2021 at 4:22 PM Xuan Zhuo wrote: > > On Mon, 25 Jan 2021 14:16:16 +0100, Magnus Karlsson > wrote: > > On Mon, Jan 25, 2021 at 1:43 PM Xuan Zhuo > > wrote: > > > > > > On Mon, 25 Jan 2021 08:44:38 +0100, Magnus Karlsson > > >

Re: [PATCH bpf-next v3 3/3] xsk: build skb by page

2021-01-25 Thread Magnus Karlsson
On Mon, Jan 25, 2021 at 1:43 PM Xuan Zhuo wrote: > > On Mon, 25 Jan 2021 08:44:38 +0100, Magnus Karlsson > wrote: > > On Mon, Jan 25, 2021 at 3:27 AM Xuan Zhuo > > wrote: > > > > > > On Fri, 22 Jan 2021 19:37:06 +0100, Magnus Karlsson > > >

Re: [PATCH bpf-next v3 3/3] xsk: build skb by page

2021-01-25 Thread Magnus Karlsson
On Mon, Jan 25, 2021 at 3:27 AM Xuan Zhuo wrote: > > On Fri, 22 Jan 2021 19:37:06 +0100, Magnus Karlsson > wrote: > > On Fri, Jan 22, 2021 at 6:26 PM Alexander Lobakin wrote: > > > > > > From: Xuan Zhuo > > > Date: Fri, 22 Jan 2021 23:39:15 +0800

Re: [PATCH bpf-next v3 3/3] xsk: build skb by page

2021-01-22 Thread Magnus Karlsson
On Fri, Jan 22, 2021 at 6:26 PM Alexander Lobakin wrote: > > From: Xuan Zhuo > Date: Fri, 22 Jan 2021 23:39:15 +0800 > > > On Fri, 22 Jan 2021 13:55:14 +0100, Magnus Karlsson > > wrote: > > > On Fri, Jan 22, 2021 at 1:39 PM Alexander Lobakin wrote: >

Re: [PATCH bpf-next v3 3/3] xsk: build skb by page

2021-01-22 Thread Magnus Karlsson
On Fri, Jan 22, 2021 at 1:39 PM Alexander Lobakin wrote: > > From: Magnus Karlsson > Date: Fri, 22 Jan 2021 13:18:47 +0100 > > > On Fri, Jan 22, 2021 at 12:57 PM Alexander Lobakin wrote: > > > > > > From: Alexander Lobakin > > > Date: Fri, 22 Jan

Re: [PATCH bpf-next v3 3/3] xsk: build skb by page

2021-01-22 Thread Magnus Karlsson
On Fri, Jan 22, 2021 at 12:57 PM Alexander Lobakin wrote: > > From: Alexander Lobakin > Date: Fri, 22 Jan 2021 11:47:45 + > > > From: Eric Dumazet > > Date: Thu, 21 Jan 2021 16:41:33 +0100 > > > > > On 1/21/21 2:47 PM, Xuan Zhuo wrote: > > > > This patch is used to construct skb based on

Re: [PATCH net-next v2 3/3] xsk: build skb by page

2021-01-20 Thread Magnus Karlsson
On Wed, Jan 20, 2021 at 9:29 PM Alexander Lobakin wrote: > > From: Xuan Zhuo > Date: Wed, 20 Jan 2021 16:30:56 +0800 > > > This patch is used to construct skb based on page to save memory copy > > overhead. > > > > This function is implemented based on IFF_TX_SKB_NO_LINEAR. Only the > > network

Re: [PATCH bpf-next] xsk: build skb by page

2021-01-18 Thread Magnus Karlsson
On Mon, Jan 18, 2021 at 5:38 PM Alexander Lobakin wrote: > > > From: Magnus Karlsson > > Date: Mon, 18 Jan 2021 16:10:40 +0100 > > > > On Mon, Jan 18, 2021 at 3:47 PM Alexander Lobakin wrote: > > > > > > From: Alexander Lobakin > > > Da

Re: [PATCH bpf-next] xsk: build skb by page

2021-01-18 Thread Magnus Karlsson
On Mon, Jan 18, 2021 at 3:47 PM Alexander Lobakin wrote: > > From: Alexander Lobakin > Date: Mon, 18 Jan 2021 13:00:17 + > > > From: Yunsheng Lin > > Date: Mon, 18 Jan 2021 20:40:52 +0800 > > > >> On 2021/1/16 10:44, Xuan Zhuo wrote: > >>> This patch is used to construct skb based on page

Re: [PATCH bpf-next] xsk: build skb by page

2021-01-18 Thread Magnus Karlsson
On Mon, Jan 18, 2021 at 3:47 PM Alexander Lobakin wrote: > > From: Alexander Lobakin > Date: Mon, 18 Jan 2021 13:00:17 + > > > From: Yunsheng Lin > > Date: Mon, 18 Jan 2021 20:40:52 +0800 > > > >> On 2021/1/16 10:44, Xuan Zhuo wrote: > >>> This patch is used to construct skb based on page

Re: [PATCH bpf-next] xsk: build skb by page

2020-12-23 Thread Magnus Karlsson
On Wed, Dec 23, 2020 at 9:57 AM Xuan Zhuo wrote: > > This patch is used to construct skb based on page to save memory copy > overhead. > > Taking into account the problem of addr unaligned, and the > possibility of frame size greater than page in the future. Thanks Xuan for the patch set. Could

Re: [PATCH bpf-next] xsk: save the undone skb

2020-12-14 Thread Magnus Karlsson
On Sat, Dec 12, 2020 at 9:47 AM Xuan Zhuo wrote: > > On Fri, 11 Dec 2020 16:32:06 +0100, Magnus Karlsson > wrote: > > On Fri, Dec 11, 2020 at 2:12 PM Xuan Zhuo > > wrote: > > > > > > We can reserve the skb. When sending fails, NETDEV_TX_BUSY or > &

Re: [PATCH bpf-next] xsk: save the undone skb

2020-12-11 Thread Magnus Karlsson
On Fri, Dec 11, 2020 at 2:12 PM Xuan Zhuo wrote: > > We can reserve the skb. When sending fails, NETDEV_TX_BUSY or > xskq_prod_reserve fails. As long as skb is successfully generated and > successfully configured, we can reserve skb if we encounter exceptions > later. > > Especially when

Re: [PATCH net v2] xsk: Return error code if force_zc is set

2020-12-04 Thread Magnus Karlsson
ng Changzhong > --- > net/xdp/xsk_buff_pool.c | 1 + > 1 file changed, 1 insertion(+) Thank you Changzhong! Acked-by: Magnus Karlsson > diff --git a/net/xdp/xsk_buff_pool.c b/net/xdp/xsk_buff_pool.c > index 9287edd..d5adeee 100644 > --- a/net/xdp/xsk_buff_pool.c > +++ b/net/

Re: [PATCH net] xsk: Fix error return code in __xp_assign_dev()

2020-12-04 Thread Magnus Karlsson
On Fri, Dec 4, 2020 at 9:49 AM Zhang Changzhong wrote: > > Fix to return a negative error code from the error handling > case instead of 0, as done elsewhere in this function. > > Fixes: 921b68692abb ("xsk: Enable sharing of dma mappings") > Reported-by: Hulk Robot > Signed-off-by: Zhang

Re: [PATCH bpf V3 2/2] xsk: change the tx writeable condition

2020-12-02 Thread Magnus Karlsson
a large number of EPOLLOUT events, and cause a large number of > process wake up. And the Fixes label here should be: Fixes: 35fcde7f8deb ("xsk: support for Tx") > Signed-off-by: Xuan Zhuo > Acked-by: Magnus Karlsson > --- > net/xdp/xsk.c | 16 +--- >

Re: [PATCH bpf V3 1/2] xsk: replace datagram_poll by sock_poll_wait

2020-12-02 Thread Magnus Karlsson
Thanks: Magnus > Signed-off-by: Xuan Zhuo > Acked-by: Magnus Karlsson > --- > net/xdp/xsk.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c > index b7b039b..9bbfd8a 100644 > --- a/net/xdp/xsk.c > +++ b/net/xdp/x

Re: [PATCH bpf v2 2/2] xsk: change the tx writeable condition

2020-11-27 Thread Magnus Karlsson
a large number of EPOLLOUT events, and cause a large number of > process wake up. > > Signed-off-by: Xuan Zhuo Thank you Xuan! Acked-by: Magnus Karlsson > --- > net/xdp/xsk.c | 16 +--- > net/xdp/xsk_queue.h | 6 ++ > 2 files changed, 19 insertions(+), 3 d

Re: [PATCH bpf v2 1/2] xsk: replace datagram_poll by sock_poll_wait

2020-11-27 Thread Magnus Karlsson
; datagram_poll, and the mask is calculated by xsk_poll. > > Signed-off-by: Xuan Zhuo > --- > net/xdp/xsk.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) Acked-by: Magnus Karlsson > diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c > index b014197..0df8651 100644 > --

Re: [PATCH 1/3] xsk: replace datagram_poll by sock_poll_wait

2020-11-24 Thread Magnus Karlsson
On Mon, Nov 23, 2020 at 3:11 PM Magnus Karlsson wrote: > > On Wed, Nov 18, 2020 at 9:26 AM Xuan Zhuo wrote: > > > > datagram_poll will judge the current socket status (EPOLLIN, EPOLLOUT) > > based on the traditional socket information (eg: sk_wmem_alloc), but > >

Re: [PATCH 0/3] xsk: fix for xsk_poll writeable

2020-11-24 Thread Magnus Karlsson
On Tue, Nov 24, 2020 at 10:01 AM Magnus Karlsson wrote: > > On Mon, Nov 23, 2020 at 4:21 PM Xuan Zhuo wrote: > > > > On Mon, 23 Nov 2020 15:00:48 +0100, Magnus Karlsson > > wrote: > > > On Wed, Nov 18, 2020 at 9:25 AM Xuan Zhuo > > > wrote: >

Re: [PATCH 2/3] xsk: change the tx writeable condition

2020-11-24 Thread Magnus Karlsson
On Wed, Nov 18, 2020 at 9:25 AM Xuan Zhuo wrote: > > Modify the tx writeable condition from the queue is not full to the > number of remaining tx queues is less than the half of the total number > of queues. Because the tx queue not full is a very short time, this will > cause a large number of

Re: [PATCH 0/3] xsk: fix for xsk_poll writeable

2020-11-24 Thread Magnus Karlsson
On Mon, Nov 23, 2020 at 4:21 PM Xuan Zhuo wrote: > > On Mon, 23 Nov 2020 15:00:48 +0100, Magnus Karlsson > wrote: > > On Wed, Nov 18, 2020 at 9:25 AM Xuan Zhuo > > wrote: > > > > > > I tried to combine cq available and tx writeable, but I found it very

Re: [PATCH 1/3] xsk: replace datagram_poll by sock_poll_wait

2020-11-23 Thread Magnus Karlsson
On Wed, Nov 18, 2020 at 9:26 AM Xuan Zhuo wrote: > > datagram_poll will judge the current socket status (EPOLLIN, EPOLLOUT) > based on the traditional socket information (eg: sk_wmem_alloc), but > this does not apply to xsk. So this patch uses sock_poll_wait instead of > datagram_poll, and the

Re: [PATCH 0/3] xsk: fix for xsk_poll writeable

2020-11-23 Thread Magnus Karlsson
On Wed, Nov 18, 2020 at 9:25 AM Xuan Zhuo wrote: > > I tried to combine cq available and tx writeable, but I found it very > difficult. > Sometimes we pay attention to the status of "available" for both, but > sometimes, > we may only pay attention to one, such as tx writeable, because we can

Re: memory leak in xdp_umem_create

2020-10-24 Thread Magnus Karlsson
On Fri, Oct 23, 2020 at 6:24 PM syzbot wrote: > > Hello, > > syzbot found the following issue on: > > HEAD commit:f804b315 Merge tag 'linux-watchdog-5.10-rc1' of git://www... > git tree: upstream > console output: https://syzkaller.appspot.com/x/log.txt?x=1797677f90 > kernel config:

Re: general protection fault in xsk_release

2020-09-25 Thread Magnus Karlsson
372c8190 > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=100bd2c390 > > The issue was bisected to: > > commit 1c1efc2af158869795d3334a12fed2afd9c51539 > Author: Magnus Karlsson > Date: Fri Aug 28 08:26:17 2020 + > > xsk: Create and free buffer pool i

Re: KASAN: use-after-free Write in xp_put_pool

2020-09-02 Thread Magnus Karlsson
22804e646a > > compiler: gcc (GCC) 10.1.0-syz 20200507 > > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=12e9f27990 > > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=125f3e1e90 > > > > The issue was bisected to: > > > >

Re: BUG: unable to handle kernel NULL pointer dereference in xsk_poll

2019-09-30 Thread Magnus Karlsson
On Mon, Sep 30, 2019 at 9:17 AM syzbot wrote: > > Hello, > > syzbot found the following crash on: Thank you Mr Syzcaller. I am on it. /Magnus > HEAD commit:a3c0e7b1 Merge tag 'libnvdimm-fixes-5.4-rc1' of git://git... > git tree: upstream > console output:

Re: [PATCH v2 bpf-next] mm: mmap: increase sockets maximum memory size pgoff for 32bits

2019-08-13 Thread Magnus Karlsson
On Mon, Aug 12, 2019 at 2:45 PM Ivan Khoronzhuk wrote: > > The AF_XDP sockets umem mapping interface uses XDP_UMEM_PGOFF_FILL_RING > and XDP_UMEM_PGOFF_COMPLETION_RING offsets. The offsets seems like are > established already and are part of configuration interface. > > But for 32-bit systems,

Re: [PATCH bpf v2] xdp: fix race on generic receive path

2019-07-03 Thread Magnus Karlsson
y a 5% drop. I think we can live with this in XDP_SKB mode. If we at some later point in time need to boost performance in this mode, let us look at it then from a broader perspective and find the most low hanging fruit. Thanks Ilya for this fix. Acked-by: Magnus Karlsson > Fixes: c497176cb2e4 (

Re: [PATCH bpf] xdp: fix race on generic receive path

2019-07-02 Thread Magnus Karlsson
On Tue, Jul 2, 2019 at 4:36 PM Ilya Maximets wrote: > > Unlike driver mode, generic xdp receive could be triggered > by different threads on different CPU cores at the same time > leading to the fill and rx queue breakage. For example, this > could happen while sending packets from two processes