Re: [PATCH net-next] virtio_net: don't reset twice on XDP on/off

2017-03-29 Thread Jason Wang
On 2017年03月30日 04:14, Michael S. Tsirkin wrote: We already do a reset once in remove_vq_common - there appears to be no point in doing another one when we add/remove XDP. Signed-off-by: Michael S. Tsirkin --- drivers/net/virtio_net.c | 1 - 1 file changed, 1 deletion(-)

Re: [PATCH v2] virtio_net: fix support for small rings

2017-03-29 Thread Jason Wang
On 2017年03月30日 01:42, Michael S. Tsirkin wrote: When ring size is small (<32 entries) making buffers smaller means a full ring might not be able to hold enough buffers to fit a single large packet. Make sure a ring full of buffers is large enough to allow at least one packet of max size.

Re: [PATCH] virtio_net: enable big packets for large MTU values

2017-03-29 Thread Jason Wang
On 2017年03月29日 20:38, Michael S. Tsirkin wrote: If one enables e.g. jumbo frames without mergeable buffers, packets won't fit in 1500 byte buffers we use. Switch to big packet mode instead. TODO: make sizing more exact, possibly extend small packet mode to use larger pages. Signed-off-by:

Re: [PATCH] virtio_net: fix mergeable bufs error handling

2017-03-29 Thread Jason Wang
On 2017年03月29日 20:37, Michael S. Tsirkin wrote: On xdp error we try to free head_skb without having initialized it, that's clearly bogus. Fixes: f600b6905015 ("virtio_net: Add XDP support") Cc: John Fastabend Signed-off-by: Michael S. Tsirkin ---

[vhost:linux-next 6/19] drivers/remoteproc/remoteproc_virtio.c:148:9: error: 'ctx' undeclared

2017-03-29 Thread kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next head: d01047cb281d27bcedbf705089bdd38d86d20b01 commit: a965e977a1038cd738f874b5ee8a16d4fa55c64d [6/19] virtio: add context flag to find vqs config: x86_64-randconfig-x015-201713 (attached as .config) compiler:

Re: [PATCH net-next 8/8] vhost_net: use lockless peeking for skb array during busy polling

2017-03-29 Thread Jason Wang
On 2017年03月30日 10:33, Michael S. Tsirkin wrote: On Thu, Mar 30, 2017 at 10:16:15AM +0800, Jason Wang wrote: On 2017年03月29日 20:07, Michael S. Tsirkin wrote: On Tue, Mar 21, 2017 at 12:04:47PM +0800, Jason Wang wrote: For the socket that exports its skb array, we can use lockless polling to

Re: [PATCH net-next 8/8] vhost_net: use lockless peeking for skb array during busy polling

2017-03-29 Thread Michael S. Tsirkin
On Thu, Mar 30, 2017 at 10:16:15AM +0800, Jason Wang wrote: > > > On 2017年03月29日 20:07, Michael S. Tsirkin wrote: > > On Tue, Mar 21, 2017 at 12:04:47PM +0800, Jason Wang wrote: > > > For the socket that exports its skb array, we can use lockless polling > > > to avoid touching spinlock during

Re: [PATCH net-next 8/8] vhost_net: use lockless peeking for skb array during busy polling

2017-03-29 Thread Jason Wang
On 2017年03月29日 20:07, Michael S. Tsirkin wrote: On Tue, Mar 21, 2017 at 12:04:47PM +0800, Jason Wang wrote: For the socket that exports its skb array, we can use lockless polling to avoid touching spinlock during busy polling. Signed-off-by: Jason Wang ---

[vhost:linux-next 6/19] drivers/remoteproc/remoteproc_virtio.c:106:33: sparse: not enough arguments for function vring_new_virtqueue

2017-03-29 Thread kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next head: 8ab881d0e8136390da79aa0902fe03d2f6c65e32 commit: 281310d52c1d63630f54b1ac5cca6e9eb8715b3a [6/19] virtio: add context flag to find vqs reproduce: # apt-get install sparse git checkout

RE: [PATCH 1/6] virtio: wrap find_vqs

2017-03-29 Thread Gonglei (Arei)
> -Original Message- > From: Michael S. Tsirkin [mailto:m...@redhat.com] > Sent: Thursday, March 30, 2017 4:49 AM > Subject: [PATCH 1/6] virtio: wrap find_vqs > > We are going to add more parameters to find_vqs, let's wrap the call so > we don't need to tweak all drivers every time. > >

[vhost:linux-next 6/19] drivers//remoteproc/remoteproc_virtio.c:106:7: error: too few arguments to function 'vring_new_virtqueue'

2017-03-29 Thread kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next head: 8ab881d0e8136390da79aa0902fe03d2f6c65e32 commit: 281310d52c1d63630f54b1ac5cca6e9eb8715b3a [6/19] virtio: add context flag to find vqs config: x86_64-randconfig-i0-201713 (attached as .config) compiler:

[vhost:linux-next 6/19] drivers/remoteproc/remoteproc_virtio.c:107:27: error: passing argument 8 of 'vring_new_virtqueue' from incompatible pointer type

2017-03-29 Thread kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next head: 8ab881d0e8136390da79aa0902fe03d2f6c65e32 commit: 281310d52c1d63630f54b1ac5cca6e9eb8715b3a [6/19] virtio: add context flag to find vqs config: i386-randconfig-s0-201713 (attached as .config) compiler: gcc-6

Re: [PATCH net-next 7/8] vhost_net: try batch dequing from skb array

2017-03-29 Thread Michael S. Tsirkin
On Wed, Mar 29, 2017 at 06:53:27PM +0800, Jason Wang wrote: > > > On 2017年03月29日 18:46, Pankaj Gupta wrote: > > Hi Jason, > > > > > On 2017年03月23日 13:34, Jason Wang wrote: > > > > > > > > > > +{ > > > > > > +if (rvq->rh != rvq->rt) > > > > > > +goto out; > > > > > > + > > > > > > +

[PATCH 6/6] virtio_net: reduce alignment for buffers

2017-03-29 Thread Michael S. Tsirkin
We don't need to align length to any particular value anymore. Aligning to L1 cache size probably sill makes sense to reduce false sharing. Signed-off-by: Michael S. Tsirkin --- drivers/net/virtio_net.c | 13 + 1 file changed, 1 insertion(+), 12 deletions(-) diff

[PATCH 4/6] virtio_net: allow specifying context for rx

2017-03-29 Thread Michael S. Tsirkin
With mergeable buffers we never use s/g for rx, so allow specifying context in that case. Signed-off-by: Michael S. Tsirkin --- drivers/net/virtio_net.c | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio_net.c

[PATCH 5/6] virtio_net: rework mergeable buffer handling

2017-03-29 Thread Michael S. Tsirkin
Use the new _ctx virtio API to maintain true length for each buffer. Signed-off-by: Michael S. Tsirkin --- drivers/net/virtio_net.c | 91 +++- 1 file changed, 44 insertions(+), 47 deletions(-) diff --git a/drivers/net/virtio_net.c

[PATCH 3/6] virtio: allow extra context per descriptor

2017-03-29 Thread Michael S. Tsirkin
Allow extra context per descriptor. To avoid slow down for data path, this disables use of indirect descriptors for this vq. Signed-off-by: Michael S. Tsirkin --- drivers/virtio/virtio_ring.c | 70 include/linux/virtio.h | 9

[PATCH 2/6] virtio: add context flag to find vqs

2017-03-29 Thread Michael S. Tsirkin
Allows maintaining extra context per vq. For ease of use, passing in NULL is legal and disables the feature for all vqs. Signed-off-by: Michael S. Tsirkin --- drivers/misc/mic/vop/vop_main.c| 9 ++--- drivers/s390/virtio/kvm_virtio.c | 6 --

[PATCH 1/6] virtio: wrap find_vqs

2017-03-29 Thread Michael S. Tsirkin
We are going to add more parameters to find_vqs, let's wrap the call so we don't need to tweak all drivers every time. Signed-off-by: Michael S. Tsirkin --- drivers/block/virtio_blk.c | 3 +-- drivers/char/virtio_console.c | 6 +++---

[PATCH] virtio_console: fix uninitialized variable use

2017-03-29 Thread Michael S. Tsirkin
We try to disable callbacks on c_ivq even without multiport even though that vq is not initialized in this configuration. Fixes: c743d09dbd01 ("virtio: console: Disable callbacks for virtqueues at start of S4 freeze") Suggested-by: Mike Galbraith Signed-off-by: Michael S. Tsirkin

[PATCH net-next] virtio_net: don't reset twice on XDP on/off

2017-03-29 Thread Michael S. Tsirkin
We already do a reset once in remove_vq_common - there appears to be no point in doing another one when we add/remove XDP. Signed-off-by: Michael S. Tsirkin --- drivers/net/virtio_net.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/virtio_net.c

Re: [PATCH kernel v8 3/4] mm: add inerface to offer info about unused pages

2017-03-29 Thread Michael S. Tsirkin
On Fri, Mar 17, 2017 at 02:55:33PM +0800, Wei Wang wrote: > On 03/17/2017 05:28 AM, Andrew Morton wrote: > > On Thu, 16 Mar 2017 15:08:46 +0800 Wei Wang wrote: > > > > > From: Liang Li > > > > > > This patch adds a function to provides a snapshot of

[PATCH v2] virtio_net: fix support for small rings

2017-03-29 Thread Michael S. Tsirkin
When ring size is small (<32 entries) making buffers smaller means a full ring might not be able to hold enough buffers to fit a single large packet. Make sure a ring full of buffers is large enough to allow at least one packet of max size. Fixes: 2613af0ed18a ("virtio_net: migrate mergeable rx

Re: [PATCH] virtio_net: fix support for small rings

2017-03-29 Thread Michael S. Tsirkin
On Wed, Mar 29, 2017 at 08:15:04PM +0300, Michael S. Tsirkin wrote: > When ring size is small (<32 entries) making buffers smaller means a > full ring might not be able to hold enough buffers to fit a single large > packet. > > Make sure a ring full of buffers is large enough to allow at least

[PATCH] virtio_net: fix support for small rings

2017-03-29 Thread Michael S. Tsirkin
When ring size is small (<32 entries) making buffers smaller means a full ring might not be able to hold enough buffers to fit a single large packet. Make sure a ring full of buffers is large enough to allow at least one packet of max size. Fixes: 2613af0ed18a ("virtio_net: migrate mergeable rx

[PATCH 2/2] virtio_net: clear MTU when out of range

2017-03-29 Thread Michael S. Tsirkin
virtio attempts to clear the MTU feature bit if the value is out of the supported range, but this has no real effect since FEATURES_OK has already been set. Fix this up by checking the MTU in the new validate callback. Fixes: 14de9d114a82 ("virtio-net: Add initial MTU advice feature")

[PATCH 1/2] virtio: allow drivers to validate features

2017-03-29 Thread Michael S. Tsirkin
Some drivers can't support all features in all configurations. At the moment we blindly set FEATURES_OK and later FAILED. Support this better by adding a callback drivers can use to do some early checks. Signed-off-by: Michael S. Tsirkin --- drivers/virtio/virtio.c | 6 ++

Re: [PATCH] virtio_net: enable big packets for large MTU values

2017-03-29 Thread Michael S. Tsirkin
On Wed, Mar 29, 2017 at 03:38:09PM +0300, Michael S. Tsirkin wrote: > If one enables e.g. jumbo frames without mergeable > buffers, packets won't fit in 1500 byte buffers > we use. Switch to big packet mode instead. > TODO: make sizing more exact, possibly extend small > packet mode to use larger

Re: [virtio-dev] packed ring layout proposal - todo list

2017-03-29 Thread Michael S. Tsirkin
On Wed, Mar 08, 2017 at 03:56:24PM +0800, Yuanhan Liu wrote: > On Wed, Mar 08, 2017 at 03:09:48PM +0800, Yuanhan Liu wrote: > > On Wed, Mar 01, 2017 at 03:07:29AM +0200, Michael S. Tsirkin wrote: > > > On Tue, Feb 28, 2017 at 12:29:43PM +0800, Yuanhan Liu wrote: > > > > Hi Michael, > > > > > > >

[PATCH] virtio_net: enable big packets for large MTU values

2017-03-29 Thread Michael S. Tsirkin
If one enables e.g. jumbo frames without mergeable buffers, packets won't fit in 1500 byte buffers we use. Switch to big packet mode instead. TODO: make sizing more exact, possibly extend small packet mode to use larger pages. Signed-off-by: Michael S. Tsirkin ---

[PATCH] virtio_net: fix mergeable bufs error handling

2017-03-29 Thread Michael S. Tsirkin
On xdp error we try to free head_skb without having initialized it, that's clearly bogus. Fixes: f600b6905015 ("virtio_net: Add XDP support") Cc: John Fastabend Signed-off-by: Michael S. Tsirkin --- drivers/net/virtio_net.c | 2 +- 1 file changed, 1

Re: [PATCH net-next 8/8] vhost_net: use lockless peeking for skb array during busy polling

2017-03-29 Thread Michael S. Tsirkin
On Tue, Mar 21, 2017 at 12:04:47PM +0800, Jason Wang wrote: > For the socket that exports its skb array, we can use lockless polling > to avoid touching spinlock during busy polling. > > Signed-off-by: Jason Wang > --- > drivers/vhost/net.c | 7 +-- > 1 file changed, 5

Re: [PATCH net-next 7/8] vhost_net: try batch dequing from skb array

2017-03-29 Thread Jason Wang
On 2017年03月29日 18:46, Pankaj Gupta wrote: Hi Jason, On 2017年03月23日 13:34, Jason Wang wrote: +{ +if (rvq->rh != rvq->rt) +goto out; + +rvq->rh = rvq->rt = 0; +rvq->rt = skb_array_consume_batched_bh(rvq->rx_array, rvq->rxq, +VHOST_RX_BATCH); A

Re: [PATCH net-next 7/8] vhost_net: try batch dequing from skb array

2017-03-29 Thread Pankaj Gupta
Hi Jason, > > On 2017年03月23日 13:34, Jason Wang wrote: > > > > > >> > >>> +{ > >>> +if (rvq->rh != rvq->rt) > >>> +goto out; > >>> + > >>> +rvq->rh = rvq->rt = 0; > >>> +rvq->rt = skb_array_consume_batched_bh(rvq->rx_array, rvq->rxq, > >>> +

Re: [PATCH net-next 7/8] vhost_net: try batch dequing from skb array

2017-03-29 Thread Jason Wang
On 2017年03月23日 13:34, Jason Wang wrote: +{ +if (rvq->rh != rvq->rt) +goto out; + +rvq->rh = rvq->rt = 0; +rvq->rt = skb_array_consume_batched_bh(rvq->rx_array, rvq->rxq, +VHOST_RX_BATCH); A comment explaining why is is -bh would be helpful.