[PATCH V3 3/3] vhost_net: basic polling support

2016-02-26 Thread Jason Wang
This patch tries to poll for new added tx buffer or socket receive queue for a while at the end of tx/rx processing. The maximum time spent on polling were specified through a new kind of vring ioctl. Signed-off-by: Jason Wang <jasow...@redhat.com> --- drivers/vhost/net.c

[PATCH V3 1/3] vhost: introduce vhost_has_work()

2016-02-26 Thread Jason Wang
This path introduces a helper which can give a hint for whether or not there's a work queued in the work list. This could be used for busy polling code to exit the busy loop. Signed-off-by: Jason Wang <jasow...@redhat.com> --- drivers/vhost/vhost.c | 7 +++ drivers/vhost/vhost.h |

[PATCH V3 0/3] basic busy polling support for vhost_net

2016-02-26 Thread Jason Wang
and exit the loop when there's a pending signal - disable preemption during busy looping to make sure lock_clock() was correctly used. Jason Wang (3): vhost: introduce vhost_has_work() vhost: introduce vhost_vq_avail_empty() vhost_net: basic polling support drivers/vhost/net.c| 79

[PATCH V3 2/3] vhost: introduce vhost_vq_avail_empty()

2016-02-26 Thread Jason Wang
This patch introduces a helper which will return true if we're sure that the available ring is empty for a specific vq. When we're not sure, e.g vq access failure, return false instead. This could be used for busy polling code to exit the busy loop. Signed-off-by: Jason Wang <jasow...@redhat.

Re: [PATCH V3 3/3] vhost_net: basic polling support

2016-02-28 Thread Jason Wang
On 02/28/2016 10:09 PM, Michael S. Tsirkin wrote: > On Fri, Feb 26, 2016 at 04:42:44PM +0800, Jason Wang wrote: >> > This patch tries to poll for new added tx buffer or socket receive >> > queue for a while at the end of tx/rx processing. The maximum time >> > s

Re: [PATCH V3 3/3] vhost_net: basic polling support

2016-02-28 Thread Jason Wang
On 02/29/2016 05:56 AM, Christian Borntraeger wrote: > On 02/26/2016 09:42 AM, Jason Wang wrote: >> > This patch tries to poll for new added tx buffer or socket receive >> > queue for a while at the end of tx/rx processing. The maximum time >> > spent on polling wer

Re: [RFC PATCH net-next 0/3] Extend macvtap with multiple qdiscs

2016-02-22 Thread Jason Wang
On 02/08/2016 11:14 AM, Vladislav Yasevich wrote: > This is an RFC series to extend macvtap with multiple qdisc. Right now > multiqueue macvtap setups suffer from lock contention. Macvtap sets > the queue index and thus gets a default qdisc allocated to it. Since > it later users

Re: [PATCH V2 2/3] vhost: introduce vhost_vq_more_avail()

2016-01-21 Thread Jason Wang
On 01/20/2016 10:09 PM, Michael S. Tsirkin wrote: > On Tue, Dec 01, 2015 at 02:39:44PM +0800, Jason Wang wrote: >> Signed-off-by: Jason Wang <jasow...@redhat.com> > Wow new API with no comments anywhere, and no > commit log to say what it's good for. > Want to know

Re: [PATCH V2 3/3] vhost_net: basic polling support

2016-01-21 Thread Jason Wang
On 01/20/2016 10:35 PM, Michael S. Tsirkin wrote: > On Tue, Dec 01, 2015 at 02:39:45PM +0800, Jason Wang wrote: >> This patch tries to poll for new added tx buffer or socket receive >> queue for a while at the end of tx/rx processing. The maximum time >> spent on polling w

Re: [PATCH V2 0/3] basic busy polling support for vhost_net

2016-01-25 Thread Jason Wang
On 01/25/2016 03:58 PM, Michael Rapoport wrote: > (restored 'CC, sorry for dropping it originally, Notes is still hard > for me) > > > Jason Wang <jasow...@redhat.com> wrote on 01/25/2016 05:00:05 AM: > > On 01/24/2016 05:00 PM, Mike Rapoport wrote: > > &g

Re: [PATCH V4 0/3] basic busy polling support for vhost_net

2016-03-14 Thread Jason Wang
On 03/10/2016 02:48 PM, Michael Rapoport wrote: > Hi Greg, > >> > Greg Kurz <gk...@linux.vnet.ibm.com> wrote on 03/09/2016 09:26:45 PM: >>> > > On Fri, 4 Mar 2016 06:24:50 -0500 >>> > > Jason Wang <jasow...@redhat.com> wrote: >> &

[PATCH net-next 6/6] vhost_net: net device rx busy polling support

2016-03-30 Thread Jason Wang
%/ +5%/ +5%/ +5%/ -11% 256/ 200/ +4%/ +4%/ +4%/ +4%/ -13% 1024/ 1/0%/ -3%/0%/0%/ -6% 1024/50/ +1%/ +1%/ +1%/ +1%/ -10% 1024/ 100/ +4%/ +4%/ +5%/ +5%/ -11% 1024/ 200/ +4%/ +5%/ +4%/ +4%/ -12% Signed-off-by: Jason Wang <ja

[PATCH net-next 1/6] net: skbuff: don't use union for napi_id and sender_cpu

2016-03-30 Thread Jason Wang
was enabled. Fixing by not using union for napi_id and sender_cpu. Signed-off-by: Jason Wang <jasow...@redhat.com> --- include/linux/skbuff.h | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 15d0df9..8aee891

[PATCH net-next 2/6] tuntap: socket rx busy polling support

2016-03-30 Thread Jason Wang
Signed-off-by: Jason Wang <jasow...@redhat.com> --- drivers/net/tun.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/tun.c b/drivers/net/tun.c index afdf950..950faf5 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -69,6 +69,7 @@ #include #i

[PATCH net-next 4/6] net: core: factor out core busy polling logic to sk_busy_loop_once()

2016-03-30 Thread Jason Wang
This patch factors out core logic of busy polling to sk_busy_loop_once() in order to be reused by other modules. Signed-off-by: Jason Wang <jasow...@redhat.com> --- include/net/busy_poll.h | 7 ++ net/core/dev.c | 59 - 2

[PATCH net-next 5/6] net: export napi_by_id()

2016-03-30 Thread Jason Wang
This patch exports napi_by_id() which will be used by vhost_net socket busy polling. Signed-off-by: Jason Wang <jasow...@redhat.com> --- include/net/busy_poll.h | 1 + net/core/dev.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/net/busy_poll.h b/i

[PATCH net-next 3/6] macvtap: socket rx busy polling support

2016-03-30 Thread Jason Wang
Signed-off-by: Jason Wang <jasow...@redhat.com> --- drivers/net/macvtap.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index 95394ed..1891aff 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c @@ -20,6 +20,7 @@ #i

[PATCH net-next 0/6] net device rx busy polling support in vhost_net

2016-03-30 Thread Jason Wang
%/ -6% 1024/50/ +1%/ +1%/ +1%/ +1%/ -10% 1024/ 100/ +4%/ +4%/ +5%/ +5%/ -11% 1024/ 200/ +4%/ +5%/ +4%/ +4%/ -12% Thanks Jason Wang (6): net: skbuff: don't use union for napi_id and sender_cpu tuntap: socket rx busy polling support macvtap: socket rx

Re: [PATCH net-next 1/6] net: skbuff: don't use union for napi_id and sender_cpu

2016-04-06 Thread Jason Wang
On 04/01/2016 09:04 PM, Eric Dumazet wrote: > On Fri, 2016-04-01 at 12:49 +0800, Jason Wang wrote: >> On 04/01/2016 10:55 AM, Eric Dumazet wrote: >>> On Fri, 2016-04-01 at 10:13 +0800, Jason Wang wrote: >>> >>> >>>> The problem is we want to suppo

[PATCH net] tuntap: restore default qdisc

2016-04-07 Thread Jason Wang
ix IFF_NO_QUEUE for drivers using alloc_netdev") Cc: Phil Sutter <p...@nwl.cc> Signed-off-by: Jason Wang <jasow...@redhat.com> --- drivers/net/tun.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 510e90a..2c9e45f

[RFC PATCH V2 0/2] basic device IOTLB support

2016-03-24 Thread Jason Wang
. Thanks Jason Wang (2): vhost: convert pre sorted vhost memory array to interval tree vhost: device IOTLB API drivers/vhost/net.c| 14 +- drivers/vhost/vhost.c | 427 +++-- drivers/vhost/vhost.h | 42 - fs/eventfd.c

[RFC PATCH V2 2/2] vhost: device IOTLB API

2016-03-24 Thread Jason Wang
userspace finishes the translation, it will update the vhost IOTLB through VHOST_UPDATE_IOTLB ioctl. Userspace is also in charge of snooping the IOTLB invalidation of IOMMU IOTLB and use VHOST_UPDATE_IOTLB to invalidate the possible entry in vhost. Signed-off-by: Jason Wang <jasow...@redhat.

[RFC PATCH V2 1/2] vhost: convert pre sorted vhost memory array to interval tree

2016-03-24 Thread Jason Wang
the userspace to send diffs of memory table. - Simplify Device IOTLB implementation. Signed-off-by: Jason Wang <jasow...@redhat.com> --- drivers/vhost/net.c | 8 +-- drivers/vhost/vhost.c | 182 -- drivers/vhost/vhost.h | 27 ++-- 3

[PATCH V4 1/3] vhost: introduce vhost_has_work()

2016-03-04 Thread Jason Wang
This path introduces a helper which can give a hint for whether or not there's a work queued in the work list. This could be used for busy polling code to exit the busy loop. Signed-off-by: Jason Wang <jasow...@redhat.com> --- drivers/vhost/vhost.c | 7 +++ drivers/vhost/vhost.h |

[PATCH V4 0/3] basic busy polling support for vhost_net

2016-03-04 Thread Jason Wang
for busyloop_timeout - split out the busy polling logic into a new helper - check and exit the loop when there's a pending signal - disable preemption during busy looping to make sure lock_clock() was correctly used. Jason Wang (3): vhost: introduce vhost_has_work() vhost: introduce

[PATCH V4 2/3] vhost: introduce vhost_vq_avail_empty()

2016-03-04 Thread Jason Wang
This patch introduces a helper which will return true if we're sure that the available ring is empty for a specific vq. When we're not sure, e.g vq access failure, return false instead. This could be used for busy polling code to exit the busy loop. Signed-off-by: Jason Wang <jasow...@redhat.

[PATCH V4 3/3] vhost_net: basic polling support

2016-03-04 Thread Jason Wang
This patch tries to poll for new added tx buffer or socket receive queue for a while at the end of tx/rx processing. The maximum time spent on polling were specified through a new kind of vring ioctl. Signed-off-by: Jason Wang <jasow...@redhat.com> --- drivers/vhost/net.c

Re: [PATCH net-next 1/6] net: skbuff: don't use union for napi_id and sender_cpu

2016-03-31 Thread Jason Wang
On 03/31/2016 06:32 PM, Eric Dumazet wrote: > On Thu, 2016-03-31 at 13:50 +0800, Jason Wang wrote: >> We use a union for napi_id and send_cpu, this is ok for most of the >> cases except when we want to support busy polling for tun which needs >> napi_id to be stored and pa

Re: [PATCH net-next 1/6] net: skbuff: don't use union for napi_id and sender_cpu

2016-03-31 Thread Jason Wang
On 04/01/2016 04:01 AM, David Miller wrote: > From: Eric Dumazet <eric.duma...@gmail.com> > Date: Thu, 31 Mar 2016 03:32:21 -0700 > >> On Thu, 2016-03-31 at 13:50 +0800, Jason Wang wrote: >>> We use a union for napi_id and send_cpu, this is ok for most of the

Re: [PATCH net-next 1/6] net: skbuff: don't use union for napi_id and sender_cpu

2016-03-31 Thread Jason Wang
On 04/01/2016 10:55 AM, Eric Dumazet wrote: > On Fri, 2016-04-01 at 10:13 +0800, Jason Wang wrote: > > >> The problem is we want to support busy polling for tun. This needs >> napi_id to be passed to tun socket by sk_mark_napi_id() during >> tun_net_xmit(). But before

Re: [PATCH RFC 2/2] tun: don't set a default qdisc

2016-04-14 Thread Jason Wang
On 04/13/2016 06:26 PM, Michael S. Tsirkin wrote: > On Wed, Apr 13, 2016 at 11:04:47AM +0200, Paolo Abeni wrote: >> This patch disables the default qdisc by explicitly setting the >> IFF_NO_QUEUE private flag so that now the tun xmit path do not >> require any lock by default. >> >> The default

Re: [PATCH RFC 1/2] tun: don't require serialization lock on tx

2016-04-14 Thread Jason Wang
->vlan_features = dev->features & > ~(NETIF_F_HW_VLAN_CTAG_TX | > NETIF_F_HW_VLAN_STAG_TX); Acked-by: Jason Wang <jasow...@redhat.com>

Re: [PATCH] vhost_net: stop polling socket during rx processing

2016-04-28 Thread Jason Wang
On 04/27/2016 07:28 PM, Michael S. Tsirkin wrote: > On Tue, Apr 26, 2016 at 03:35:53AM -0400, Jason Wang wrote: >> We don't stop polling socket during rx processing, this will lead >> unnecessary wakeups from under layer net devices (E.g >> sock_def_readable() form tun). R

Re: [RFC PATCH V2 1/2] vhost: convert pre sorted vhost memory array to interval tree

2016-04-28 Thread Jason Wang
On 04/27/2016 07:30 PM, Michael S. Tsirkin wrote: > On Fri, Mar 25, 2016 at 10:34:33AM +0800, Jason Wang wrote: >> > Current pre-sorted memory region array has some limitations for future >> > device IOTLB conversion: >> > >> > 1) need extra work

Re: [RFC PATCH V2 2/2] vhost: device IOTLB API

2016-04-28 Thread Jason Wang
On 04/27/2016 07:45 PM, Michael S. Tsirkin wrote: > On Fri, Mar 25, 2016 at 10:34:34AM +0800, Jason Wang wrote: >> This patch tries to implement an device IOTLB for vhost. This could be >> used with for co-operation with userspace(qemu) implementation of DMA >> rema

Re: [RFC PATCH V2 2/2] vhost: device IOTLB API

2016-04-28 Thread Jason Wang
On 04/28/2016 10:43 PM, Michael S. Tsirkin wrote: > On Thu, Apr 28, 2016 at 02:37:16PM +0800, Jason Wang wrote: >> >> On 04/27/2016 07:45 PM, Michael S. Tsirkin wrote: >>> On Fri, Mar 25, 2016 at 10:34:34AM +0800, Jason Wang wrote: >>>> This patch tries to

Re: [RFC PATCH V2 2/2] vhost: device IOTLB API

2016-04-28 Thread Jason Wang
On 04/29/2016 09:12 AM, Jason Wang wrote: > On 04/28/2016 10:43 PM, Michael S. Tsirkin wrote: >> > On Thu, Apr 28, 2016 at 02:37:16PM +0800, Jason Wang wrote: >>> >> >>> >> On 04/27/2016 07:45 PM, Michael S. Tsirkin wrote: >>>> >>

[PATCH net-next V2] tuntap: calculate rps hash only when needed

2016-04-25 Thread Jason Wang
: Michael S. Tsirkin <m...@redhat.com> Signed-off-by: Jason Wang <jasow...@redhat.com> Changes from V1: - Fix build when CONFIG_RPS is not set --- drivers/net/tun.c | 4 +++- net/core/dev.c| 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/tun.c b/drive

Re: [PATCH net-next] tuntap: calculate rps hash only when needed

2016-04-25 Thread Jason Wang
On 04/26/2016 09:55 AM, Jason Wang wrote: > There's no need to calculate rps hash if it was not enabled. So this > patch export rps_needed and check it before trying to get rps > hash. Tests (using pktgen to inject packets to guest) shows this can > improve pps about 13% (when rps

[PATCH net-next] tuntap: calculate rps hash only when needed

2016-04-25 Thread Jason Wang
: Michael S. Tsirkin <m...@redhat.com> Signed-off-by: Jason Wang <jasow...@redhat.com> --- drivers/net/tun.c | 2 +- net/core/dev.c| 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/tun.c b/drivers/net/tun.c index afdf950..746877f 100644 --- a/drivers/net

[PATCH 1/2] vhost: simplify work flushing

2016-04-25 Thread Jason Wang
We used to implement the work flushing through tracking queued seq, done seq, and the number of flushing. This patch simplify this by just implement work flushing through another kind of vhost work with completion. This will be used by lockless enqueuing patch. Signed-off-by: Jason Wang <ja

[PATCH 2/2] vhost: lockless enqueuing

2016-04-25 Thread Jason Wang
We use spinlock to synchronize the work list now which may cause unnecessary contentions. So this patch switch to use llist to remove this contention. Pktgen tests shows about 5% improvement: Before: ~130 pps After: ~137 pps Signed-off-by: Jason Wang <jasow...@redhat.com> --- d

Re: [PATCH 2/2] vhost: lockless enqueuing

2016-04-26 Thread Jason Wang
is contention. Pktgen tests shows about 5% improvement: >> >> Before: >> ~130 pps >> After: >> ~137 pps >> >> Signed-off-by: Jason Wang <jasow...@redhat.com> >> --- >> drivers/vhost/vhost.c | 52 >> +

Re: [PATCH net] tuntap: correctly wake up process during uninit

2016-05-18 Thread Jason Wang
On 2016年05月18日 21:01, Eric Dumazet wrote: On Wed, 2016-05-18 at 18:58 +0800, Jason Wang wrote: We used to check dev->reg_state against NETREG_REGISTERED after each time we are woke up. But after commit 9e641bdcfa4e ("net-tun: restructure tun_do_read for better sleep/wakeup ef

[PATCH net V2] tuntap: correctly wake up process during uninit

2016-05-18 Thread Jason Wang
dcfa4e ("net-tun: restructure tun_do_read for better sleep/wakeup efficiency") Cc: Eric Dumazet <eduma...@google.com> Cc: Xi Wang <x...@google.com> Cc: Michael S. Tsirkin <m...@redhat.com> Signed-off-by: Jason Wang <jasow...@redhat.com> --- - The patch is needed

[RFC PATCH V3 1/3] vhost: introduce vhost memory accessors

2016-05-24 Thread Jason Wang
This patch introduces vhost memory accessors which were just wrappers for userspace address access helpers. This is a requirement for vhost device iotlb implementation which will add iotlb translations in those accessors. Signed-off-by: Jason Wang <jasow...@redhat.com> --- drivers/vhost

[RFC PATCH V3 0/3] basic device IOTLB support

2016-05-24 Thread Jason Wang
request, this solves the possible deadlock in V1. - read/write permission check support. Please review. Jason Wang (3): vhost: introduce vhost memory accessors vhost: convert pre sorted vhost memory array to interval tree vhost: device IOTLB API drivers/vhost/net.c| 63 +++- drivers

[RFC PATCH V3 2/3] vhost: convert pre sorted vhost memory array to interval tree

2016-05-24 Thread Jason Wang
the userspace to send diffs of memory table. - Simplify Device IOTLB implementation. Signed-off-by: Jason Wang <jasow...@redhat.com> --- drivers/vhost/net.c | 8 +-- drivers/vhost/vhost.c | 182 -- drivers/vhost/vhost.h | 27 ++-- 3

[RFC PATCH V3 3/3] vhost: device IOTLB API

2016-05-24 Thread Jason Wang
happens during vq processing. In most cases, virtqueue were mapped contiguous even in virtual address. So the IOTLB translation for virtqueue itself maybe a little bit slower. We can add fast path on top of this patch. Signed-off-by: Jason Wang <jasow...@redhat.com> --- drivers/vhost

Re: [PATCH net-next] tuntap: introduce tx skb ring

2016-05-16 Thread Jason Wang
On 2016年05月16日 16:08, Michael S. Tsirkin wrote: On Mon, May 16, 2016 at 03:52:11PM +0800, Jason Wang wrote: On 2016年05月16日 12:23, Michael S. Tsirkin wrote: On Mon, May 16, 2016 at 09:17:01AM +0800, Jason Wang wrote: We used to queue tx packets in sk_receive_queue, this is less efficient

[PATCH net-next] tuntap: introduce tx skb ring

2016-05-15 Thread Jason Wang
pps: Before: ~148pps After : ~161pps (I'm not sure noblocking read is still needed, so it was not included in this patch) Signed-off-by: Jason Wang <jasow...@redhat.com> --- --- drivers/net/tun.c | 157 +--- drivers/vhost/net.c

Re: [PATCH net-next] tuntap: introduce tx skb ring

2016-05-16 Thread Jason Wang
On 2016年05月16日 12:23, Michael S. Tsirkin wrote: On Mon, May 16, 2016 at 09:17:01AM +0800, Jason Wang wrote: We used to queue tx packets in sk_receive_queue, this is less efficient since it requires spinlocks to synchronize between producer and consumer. This patch tries to address

Re: [PATCH net-next] tuntap: introduce tx skb ring

2016-05-16 Thread Jason Wang
On 2016年05月16日 11:56, Eric Dumazet wrote: On Mon, 2016-05-16 at 09:17 +0800, Jason Wang wrote: We used to queue tx packets in sk_receive_queue, this is less efficient since it requires spinlocks to synchronize between producer and consumer. ... struct tun_struct *detached

[PATCH net] tuntap: correctly wake up process during uninit

2016-05-18 Thread Jason Wang
dcfa4e ("net-tun: restructure tun_do_read for better sleep/wakeup efficiency") Cc: Eric Dumazet <eduma...@google.com> Cc: Xi Wang <x...@google.com> Cc: Michael S. Tsirkin <m...@redhat.com> Signed-off-by: Jason Wang <jasow...@redhat.com> --- The patch is needed f

Re: [PATCH net-next] tuntap: introduce tx skb ring

2016-05-18 Thread Jason Wang
On 2016年05月18日 16:13, Jesper Dangaard Brouer wrote: On Mon, 16 May 2016 15:51:48 +0800 Jason Wang <jasow...@redhat.com> wrote: On 2016年05月16日 11:56, Eric Dumazet wrote: On Mon, 2016-05-16 at 09:17 +0800, Jason Wang wrote: We used to queue tx packets in sk_receive_queue, this i

Re: [PATCH net-next] tuntap: introduce tx skb ring

2016-05-18 Thread Jason Wang
On Tue, 17 May 2016 09:38:37 +0800 Jason Wang <jasow...@redhat.com> wrote: And if tx_queue_length is not power of 2, we probably need modulus to calculate the capacity. Is that really that important for speed? Not sure, I can test. In my experience, yes, adding a modulus does affect p

Re: [PATCH] vhost_net: stop polling socket during rx processing

2016-05-02 Thread Jason Wang
On 04/28/2016 02:19 PM, Jason Wang wrote: > On 04/27/2016 07:28 PM, Michael S. Tsirkin wrote: >> > On Tue, Apr 26, 2016 at 03:35:53AM -0400, Jason Wang wrote: >>> >> We don't stop polling socket during rx processing, this will lead >>> >> unnecessary

Re: [PATCH RFC 2/2] tun: don't set a default qdisc

2016-04-14 Thread Jason Wang
On 04/14/2016 05:05 PM, Michael S. Tsirkin wrote: > On Thu, Apr 14, 2016 at 02:49:28PM +0800, Jason Wang wrote: >> > >> > >> > On 04/13/2016 06:26 PM, Michael S. Tsirkin wrote: >>> > > On Wed, Apr 13, 2016 at 11:04:47AM +0200, Paolo Abeni wrote: &g

Re: [PATCH RFC 2/2] tun: don't set a default qdisc

2016-04-14 Thread Jason Wang
On 04/14/2016 05:10 PM, Michael S. Tsirkin wrote: > On Thu, Apr 14, 2016 at 05:07:50PM +0800, Jason Wang wrote: >> >> On 04/14/2016 05:05 PM, Michael S. Tsirkin wrote: >>> On Thu, Apr 14, 2016 at 02:49:28PM +0800, Jason Wang wrote: >>>>> >>>>

Re: [REGRESSION] 362899b ("macvtap: switch to use skb array") causes oops during teardown

2016-08-11 Thread Jason Wang
On 2016年08月11日 16:13, Cornelia Huck wrote: On Thu, 11 Aug 2016 15:49:12 +0800 Jason Wang <jasow...@redhat.com> wrote: This looks like a use-after-free. Could you pls try the following patch to see it if fixes your issue? diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c

Re: [REGRESSION] 362899b ("macvtap: switch to use skb array") causes oops during teardown

2016-08-11 Thread Jason Wang
On 2016年08月11日 00:40, Cornelia Huck wrote: I'm hitting the following oops during shutdown (halt command in guest) of a libvirt-managed qemu guest 100% of the time: [ 108.920486] Unable to handle kernel pointer dereference in virtual kernel address space [ 108.920492] Failing address:

[PATCH net] macvtap: fix use after free for skb_array during release

2016-08-11 Thread Jason Wang
lt;cornelia.h...@de.ibm.com> Tested-by: Cornelia Huck <cornelia.h...@de.ibm.com> Signed-off-by: Jason Wang <jasow...@redhat.com> --- drivers/net/macvtap.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index a38c0da..

[PATCH net-next] macvtap: correctly free skb during socket destruction

2016-07-18 Thread Jason Wang
We should use kfree_skb() instead of kfree() to free an skb. Fixes: 362899b8725b ("macvtap: switch to use skb array") Reported-by: Dan Carpenter <dan.carpen...@oracle.com> Signed-off-by: Jason Wang <jasow...@redhat.com> --- drivers/net/macvtap.c | 2 +- 1 file changed, 1 in

[PATCH net-next 1/2] macvtap: avoid hash calculating for single queue

2016-07-15 Thread Jason Wang
We decide the rxq through calculating its hash which is not necessary if we only have one rx queue. So this patch skip this and just return queue 0. Test shows 22% improving on guest rx pps. Before: 1201504 pkts/s After: 1472731 pkts/s Signed-off-by: Jason Wang <jasow...@redhat.

[PATCH net-next 2/2] macvtap: switch to use skb array

2016-07-15 Thread Jason Wang
This patch switch to use skb array instead of sk_receive_queue to avoid spinlock contentions. Tests shows about 21% improvements for guest rx pps: Before: 1472731 pkts/s After: 1786289 pkts/s Signed-off-by: Jason Wang <jasow...@redhat.com> --- drivers/net/macvtap.

Re: [PATCH net-next] tun: Don't assume type tun in tun_device_event

2016-07-06 Thread Jason Wang
Y_DONE; + switch (event) { case NETDEV_CHANGE_TX_QUEUE_LEN: if (tun_queue_resize(tun)) Good catch. Acked-by: Jason Wang <jasow...@redhat.com>

Re: [PATCH net-next V4 0/6] switch to use tx skb array in tun

2016-07-08 Thread Jason Wang
On 2016年07月08日 14:19, Michael S. Tsirkin wrote: On Wed, Jul 06, 2016 at 01:45:58PM -0400, Craig Gallek wrote: >On Thu, Jun 30, 2016 at 2:45 AM, Jason Wang<jasow...@redhat.com> wrote: > >Hi all: > > > >This series tries to switch to use skb array in tun. T

[PATCH net-next V4 4/6] skb_array: add wrappers for resizing

2016-06-30 Thread Jason Wang
Signed-off-by: Michael S. Tsirkin <m...@redhat.com> Signed-off-by: Jason Wang <jasow...@redhat.com> --- include/linux/skb_array.h | 9 + 1 file changed, 9 insertions(+) diff --git a/include/linux/skb_array.h b/include/linux/skb_array.h index 2dd0d1e..f4dfade 100644 --- a/i

[PATCH net-next V4 5/6] net: introduce NETDEV_CHANGE_TX_QUEUE_LEN

2016-06-30 Thread Jason Wang
tab...@intel.com> Signed-off-by: Jason Wang <jasow...@redhat.com> --- include/linux/netdevice.h | 1 + net/core/net-sysfs.c | 15 ++- net/core/rtnetlink.c | 16 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/include/linux/netdevice

[PATCH net-next V4 6/6] tun: switch to use skb array for tx

2016-06-30 Thread Jason Wang
Signed-off-by: Jason Wang <jasow...@redhat.com> --- drivers/net/tun.c | 138 +--- drivers/vhost/net.c | 16 +- include/linux/net.h | 1 + 3 files changed, 146 insertions(+), 9 deletions(-) diff --git a/drivers/net/tun.c b/drivers/net

[PATCH net-next V4 0/6] switch to use tx skb array in tun

2016-06-30 Thread Jason Wang
since test show very minor improvement Jason Wang (5): ptr_ring: support zero length ring skb_array: minor tweak skb_array: add wrappers for resizing net: introduce NETDEV_CHANGE_TX_QUEUE_LEN tun: switch to use skb array for tx Michael S. Tsirkin (1): ptr_ring: support resizing multiple

[PATCH net-next V4 1/6] ptr_ring: support zero length ring

2016-06-30 Thread Jason Wang
Sometimes, we need zero length ring. But current code will crash since we don't do any check before accessing the ring. This patch fixes this. Signed-off-by: Jason Wang <jasow...@redhat.com> --- include/linux/ptr_ring.h | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff

[PATCH net-next V4 2/6] skb_array: minor tweak

2016-06-30 Thread Jason Wang
Signed-off-by: Michael S. Tsirkin <m...@redhat.com> Signed-off-by: Jason Wang <jasow...@redhat.com> --- include/linux/skb_array.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/skb_array.h b/include/linux/skb_array.h index 678bfbf..2d

[PATCH net-next V4 3/6] ptr_ring: support resizing multiple queues

2016-06-30 Thread Jason Wang
From: "Michael S. Tsirkin" <m...@redhat.com> Sometimes, we need support resizing multiple queues at once. This is because it was not easy to recover to recover from a partial failure of multiple queues resizing. Signed-off-by: Michael S. Tsirkin <m...@redhat.com> Signed-off

Re: [PATCH net-next V3 5/6] net: introduce NETDEV_CHANGE_TX_QUEUE_LEN

2016-06-30 Thread Jason Wang
On 2016年06月30日 13:59, Jason Wang wrote: On 2016年06月30日 13:12, Jason Wang wrote: On 2016年06月30日 12:56, John Fastabend wrote: On 16-06-29 08:52 PM, Jason Wang wrote: This patch introduces a new event - NETDEV_CHANGE_TX_QUEUE_LEN, this will be triggered when tx_queue_len. It could be used

Re: [PATCH net-next V4 0/6] switch to use tx skb array in tun

2016-07-01 Thread Jason Wang
On 2016年06月30日 23:45, Michael S. Tsirkin wrote: On Thu, Jun 30, 2016 at 02:45:30PM +0800, Jason Wang wrote: >Hi all: > >This series tries to switch to use skb array in tun. This is used to >eliminate the spinlock contention between producer and consumer. The >conversion was

Re: [PATCH net-next V2] tun: introduce tx skb ring

2016-06-29 Thread Jason Wang
On 2016年06月28日 15:09, Michael S. Tsirkin wrote: On Thu, Jun 23, 2016 at 01:14:07PM +0800, Jason Wang wrote: On 2016年06月23日 02:18, Michael S. Tsirkin wrote: On Fri, Jun 17, 2016 at 03:41:20AM +0300, Michael S. Tsirkin wrote: Would it help to have ptr_ring_resize that gets an array of rings

[PATCH net-next V3 1/6] ptr_ring: support zero length ring

2016-06-29 Thread Jason Wang
Sometimes, we need zero length ring. But current code will crash since we don't do any check before accessing the ring. This patch fixes this. Signed-off-by: Jason Wang <jasow...@redhat.com> --- include/linux/ptr_ring.h | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff

[PATCH net-next V3 0/6] switch to use tx skb array in tun

2016-06-29 Thread Jason Wang
a NETDEV_CHANGE_TX_QUEUE_LEN - drop new flags Changes from V1: - switch to use skb array instead of a customized circular buffer - add non-blocking support - rename .peek to .peek_len - drop lockless peeking since test show very minor improvement Jason Wang (5): ptr_ring: support zero length ring

[PATCH net-next V3 4/6] skb_array: add wrappers for resizing

2016-06-29 Thread Jason Wang
Signed-off-by: Michael S. Tsirkin <m...@redhat.com> Signed-off-by: Jason Wang <jasow...@redhat.com> --- include/linux/skb_array.h | 9 + 1 file changed, 9 insertions(+) diff --git a/include/linux/skb_array.h b/include/linux/skb_array.h index 2dd0d1e..f4dfade 100644 --- a/i

Re: [PATCH net-next V3 5/6] net: introduce NETDEV_CHANGE_TX_QUEUE_LEN

2016-06-29 Thread Jason Wang
On 2016年06月30日 12:56, John Fastabend wrote: On 16-06-29 08:52 PM, Jason Wang wrote: This patch introduces a new event - NETDEV_CHANGE_TX_QUEUE_LEN, this will be triggered when tx_queue_len. It could be used by net device who want to do some processing at that time. An example is tun who may

[PATCH net-next V3 6/6] tun: switch to use skb array for tx

2016-06-29 Thread Jason Wang
Signed-off-by: Jason Wang <jasow...@redhat.com> --- drivers/net/tun.c | 138 +--- drivers/vhost/net.c | 16 +- include/linux/net.h | 1 + 3 files changed, 146 insertions(+), 9 deletions(-) diff --git a/drivers/net/tun.c b/drivers/net

[PATCH net-next V3 2/6] skb_array: minor tweak

2016-06-29 Thread Jason Wang
Signed-off-by: Michael S. Tsirkin <m...@redhat.com> Signed-off-by: Jason Wang <jasow...@redhat.com> --- include/linux/skb_array.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/skb_array.h b/include/linux/skb_array.h index 678bfbf..2d

[PATCH net-next V3 5/6] net: introduce NETDEV_CHANGE_TX_QUEUE_LEN

2016-06-29 Thread Jason Wang
This patch introduces a new event - NETDEV_CHANGE_TX_QUEUE_LEN, this will be triggered when tx_queue_len. It could be used by net device who want to do some processing at that time. An example is tun who may want to resize tx array when tx_queue_len is changed. Signed-off-by: Jason Wang <ja

[PATCH net-next V3 3/6] ptr_ring: support resizing multiple queues

2016-06-29 Thread Jason Wang
From: "Michael S. Tsirkin" <m...@redhat.com> Sometimes, we need support resizing multiple queues at once. This is because it was not easy to recover to recover from a partial failure of multiple queues resizing. Signed-off-by: Michael S. Tsirkin <m...@redhat.com> Signed-off

Re: [PATCH net-next V3 5/6] net: introduce NETDEV_CHANGE_TX_QUEUE_LEN

2016-06-30 Thread Jason Wang
On 2016年06月30日 13:12, Jason Wang wrote: On 2016年06月30日 12:56, John Fastabend wrote: On 16-06-29 08:52 PM, Jason Wang wrote: This patch introduces a new event - NETDEV_CHANGE_TX_QUEUE_LEN, this will be triggered when tx_queue_len. It could be used by net device who want to do some

Re: linux-next: build warning after merge of the net-next tree

2016-07-03 Thread Jason Wang
On 2016年07月04日 11:15, Stephen Rothwell wrote: Hi all, After merging the net-next tree, today's linux-next build (powerpc ppc64_defconfig) produced this warning: drivers/net/tun.c: In function 'tun_do_read.part.5': /home/sfr/next/next/drivers/net/tun.c:1491:6: warning: 'err' may be used

[PATCH net-next] tun: fix build warnings

2016-07-03 Thread Jason Wang
return an uninitialized err, fix this. Reported-by: Stephen Rothwell <s...@canb.auug.org.au> Signed-off-by: Jason Wang <jasow...@redhat.com> --- drivers/net/tun.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/tun.c b/drivers/net/tun.c i

Re: [RFC PATCH 1/2] af_packet: direct dma for packet ineterface

2017-02-03 Thread Jason Wang
On 2017年01月28日 05:33, John Fastabend wrote: This adds ndo ops for upper layer objects to request direct DMA from the network interface into memory "slots". The slots must be DMA'able memory given by a page/offset/size vector in a packet_ring_buffer structure. The PF_PACKET socket interface

Re: [net-next PATCH v2 5/5] virtio_net: XDP support for adjust_head

2017-02-06 Thread Jason Wang
On 2017年02月07日 03:29, John Fastabend wrote: On 17-02-05 11:08 PM, Jason Wang wrote: On 2017年02月03日 11:16, John Fastabend wrote: Add support for XDP adjust head by allocating a 256B header region that XDP programs can grow into. This is only enabled when a XDP program is loaded. In order

[PATCH] vhost: try avoiding avail index access when getting descriptor

2017-02-06 Thread Jason Wang
-by: Jason Wang <jasow...@redhat.com> --- drivers/vhost/vhost.c | 39 +++ 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 9f11838..bffbeeb 100644 --- a/drivers/vhost/vhost.c +++ b/drivers

Re: [net-next PATCH v2 3/5] virtio_net: remove duplicate queue pair binding in XDP

2017-02-05 Thread Jason Wang
On 2017年02月03日 11:15, John Fastabend wrote: Factor out qp assignment. Signed-off-by: John Fastabend <john.r.fastab...@intel.com> Acked-by: Jason Wang <jasow...@redhat.com> --- drivers/net/virtio_net.c | 20 +++- 1 file changed, 7 insertions(+), 13 deleti

Re: [net-next PATCH v2 4/5] virtio_net: refactor freeze/restore logic into virtnet reset logic

2017-02-05 Thread Jason Wang
are different however so we can not simply reuse the code. This patch refactors the code path and adds a reset helper routine. Signed-off-by: John Fastabend <john.r.fastab...@intel.com> Acked-by: Jason Wang <jasow...@redhat.com> --- drivers/net/virtio_

Re: [net-next PATCH v2 5/5] virtio_net: XDP support for adjust_head

2017-02-05 Thread Jason Wang
On 2017年02月03日 11:16, John Fastabend wrote: Add support for XDP adjust head by allocating a 256B header region that XDP programs can grow into. This is only enabled when a XDP program is loaded. In order to ensure that we do not have to unwind queue headroom push queue setup below

Re: [net-next PATCH v2 0/5] XDP adjust head support for virtio

2017-02-05 Thread Jason Wang
On 2017年02月06日 12:39, Michael S. Tsirkin wrote: On Sun, Feb 05, 2017 at 05:36:34PM -0500, David Miller wrote: From: John Fastabend Date: Thu, 02 Feb 2017 19:14:05 -0800 This series adds adjust head support for virtio. The following is my test setup. I use qemu +

Re: [PATCH net-next] virtio: Fix affinity for >32 VCPUs

2017-02-05 Thread Jason Wang
On 2017年02月03日 14:19, Ben Serebrin wrote: From: Benjamin Serebrin If the number of virtio queue pairs is not equal to the number of VCPUs, the virtio guest driver doesn't assign any CPU affinity for the queue interrupts or the xps aggregation interrupt. So this in fact

Re: [PATCH net-next] virtio: Fix affinity for >32 VCPUs

2017-02-05 Thread Jason Wang
On 2017年02月06日 15:28, Benjamin Serebrin wrote: On Sun, Feb 5, 2017 at 11:24 PM, Jason Wang<jasow...@redhat.com> wrote: On 2017年02月03日 14:19, Ben Serebrin wrote: From: Benjamin Serebrin<sereb...@google.com> If the number of virtio queue pairs is not equal to the number of VCPUs

Re: [net-next PATCH v2 1/5] virtio_net: wrap rtnl_lock in test for calling with lock already held

2017-02-05 Thread Jason Wang
in virtio_net. To do this we use the following pattern, _foo(...) { do stuff } foo(...) { rtnl_lock(); _foo(...); rtnl_unlock()}; this allows us to use freeze()/restore() flow from both contexts. Signed-off-by: John Fastabend <john.r.fastab...@intel.com> Acked-by: Jason Wang

Re: [net-next PATCH v2 2/5] virtio_net: factor out xdp handler for readability

2017-02-05 Thread Jason Wang
On 2017年02月03日 11:15, John Fastabend wrote: At this point the do_xdp_prog is mostly if/else branches handling the different modes of virtio_net. So remove it and handle running the program in the per mode handlers. Signed-off-by: John Fastabend <john.r.fastab...@intel.com> Acked-by:

Re: [net PATCH v5 1/6] virtio_net: use dev_kfree_skb for small buffer XDP receive

2017-01-24 Thread Jason Wang
On 2017年01月25日 12:02, John Fastabend wrote: On 17-01-24 07:23 PM, Michael S. Tsirkin wrote: On Wed, Jan 25, 2017 at 10:57:12AM +0800, Jason Wang wrote: On 2017年01月25日 04:08, Michael S. Tsirkin wrote: On Tue, Jan 24, 2017 at 02:43:28PM -0500, David Miller wrote: From: "Michael S. Tsirk

<    1   2   3   4   5   6   7   8   9   10   >