[RFC v4 06/13] mm: page_frag: add '_va' suffix to page_frag API

2024-05-15 Thread Yunsheng Lin
* API accordingly. CC: Alexander Duyck Signed-off-by: Yunsheng Lin --- drivers/net/ethernet/google/gve/gve_rx.c | 4 ++-- drivers/net/ethernet/intel/ice/ice_txrx.c | 2 +- drivers/net/ethernet/intel/ice/ice_txrx.h | 2 +- drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 2

[RFC v4 07/13] mm: page_frag: avoid caller accessing 'page_frag_cache' directly

2024-05-15 Thread Yunsheng Lin
Use appropriate frag_page API instead of caller accessing 'page_frag_cache' directly. CC: Alexander Duyck Signed-off-by: Yunsheng Lin --- drivers/vhost/net.c | 2 +- include/linux/page_frag_cache.h | 10 ++ mm/page_frag_test.c | 2 +- net/core/skbuff.c

[PATCH net-next v3 07/13] mm: page_frag: avoid caller accessing 'page_frag_cache' directly

2024-05-08 Thread Yunsheng Lin
Use appropriate frag_page API instead of caller accessing 'page_frag_cache' directly. CC: Alexander Duyck Signed-off-by: Yunsheng Lin --- drivers/vhost/net.c | 2 +- include/linux/page_frag_cache.h | 10 ++ mm/page_frag_test.c | 2 +- net/core/skbuff.c

[PATCH net-next v3 06/13] mm: page_frag: add '_va' suffix to page_frag API

2024-05-08 Thread Yunsheng Lin
* API accordingly. CC: Alexander Duyck Signed-off-by: Yunsheng Lin --- drivers/net/ethernet/google/gve/gve_rx.c | 4 ++-- drivers/net/ethernet/intel/ice/ice_txrx.c | 2 +- drivers/net/ethernet/intel/ice/ice_txrx.h | 2 +- drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 2

Re: [PATCH net-next v2 07/15] mm: page_frag: add '_va' suffix to page_frag API

2024-04-17 Thread Yunsheng Lin
On 2024/4/17 0:12, Alexander H Duyck wrote: > On Mon, 2024-04-15 at 21:19 +0800, Yunsheng Lin wrote: >> Currently most of the API for page_frag API is returning >> 'virtual address' as output or expecting 'virtual address' >> as input, in order to differentiate the API handlin

[PATCH net-next v2 07/15] mm: page_frag: add '_va' suffix to page_frag API

2024-04-15 Thread Yunsheng Lin
of the page_pool. Signed-off-by: Yunsheng Lin --- drivers/net/ethernet/google/gve/gve_rx.c | 4 ++-- drivers/net/ethernet/intel/ice/ice_txrx.c | 2 +- drivers/net/ethernet/intel/ice/ice_txrx.h | 2 +- drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 2 +- .../net/ethernet/intel

[PATCH net-next v1 04/12] mm: page_frag: add '_va' suffix to page_frag API

2024-04-07 Thread Yunsheng Lin
of the page_pool. Signed-off-by: Yunsheng Lin --- drivers/net/ethernet/google/gve/gve_rx.c | 4 ++-- drivers/net/ethernet/intel/ice/ice_txrx.c | 2 +- drivers/net/ethernet/intel/ice/ice_txrx.h | 2 +- drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 2 +- .../net/ethernet/intel

[PATCH RFC 04/10] mm: page_frag: add '_va' suffix to page_frag API

2024-03-28 Thread Yunsheng Lin
of the page_pool. Signed-off-by: Yunsheng Lin --- drivers/net/ethernet/google/gve/gve_rx.c | 4 ++-- drivers/net/ethernet/intel/ice/ice_txrx.c | 2 +- drivers/net/ethernet/intel/ice/ice_txrx.h | 2 +- drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 2 +- .../net/ethernet/intel

[PATCH net-next v6 4/5] vhost/net: remove vhost_net_page_frag_refill()

2024-02-28 Thread Yunsheng Lin
frag using page_frag_alloc_align(). The added benefit is that not only unifying the page frag implementation a little, but also having about 0.5% performance boost testing by using the vhost_net_test introduced in the last patch. Signed-off-by: Yunsheng Lin Acked-by: Jason Wang --- drivers

[PATCH net-next v6 5/5] tools: virtio: introduce vhost_net_test

2024-02-28 Thread Yunsheng Lin
. Steps for vhost_net rx testing: 1. Prepare a in buf. 2. Do the sending in the tun side. 3. Kick the vhost_net to do rx processing. 4. verify the data received by vhost_net is correct. Signed-off-by: Yunsheng Lin --- tools/virtio/.gitignore| 1 + tools/virtio/Makefile

[PATCH net-next v6 2/5] page_frag: unify gfp bits for order 3 page allocation

2024-02-28 Thread Yunsheng Lin
implementation in sock.c for now as suggested by Paolo Abeni. Signed-off-by: Yunsheng Lin Reviewed-by: Alexander Duyck CC: Alexander Duyck --- drivers/vhost/net.c | 2 +- mm/page_alloc.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/vhost/net.c b/drivers/vhost

Re: [PATCH net-next v5 5/5] tools: virtio: introduce vhost_net_test

2024-02-05 Thread Yunsheng Lin
On 2024/2/6 11:08, Jason Wang wrote: ... >> + >> +static void wait_for_interrupt(struct vq_info *vq) >> +{ >> + unsigned long long val; >> + >> + poll(>fds, 1, -1); > > It's not good to wait indefinitely. How about a timeout value of 100ms as below? poll(>fds, 1, 100); > >> + >>

[PATCH net-next v5 5/5] tools: virtio: introduce vhost_net_test

2024-02-05 Thread Yunsheng Lin
. Steps for vhost_net rx testing: 1. Prepare a in buf. 2. Do the sending in the tun side. 3. Kick the vhost_net to do rx processing. 4. verify the data received by vhost_net is correct. Signed-off-by: Yunsheng Lin --- tools/virtio/.gitignore| 1 + tools/virtio/Makefile

[PATCH net-next v5 4/5] vhost/net: remove vhost_net_page_frag_refill()

2024-02-05 Thread Yunsheng Lin
frag using page_frag_alloc_align(). The added benefit is that not only unifying the page frag implementation a little, but also having about 0.5% performance boost testing by using the vhost_net_test introduced in the last patch. Signed-off-by: Yunsheng Lin Acked-by: Jason Wang --- drivers

[PATCH net-next v5 2/5] page_frag: unify gfp bits for order 3 page allocation

2024-02-05 Thread Yunsheng Lin
implementation in sock.c for now as suggested by Paolo Abeni. Signed-off-by: Yunsheng Lin Reviewed-by: Alexander Duyck CC: Alexander Duyck --- drivers/vhost/net.c | 2 +- mm/page_alloc.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/vhost/net.c b/drivers/vhost

Re: [PATCH net-next v4 5/5] tools: virtio: introduce vhost_net_test

2024-02-03 Thread Yunsheng Lin
On 2024/2/4 9:30, Jason Wang wrote: > On Fri, Feb 2, 2024 at 8:24 PM Yunsheng Lin wrote: >> >> On 2024/2/2 12:05, Jason Wang wrote: >>> On Tue, Jan 30, 2024 at 7:38 PM Yunsheng Lin wrote: >>>> >>>> introduce vhost_net_test basing on virtio_te

Re: [PATCH net-next v4 2/5] page_frag: unify gfp bits for order 3 page allocation

2024-02-02 Thread Yunsheng Lin
On 2024/2/2 16:36, Paolo Abeni wrote: > On Fri, 2024-02-02 at 10:10 +0800, Yunsheng Lin wrote: >> On 2024/2/1 21:16, Paolo Abeni wrote: >> >>> from the __page_frag_cache_refill() allocator - which never accesses >>> the memory reserves. >> >> I am n

Re: [PATCH net-next v4 5/5] tools: virtio: introduce vhost_net_test

2024-02-02 Thread Yunsheng Lin
On 2024/2/2 12:05, Jason Wang wrote: > On Tue, Jan 30, 2024 at 7:38 PM Yunsheng Lin wrote: >> >> introduce vhost_net_test basing on virtio_test to test >> vhost_net changing in the kernel. > > Let's describe what kind of test is being done and how it is done here. How

Re: [PATCH net-next v4 2/5] page_frag: unify gfp bits for order 3 page allocation

2024-02-01 Thread Yunsheng Lin
On 2024/2/1 21:16, Paolo Abeni wrote: > On Tue, 2024-01-30 at 19:37 +0800, Yunsheng Lin wrote: >> Currently there seems to be three page frag implementions >> which all try to allocate order 3 page, if that fails, it >> then fail back to allocate order 0 page, and each of them

[PATCH net-next v4 5/5] tools: virtio: introduce vhost_net_test

2024-01-30 Thread Yunsheng Lin
introduce vhost_net_test basing on virtio_test to test vhost_net changing in the kernel. Signed-off-by: Yunsheng Lin --- tools/virtio/.gitignore | 1 + tools/virtio/Makefile | 8 +- tools/virtio/vhost_net_test.c | 576 ++ 3 files changed, 582

[PATCH net-next v4 4/5] vhost/net: remove vhost_net_page_frag_refill()

2024-01-30 Thread Yunsheng Lin
frag using page_frag_alloc_align(). The added benefit is that not only unifying the page frag implementation a little, but also having about 0.5% performance boost testing by using the vhost_net_test introduced in the last patch. Signed-off-by: Yunsheng Lin Acked-by: Jason Wang --- drivers

[PATCH net-next v4 2/5] page_frag: unify gfp bits for order 3 page allocation

2024-01-30 Thread Yunsheng Lin
(), but it is not masked off in __page_frag_cache_refill(). This patch unifies the gfp bits used between different implementions by or'ing __GFP_NOMEMALLOC and masking off __GFP_DIRECT_RECLAIM for order 3 page allocation to avoid possible pressure for mm. Signed-off-by: Yunsheng Lin Reviewed-by: Alexander

[PATCH net-next v3 5/5] tools: virtio: introduce vhost_net_test

2024-01-23 Thread Yunsheng Lin
introduce vhost_net_test basing on virtio_test to test vhost_net changing in the kernel. Signed-off-by: Yunsheng Lin --- tools/virtio/.gitignore | 1 + tools/virtio/Makefile | 8 +- tools/virtio/vhost_net_test.c | 576 ++ 3 files changed, 582

[PATCH net-next v3 4/5] vhost/net: remove vhost_net_page_frag_refill()

2024-01-23 Thread Yunsheng Lin
frag using page_frag_alloc_align(). The added benefit is that not only unifying the page frag implementation a little, but also having about 0.5% performance boost testing by using the vhost_net_test introduced in the last patch. Signed-off-by: Yunsheng Lin Acked-by: Jason Wang --- drivers

[PATCH net-next v3 2/5] page_frag: unify gfp bits for order 3 page allocation

2024-01-23 Thread Yunsheng Lin
(), but it is not masked off in __page_frag_cache_refill(). This patch unifies the gfp bits used between different implementions by or'ing __GFP_NOMEMALLOC and masking off __GFP_DIRECT_RECLAIM for order 3 page allocation to avoid possible pressure for mm. Signed-off-by: Yunsheng Lin Reviewed-by: Alexander

Re: [PATCH net-next 4/6] vhost/net: remove vhost_net_page_frag_refill()

2024-01-08 Thread Yunsheng Lin
On 2024/1/6 0:06, Alexander H Duyck wrote: >> >> static void handle_tx_copy(struct vhost_net *net, struct socket *sock) >> @@ -1353,8 +1318,7 @@ static int vhost_net_open(struct inode *inode, struct >> file *f) >> vqs[VHOST_NET_VQ_RX]); >> >> f->private_data = n; >>

Re: [PATCH net-next 2/6] page_frag: unify gfp bits for order 3 page allocation

2024-01-08 Thread Yunsheng Lin
On 2024/1/5 23:35, Alexander H Duyck wrote: > On Wed, 2024-01-03 at 17:56 +0800, Yunsheng Lin wrote: >> Currently there seems to be three page frag implementions >> which all try to allocate order 3 page, if that fails, it >> then fail back to allocate order 0 page, and each

Re: [PATCH net-next 6/6] tools: virtio: introduce vhost_net_test

2024-01-04 Thread Yunsheng Lin
On 2024/1/5 0:17, Eugenio Perez Martin wrote: > On Wed, Jan 3, 2024 at 11:00 AM Yunsheng Lin wrote: ... >> + >> +static void run_tx_test(struct vdev_info *dev, struct vq_info *vq, >> + bool delayed, int batch, int bufs) >> +{ >> +

[PATCH net-next 6/6] tools: virtio: introduce vhost_net_test

2024-01-03 Thread Yunsheng Lin
introduce vhost_net_test basing on virtio_test to test vhost_net changing in the kernel. Signed-off-by: Yunsheng Lin --- tools/virtio/Makefile | 8 +- tools/virtio/vhost_net_test.c | 574 ++ 2 files changed, 579 insertions(+), 3 deletions(-) create

[PATCH net-next 5/6] net: introduce page_frag_cache_drain()

2024-01-03 Thread Yunsheng Lin
When draining a page_frag_cache, most user are doing the similar steps, so introduce an API to avoid code duplication. Signed-off-by: Yunsheng Lin Acked-by: Jason Wang --- drivers/net/ethernet/google/gve/gve_main.c | 11 ++- drivers/net/ethernet/mediatek/mtk_wed_wo.c | 17

[PATCH net-next 4/6] vhost/net: remove vhost_net_page_frag_refill()

2024-01-03 Thread Yunsheng Lin
frag using page_frag_alloc_align(). The added benefit is that not only unifying the page frag implementation a little, but also having about 0.5% performance boost testing by using the vhost_net_test introduced in the last patch. Signed-off-by: Yunsheng Lin Acked-by: Jason Wang --- drivers

[PATCH net-next 2/6] page_frag: unify gfp bits for order 3 page allocation

2024-01-03 Thread Yunsheng Lin
(), but it is not masked off in __page_frag_cache_refill(). This patch unifies the gfp bits used between different implementions by or'ing __GFP_NOMEMALLOC and masking off __GFP_DIRECT_RECLAIM for order 3 page allocation to avoid possible pressure for mm. Signed-off-by: Yunsheng Lin CC: Alexander Duyck

Re: [PATCH net-next 6/6] tools: virtio: introduce vhost_net_test

2023-12-20 Thread Yunsheng Lin
On 2023/12/21 10:33, Jason Wang wrote: > On Wed, Dec 20, 2023 at 8:45 PM Yunsheng Lin wrote: >> >> On 2023/12/12 12:35, Jason Wang wrote:>>>> +done: >>>>>> + backend.fd = tun_alloc(); >>>>>> + as

Re: [PATCH net-next 6/6] tools: virtio: introduce vhost_net_test

2023-12-20 Thread Yunsheng Lin
On 2023/12/12 12:35, Jason Wang wrote: +done: + backend.fd = tun_alloc(); + assert(backend.fd >= 0); + vdev_info_init(, features); + vq_info_add(, 256); + run_test(, [0], delayed, batch, reset, nbufs); >>> >>> I'd expect we are testing

Re: [PATCH net-next v2 3/3] net: add netmem_t to skb_frag_t

2023-12-18 Thread Yunsheng Lin
On 2023/12/17 16:09, Mina Almasry wrote: > Use netmem_t instead of page directly in skb_frag_t. Currently netmem_t > is always a struct page underneath, but the abstraction allows efforts > to add support for skb frags not backed by pages. > > There is unfortunately 1 instance where the

Re: [PATCH net-next 6/6] tools: virtio: introduce vhost_net_test

2023-12-07 Thread Yunsheng Lin
On 2023/12/7 14:00, Jason Wang wrote: > On Tue, Dec 5, 2023 at 7:35 PM Yunsheng Lin wrote: ... >> + >> +static int tun_alloc(void) >> +{ >> + struct ifreq ifr; >> + int fd, e; >> + >> + fd = open("/dev/net/tun", O_RD

Re: [PATCH net-next 2/6] page_frag: unify gfp bit for order 3 page allocation

2023-12-07 Thread Yunsheng Lin
On 2023/12/7 11:15, Jakub Kicinski wrote: > On Tue, 5 Dec 2023 19:34:40 +0800 Yunsheng Lin wrote: >> __GFP_DIRECT_RECLAIM is xor'd to avoid >> direct reclaim in skb_page_frag_refill(), but it is not >> xor'd in __page_frag_cache_refill(). > > xor is not the same thing

[PATCH net-next 6/6] tools: virtio: introduce vhost_net_test

2023-12-05 Thread Yunsheng Lin
introduce vhost_net_test basing on virtio_test to test vhost_net changing in the kernel. Signed-off-by: Yunsheng Lin --- tools/virtio/Makefile | 8 +- tools/virtio/vhost_net_test.c | 441 ++ 2 files changed, 446 insertions(+), 3 deletions(-) create

[PATCH net-next 5/6] net: introduce page_frag_cache_drain()

2023-12-05 Thread Yunsheng Lin
When draining a page_frag_cache, most user are doing the similar steps, so introduce an API to avoid code duplication. Signed-off-by: Yunsheng Lin --- drivers/net/ethernet/google/gve/gve_main.c | 11 ++- drivers/net/ethernet/mediatek/mtk_wed_wo.c | 17 ++--- drivers/nvme

[PATCH net-next 4/6] vhost/net: remove vhost_net_page_frag_refill()

2023-12-05 Thread Yunsheng Lin
frag using page_frag_alloc_align(). The added benefit is that not only unifying the page frag implementation a little, but also having about 0.5% performance boost testing by using the vhost_net_test introduced in the last patch. Signed-off-by: Yunsheng Lin --- drivers/vhost/net.c | 93

[PATCH net-next 2/6] page_frag: unify gfp bit for order 3 page allocation

2023-12-05 Thread Yunsheng Lin
(), but it is not xor'd in __page_frag_cache_refill(). This patch unifies the gfp bits used between different implementions by or'ing __GFP_NOMEMALLOC and xor'ing __GFP_DIRECT_RECLAIM for order 3 page allocation to avoid possible pressure for mm. Signed-off-by: Yunsheng Lin CC: Alexander Duyck --- drivers/vhost

[PATCH RFC 5/6] net: introduce page_frag_cache_drain()

2023-12-01 Thread Yunsheng Lin
When draining a page_frag_cache, most user are doing the similar steps, so introduce an API to avoid code duplication. Signed-off-by: Yunsheng Lin --- drivers/net/ethernet/google/gve/gve_main.c | 11 ++- drivers/net/ethernet/mediatek/mtk_wed_wo.c | 17 ++--- drivers/nvme

[PATCH RFC 6/6] tools: virtio: introduce vhost_net_test

2023-12-01 Thread Yunsheng Lin
introduce vhost_net_test basing on virtio_test to test vhost_net changing in the kernel. Signed-off-by: Yunsheng Lin --- tools/virtio/Makefile | 8 +- tools/virtio/vhost_net_test.c | 441 ++ 2 files changed, 446 insertions(+), 3 deletions(-) create

[PATCH RFC 4/6] vhost/net: remove vhost_net_page_frag_refill()

2023-12-01 Thread Yunsheng Lin
frag using page_frag_alloc_align(). The added benefit is that not only unifying the page frag implementation a little, but also having about 0.5% performance boost testing by using the vhost_net_test introduced in the last patch. Signed-off-by: Yunsheng Lin --- drivers/vhost/net.c | 93

[PATCH RFC 2/6] page_frag: unify gfp bit for order 3 page allocation

2023-12-01 Thread Yunsheng Lin
(), but it is not xor'd in __page_frag_cache_refill(). This patch unifies the gfp bits used between different implementions by or'ing __GFP_NOMEMALLOC and xor'ing __GFP_DIRECT_RECLAIM for order 3 page allocation to avoid possible pressure for mm. Signed-off-by: Yunsheng Lin CC: Alexander Duyck --- drivers/vhost

Re: [PATCH net v4 1/2] net: sched: fix packet stuck problem for lockless qdisc

2021-04-19 Thread Yunsheng Lin
On 2021/4/20 7:55, Michal Kubecek wrote: > On Mon, Apr 19, 2021 at 05:29:46PM +0200, Michal Kubecek wrote: >> >> As pointed out in the discussion on v3, this patch may result in >> significantly higher CPU consumption with multiple threads competing on >> a saturated outgoing device. I missed this

Re: [PATCH net v3] net: sched: fix packet stuck problem for lockless qdisc

2021-04-19 Thread Yunsheng Lin
On 2021/4/19 22:57, Michal Kubecek wrote: > On Mon, Apr 19, 2021 at 10:04:27AM +0800, Yunsheng Lin wrote: >>> >>> I tried this patch o top of 5.12-rc7 with real devices. I used two >>> machines with 10Gb/s Intel ixgbe NICs, sender has 16 CPUs (2 8-core CPUs >

Re: [Linuxarm] Re: [PATCH net v3] net: sched: fix packet stuck problem for lockless qdisc

2021-04-19 Thread Yunsheng Lin
On 2021/4/19 10:04, Yunsheng Lin wrote: > On 2021/4/19 6:59, Michal Kubecek wrote: >> On Thu, Mar 25, 2021 at 11:13:11AM +0800, Yunsheng Lin wrote: >>> Lockless qdisc has below concurrent problem: >>> cpu0 cpu1 >>> .

Re: [PATCH net v3] net: sched: fix packet stuck problem for lockless qdisc

2021-04-18 Thread Yunsheng Lin
On 2021/4/19 6:59, Michal Kubecek wrote: > On Thu, Mar 25, 2021 at 11:13:11AM +0800, Yunsheng Lin wrote: >> Lockless qdisc has below concurrent problem: >> cpu0 cpu1 >> .

Re: [PATCH net] net: fix use-after-free when UDP GRO with shared fraglist

2021-04-16 Thread Yunsheng Lin
On 2021/1/6 11:32, Dongseok Yi wrote: > On 2021-01-06 12:07, Willem de Bruijn wrote: >> >> On Tue, Jan 5, 2021 at 8:29 PM Dongseok Yi wrote: >>> >>> On 2021-01-05 06:03, Willem de Bruijn wrote: On Mon, Jan 4, 2021 at 4:00 AM Dongseok Yi wrote: > > skbs in frag_list could be

[PATCH net v4 1/2] net: sched: fix packet stuck problem for lockless qdisc

2021-04-15 Thread Yunsheng Lin
net: sched: allow qdiscs to handle locking") Signed-off-by: Yunsheng Lin Tested-by: Juergen Gross --- V4: Change STATE_NEED_RESCHEDULE to STATE_MISSED mirroring NAPI's NAPIF_STATE_MISSED, and add Juergen's "Tested-by" tag for there is only renaming and typo fixing between V4

[PATCH net v4 2/2] net: sched: fix endless tx action reschedule during deactivation

2021-04-15 Thread Yunsheng Lin
the race without calling qdisc_run() at all, so remove the STATE_DEACTIVATED checking in qdisc_run(). After qdisc_reset(), there is no skb in qdisc to be dequeued, so clear the STATE_MISSED in dev_reset_queue() too. Fixes: 6b3ba9146fe6 ("net: sched: allow qdiscs to handle locking") S

[PATCH net v4 0/2] fix packet stuck problem for lockless qdisc

2021-04-15 Thread Yunsheng Lin
]. https://lkml.org/lkml/2019/10/9/42 Yunsheng Lin (2): net: sched: fix packet stuck problem for lockless qdisc net: sched: fix endless tx action reschedule during deactivation include/net/pkt_sched.h | 7 +-- include/net/sch_generic.h | 37 - net/core

[PATCH net v4 0/2] fix packet stuck problem for lockless qdisc

2021-04-15 Thread Yunsheng Lin
]. https://lkml.org/lkml/2019/10/9/42 Yunsheng Lin (2): net: sched: fix packet stuck problem for lockless qdisc net: sched: fix endless tx action reschedule during deactivation include/net/pkt_sched.h | 7 +-- include/net/sch_generic.h | 37 - net/core

Re: [PATCH net v3] net: sched: fix packet stuck problem for lockless qdisc

2021-04-13 Thread Yunsheng Lin
On 2021/4/13 16:33, Hillf Danton wrote: > On Tue, 13 Apr 2021 15:57:29 Yunsheng Lin wrote: >> On 2021/4/13 15:12, Hillf Danton wrote: >>> On Tue, 13 Apr 2021 11:34:27 Yunsheng Lin wrote: >>>> On 2021/4/13 11:26, Hillf Danton wrote: >>>>> On

Re: [PATCH net v3] net: sched: fix packet stuck problem for lockless qdisc

2021-04-13 Thread Yunsheng Lin
On 2021/4/13 15:12, Hillf Danton wrote: > On Tue, 13 Apr 2021 11:34:27 Yunsheng Lin wrote: >> On 2021/4/13 11:26, Hillf Danton wrote: >>> On Tue, 13 Apr 2021 10:56:42 Yunsheng Lin wrote: >>>> On 2021/4/13 10:21, Hillf Danton wrote: >>>>> On

Re: [PATCH net v3] net: sched: fix packet stuck problem for lockless qdisc

2021-04-12 Thread Yunsheng Lin
On 2021/4/13 11:26, Hillf Danton wrote: > On Tue, 13 Apr 2021 10:56:42 Yunsheng Lin wrote: >> On 2021/4/13 10:21, Hillf Danton wrote: >>> On Mon, 12 Apr 2021 20:00:43 Yunsheng Lin wrote: >>>> >>>> Yes, the below patch seems to fix the data race descri

Re: [PATCH net v3] net: sched: fix packet stuck problem for lockless qdisc

2021-04-12 Thread Yunsheng Lin
On 2021/4/13 10:21, Hillf Danton wrote: > On Mon, 12 Apr 2021 20:00:43 Yunsheng Lin wrote: >> >> Yes, the below patch seems to fix the data race described in >> the commit log. >> Then what is the difference between my patch and your patch below:) > > Hehe, t

Re: [PATCH net v3] net: sched: fix packet stuck problem for lockless qdisc

2021-04-12 Thread Yunsheng Lin
On 2021/4/12 15:28, Hillf Danton wrote: > On Mon, 12 Apr 2021 11:37:24 Yunsheng Lin wrote: >> On 2021/4/12 11:21, Hillf Danton wrote: >>> On Mon, 12 Apr 2021 09:24:30 Yunsheng Lin wrote: >>>> On 2021/4/9 17:09, Hillf Danton wrote: >>>>> On

Re: [PATCH net v3] net: sched: fix packet stuck problem for lockless qdisc

2021-04-11 Thread Yunsheng Lin
On 2021/4/12 11:21, Hillf Danton wrote: > On Mon, 12 Apr 2021 09:24:30 Yunsheng Lin wrote: >> On 2021/4/9 17:09, Hillf Danton wrote: >>> On Fri, 9 Apr 2021 07:31:03 Juergen Gross wrote: >>>> On 25.03.21 04:13, Yunsheng Lin wrote: >>>> I have a setup

Re: [PATCH net v3] net: sched: fix packet stuck problem for lockless qdisc

2021-04-11 Thread Yunsheng Lin
On 2021/4/9 17:09, Hillf Danton wrote: > On Fri, 9 Apr 2021 07:31:03 Juergen Gross wrote: >> On 25.03.21 04:13, Yunsheng Lin wrote: >> I have a setup which is able to reproduce the issue quite reliably: >> >> In a Xen guest I'm mounting 8 NFS shares and run sysbenc

Re: [PATCH net v3] net: sched: fix packet stuck problem for lockless qdisc

2021-04-11 Thread Yunsheng Lin
On 2021/4/9 13:31, Juergen Gross wrote: > On 25.03.21 04:13, Yunsheng Lin wrote: >> Lockless qdisc has below concurrent problem: >> cpu0 cpu1 >> . . >> q->enqueue . >> .

Re: Packet gets stuck in NOLOCK pfifo_fast qdisc

2021-04-06 Thread Yunsheng Lin
On 2021/4/6 15:31, Michal Kubecek wrote: > On Tue, Apr 06, 2021 at 10:46:29AM +0800, Yunsheng Lin wrote: >> On 2021/4/6 9:49, Cong Wang wrote: >>> On Sat, Apr 3, 2021 at 5:23 AM Jiri Kosina wrote: >>>> >>>> I am still planning to have Yunsheng Lin's (CCi

Re: Packet gets stuck in NOLOCK pfifo_fast qdisc

2021-04-06 Thread Yunsheng Lin
On 2021/4/6 18:13, Juergen Gross wrote: > On 06.04.21 09:06, Michal Kubecek wrote: >> On Tue, Apr 06, 2021 at 08:55:41AM +0800, Yunsheng Lin wrote: >>> >>> Hi, Jiri >>> Do you have a reproducer that can be shared here? >>> With reproducer, I can debu

Re: Packet gets stuck in NOLOCK pfifo_fast qdisc

2021-04-05 Thread Yunsheng Lin
On 2021/4/6 9:49, Cong Wang wrote: > On Sat, Apr 3, 2021 at 5:23 AM Jiri Kosina wrote: >> >> I am still planning to have Yunsheng Lin's (CCing) fix [1] tested in the >> coming days. If it works, then we can consider proceeding with it, >> otherwise I am all for reverting the whole NOLOCK stuff.

Re: Packet gets stuck in NOLOCK pfifo_fast qdisc

2021-04-05 Thread Yunsheng Lin
On 2021/4/3 20:23, Jiri Kosina wrote: > On Sat, 3 Apr 2021, Hillf Danton wrote: > > Sure. Seems they crept in over time. I had some plans to write a > lockless HTB implementation. But with fq+EDT with BPF it seems that > it is no longer needed, we have a more generic/better solution.

[PATCH net v3] net: sched: fix packet stuck problem for lockless qdisc

2021-03-24 Thread Yunsheng Lin
qdiscs to handle locking") Signed-off-by: Yunsheng Lin --- V3: fix a compile error and a few comment typo, remove the __QDISC_STATE_DEACTIVATED checking, and update the performance data. V2: Avoid the overhead of fixing the data race as much as possible. --- include/

Re: [PATCH net v2] net: sched: fix packet stuck problem for lockless qdisc

2021-03-24 Thread Yunsheng Lin
On 2021/3/25 3:20, Cong Wang wrote: > On Tue, Mar 23, 2021 at 7:24 PM Yunsheng Lin wrote: >> @@ -176,8 +207,23 @@ static inline bool qdisc_run_begin(struct Qdisc *qdisc) >> static inline void qdisc_run_end(struct Qdisc *qdisc) >> { >> write_seqcount_end(>

Re: [Linuxarm] Re: [RFC v2] net: sched: implement TCQ_F_CAN_BYPASS for lockless qdisc

2021-03-23 Thread Yunsheng Lin
On 2021/3/24 9:49, Cong Wang wrote: > On Sun, Mar 21, 2021 at 5:55 PM Yunsheng Lin wrote: >> >> On 2021/3/20 2:15, Cong Wang wrote: >>> On Thu, Mar 18, 2021 at 12:33 AM Yunsheng Lin >>> wrote: >>>> >>>> On 2021/3/17 21:45, Jason A.

[PATCH net v2] net: sched: fix packet stuck problem for lockless qdisc

2021-03-23 Thread Yunsheng Lin
qdiscs to handle locking") Signed-off-by: Yunsheng Lin --- V2: Avoid the overhead of fixing the data race as much as possible. --- include/net/sch_generic.h | 48 ++- net/sched/sch_generic.c | 12 2 files changed, 59 insertions(+

Re: [RFC v3] net: sched: implement TCQ_F_CAN_BYPASS for lockless qdisc

2021-03-23 Thread Yunsheng Lin
On 2021/3/23 14:37, Ahmad Fatoum wrote: > Hi, > > On 22.03.21 10:09, Yunsheng Lin wrote: >> Currently pfifo_fast has both TCQ_F_CAN_BYPASS and TCQ_F_NOLOCK >> flag set, but queue discipline by-pass does not work for lockless >> qdisc because skb is always enqueued t

[RFC v3] net: sched: implement TCQ_F_CAN_BYPASS for lockless qdisc

2021-03-22 Thread Yunsheng Lin
igned-off-by: Yunsheng Lin --- Hi, Vladimir and Ahmad Please give it a test to see if there is any out of order packet for this patch, which has removed the priv->lock added in RFC v2. There is a data race as below: CPU1 CPU2 qdisc

Re: [Linuxarm] [PATCH net] net: sched: fix packet stuck problem for lockless qdisc

2021-03-21 Thread Yunsheng Lin
On 2021/3/20 3:45, Cong Wang wrote: > On Fri, Mar 19, 2021 at 2:25 AM Yunsheng Lin wrote: >> I had done some performance test to see if there is value to >> fix the packet stuck problem and support lockless qdisc bypass, >> here is some result using pktgen in 'queue_

Re: [PATCH net] net: sched: fix packet stuck problem for lockless qdisc

2021-03-21 Thread Yunsheng Lin
On 2021/3/20 3:40, Cong Wang wrote: > On Wed, Mar 17, 2021 at 11:52 PM Yunsheng Lin wrote: >> >> Lockless qdisc has below concurrent problem: >> cpu0 cpu1 >> .

Re: [Linuxarm] Re: [RFC v2] net: sched: implement TCQ_F_CAN_BYPASS for lockless qdisc

2021-03-21 Thread Yunsheng Lin
On 2021/3/20 3:03, Jason A. Donenfeld wrote: > On Thu, Mar 18, 2021 at 1:33 AM Yunsheng Lin wrote: >>> That offer definitely still stands. Generalization sounds like a lot of fun. >>> >>> Keep in mind though that it's an eventually consistent queue, not an >

Re: [Linuxarm] Re: [RFC v2] net: sched: implement TCQ_F_CAN_BYPASS for lockless qdisc

2021-03-21 Thread Yunsheng Lin
On 2021/3/20 2:15, Cong Wang wrote: > On Thu, Mar 18, 2021 at 12:33 AM Yunsheng Lin wrote: >> >> On 2021/3/17 21:45, Jason A. Donenfeld wrote: >>> On 3/17/21, Toke Høiland-Jørgensen wrote: >>>> Cong Wang writes: >>>> >>>>> On Mon,

Re: [Linuxarm] [PATCH net] net: sched: fix packet stuck problem for lockless qdisc

2021-03-19 Thread Yunsheng Lin
On 2021/3/18 14:53, Yunsheng Lin wrote: > Lockless qdisc has below concurrent problem: > cpu0 cpu1 > . . > q->enqueue . > . . &g

Re: [RFC v2] net: sched: implement TCQ_F_CAN_BYPASS for lockless qdisc

2021-03-18 Thread Yunsheng Lin
On 2021/3/18 15:10, Ahmad Fatoum wrote: > On 15.03.21 04:10, Yunsheng Lin wrote: >> Currently pfifo_fast has both TCQ_F_CAN_BYPASS and TCQ_F_NOLOCK >> flag set, but queue discipline by-pass does not work for lockless >> qdisc because skb is always enqueued to qdisc even when

Re: [Linuxarm] Re: [RFC v2] net: sched: implement TCQ_F_CAN_BYPASS for lockless qdisc

2021-03-18 Thread Yunsheng Lin
On 2021/3/17 21:45, Jason A. Donenfeld wrote: > On 3/17/21, Toke Høiland-Jørgensen wrote: >> Cong Wang writes: >> >>> On Mon, Mar 15, 2021 at 2:07 PM Jakub Kicinski wrote: I thought pfifo was supposed to be "lockless" and this change re-introduces a lock between producer and

[PATCH net] net: sched: fix packet stuck problem for lockless qdisc

2021-03-18 Thread Yunsheng Lin
nd_clear_bit() at the end of qdisc_run_end(). Fixes: 6b3ba9146fe6 ("net: sched: allow qdiscs to handle locking") Signed-off-by: Yunsheng Lin --- For those who has not been following the qdsic scheduling discussion, there is packet stuck problem for lockless qdisc, see [1], and I has done some

Re: [RFC v2] net: sched: implement TCQ_F_CAN_BYPASS for lockless qdisc

2021-03-16 Thread Yunsheng Lin
On 2021/3/17 6:48, Cong Wang wrote: > On Mon, Mar 15, 2021 at 2:07 PM Jakub Kicinski wrote: >> >> I thought pfifo was supposed to be "lockless" and this change >> re-introduces a lock between producer and consumer, no? > > It has never been truly lockless, it uses two spinlocks in the ring

Re: [PATCH net-next] net: sched: remove unnecessay lock protection for skb_bad_txq/gso_skb

2021-03-16 Thread Yunsheng Lin
On 2021/3/17 2:41, Cong Wang wrote: > On Mon, Mar 15, 2021 at 2:29 AM Yunsheng Lin wrote: >> >> Currently qdisc_lock(q) is taken before enqueuing and dequeuing >> for lockless qdisc's skb_bad_txq/gso_skb queue, qdisc->seqlock is >> also taken, which can provide the s

Re: [PATCH net-next] net: sched: remove unnecessay lock protection for skb_bad_txq/gso_skb

2021-03-16 Thread Yunsheng Lin
On 2021/3/17 2:43, Cong Wang wrote: > On Mon, Mar 15, 2021 at 4:42 PM David Miller wrote: >> >> From: Yunsheng Lin >> Date: Mon, 15 Mar 2021 17:30:10 +0800 >> >>> Currently qdisc_lock(q) is taken before enqueuing and dequeuing >>> for lockless qdis

Re: [PATCH net-next] net: sched: remove unnecessay lock protection for skb_bad_txq/gso_skb

2021-03-16 Thread Yunsheng Lin
On 2021/3/17 5:45, David Miller wrote: > From: Yunsheng Lin > Date: Tue, 16 Mar 2021 10:40:56 +0800 > >> On 2021/3/16 7:41, David Miller wrote: >>> From: Yunsheng Lin >> >> At least for the fast path, taking two locks for lockless qdisc hurts >&

Re: [RFC v2] net: sched: implement TCQ_F_CAN_BYPASS for lockless qdisc

2021-03-16 Thread Yunsheng Lin
On 2021/3/16 16:15, Eric Dumazet wrote: > On Tue, Mar 16, 2021 at 1:35 AM Yunsheng Lin wrote: >> >> On 2021/3/16 2:53, Jakub Kicinski wrote: >>> On Mon, 15 Mar 2021 11:10:18 +0800 Yunsheng Lin wrote: >>>> @@ -606,6 +623,11 @@ static const u8 prio2band[TC_PRIO

Re: [Linuxarm] Re: [RFC v2] net: sched: implement TCQ_F_CAN_BYPASS for lockless qdisc

2021-03-15 Thread Yunsheng Lin
On 2021/3/16 8:35, Yunsheng Lin wrote: > On 2021/3/16 2:53, Jakub Kicinski wrote: >> On Mon, 15 Mar 2021 11:10:18 +0800 Yunsheng Lin wrote: >>> @@ -606,6 +623,11 @@ static const u8 prio2band[TC_PRIO_MAX + 1] = { >>> */ >>> struct pfifo_fast_priv { >>

Re: [PATCH net-next] net: sched: remove unnecessay lock protection for skb_bad_txq/gso_skb

2021-03-15 Thread Yunsheng Lin
On 2021/3/16 7:41, David Miller wrote: > From: Yunsheng Lin > Date: Mon, 15 Mar 2021 17:30:10 +0800 > >> Currently qdisc_lock(q) is taken before enqueuing and dequeuing >> for lockless qdisc's skb_bad_txq/gso_skb queue, qdisc->seqlock is >> also taken, which c

Re: [RFC v2] net: sched: implement TCQ_F_CAN_BYPASS for lockless qdisc

2021-03-15 Thread Yunsheng Lin
On 2021/3/16 2:53, Jakub Kicinski wrote: > On Mon, 15 Mar 2021 11:10:18 +0800 Yunsheng Lin wrote: >> @@ -606,6 +623,11 @@ static const u8 prio2band[TC_PRIO_MAX + 1] = { >> */ >> struct pfifo_fast_priv { >> struct skb_array q[PFIFO_FAST_BANDS]; >> + >

[PATCH net-next] net: sched: remove unnecessay lock protection for skb_bad_txq/gso_skb

2021-03-15 Thread Yunsheng Lin
s qdisc is running. Signed-off-by: Yunsheng Lin --- include/net/sch_generic.h | 2 -- net/sched/sch_generic.c | 72 +-- 2 files changed, 19 insertions(+), 55 deletions(-) diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 2d6eb

[RFC v2] net: sched: implement TCQ_F_CAN_BYPASS for lockless qdisc

2021-03-14 Thread Yunsheng Lin
o, qdisc is scheduled at the end of qdisc_run_end() when q->empty is false to avoid packet stuck problem. The performance for ip_forward test increases about 10% with this patch. Signed-off-by: Yunsheng Lin --- RFC V2: fix requeued skb out of order and data race problem. --- include/net/pkt_sched.

Re: [PATCH RFC] net: sched: implement TCQ_F_CAN_BYPASS for lockless qdisc

2021-03-14 Thread Yunsheng Lin
On 2021/3/14 18:15, Marc Kleine-Budde wrote: > Cc += linux-...@vger.kernel.org > > On 3/14/21 1:03 AM, Vladimir Oltean wrote: >> On Sat, Mar 13, 2021 at 10:47:47AM +0800, Yunsheng Lin wrote: >>> Currently pfifo_fast has both TCQ_F_CAN_BYPASS and TCQ_F_NOLOCK >>&g

[PATCH RFC] net: sched: implement TCQ_F_CAN_BYPASS for lockless qdisc

2021-03-12 Thread Yunsheng Lin
false to avoid packet stuck problem. The performance for ip_forward test increases about 10% with this patch. Signed-off-by: Yunsheng Lin --- include/net/sch_generic.h | 7 +-- net/core/dev.c| 11 +++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/inclu

Re: [PATCH 4/4] net: hns3: double free 'skb'

2021-02-02 Thread Yunsheng Lin
On 2021/2/3 11:13, Wenjia Zhao wrote: > net: hns3: double free 'skb' > > The false branch of (tx_ret == NETDEV_TX_OK) free the skb. However, the > kfree_skb(skb) in the out label will be execute when exits the function. > So the skb has a double-free bugs. > > Remove the kfree_skb(skb) at line

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

2021-01-21 Thread Yunsheng Lin
On 2021/1/21 15:41, Magnus Karlsson wrote: > 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

Re: [PATCH] powerpc: fix the allyesconfig build

2020-11-29 Thread Yunsheng Lin
On 2020/11/29 3:36, Jakub Kicinski wrote: > On Sat, 28 Nov 2020 16:20:54 +1100 Stephen Rothwell wrote: >> On Fri, 27 Nov 2020 17:56:42 -0800 Jakub Kicinski wrote: >>> >>> What's the offending structure in hisilicon? I'd rather have a look >>> packing structs with pointers in 'em sounds

Re: [PATCH] powerpc: fix the allyesconfig build

2020-11-27 Thread Yunsheng Lin
On 2020/11/28 9:56, Jakub Kicinski wrote: > On Sat, 28 Nov 2020 12:28:19 +1100 Stephen Rothwell wrote: >> There are 2 drivers that have arrays of packed structures that contain >> pointers that end up at unaligned offsets. These produce warnings in >> the PowerPC allyesconfig build like this: >>

[PATCH net-next v3 2/2] net: Use lockdep_assert_in_softirq() in napi_consume_skb()

2020-11-24 Thread Yunsheng Lin
Use napi_consume_skb() to assert the case when it is not called in a atomic softirq context. Signed-off-by: Yunsheng Lin --- net/core/skbuff.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/core/skbuff.c b/net/core/skbuff.c index ffe3dcc..effa19d 100644 --- a/net/core/skbuff.c +++ b

[PATCH net-next v3 1/2] lockdep: Introduce in_softirq lockdep assert

2020-11-24 Thread Yunsheng Lin
be interrupted by hard IRQ or NMI context, lockdep_assert_in_softirq() need to assert about hard IRQ or NMI context too. Suggested-by: Jakub Kicinski Signed-off-by: Yunsheng Lin --- V3: add comment to emphasize the ambiguous semantics. --- include/linux/lockdep.h | 8 1 file changed, 8

[PATCH net-next v3 0/2] Add an assert in napi_consume_skb()

2020-11-24 Thread Yunsheng Lin
This patch introduces a lockdep_assert_in_softirq() interface and uses it to assert the case when napi_consume_skb() is not called in the softirq context. Changelog: V3: add comment to emphasize the ambiguous semantics V2: Use lockdep instead of one-off Kconfig knob Yunsheng Lin (2): lockdep

Re: [PATCH net-next v2 1/2] lockdep: Introduce in_softirq lockdep assert

2020-11-24 Thread Yunsheng Lin
On 2020/11/24 16:11, Peter Zijlstra wrote: > On Mon, Nov 23, 2020 at 12:12:59PM -0800, Jakub Kicinski wrote: >> One liner would be: >> >> * Acceptable for protecting per-CPU resources accessed from BH >> >> We can add: >> >> * Much like in_softirq() - semantics are ambiguous, use

  1   2   3   4   >