[PATCH v2 03/11] VSOCK: extract utility functions from vsock_diag_test.c

2019-08-01 Thread Stefano Garzarella
From: Stefan Hajnoczi Move useful functions into a separate file in preparation for more vsock test programs. Signed-off-by: Stefan Hajnoczi Signed-off-by: Stefano Garzarella --- v2: * aligned with the current SPDX [Stefano] --- tools/testing/vsock/Makefile | 2 +- tools/testing

[PATCH v2 07/11] VSOCK: add AF_VSOCK test cases

2019-08-01 Thread Stefano Garzarella
From: Stefan Hajnoczi The vsock_test.c program runs a test suite of AF_VSOCK test cases. Signed-off-by: Stefan Hajnoczi Signed-off-by: Stefano Garzarella --- v2: * Drop unnecessary includes [Stefan] * Aligned with the current SPDX [Stefano] * Set MULTICONN_NFDS to 100 [Stefano] * Change

[PATCH v2 04/11] VSOCK: extract connect/accept functions from vsock_diag_test.c

2019-08-01 Thread Stefano Garzarella
From: Stefan Hajnoczi Many test cases will need to connect to the server or accept incoming connections. This patch extracts these operations into utility functions that can be reused. Signed-off-by: Stefan Hajnoczi Signed-off-by: Stefano Garzarella --- tools/testing/vsock/util.c

[PATCH v2 00/11] VSOCK: add vsock_test test suite

2019-08-01 Thread Stefano Garzarella
: add AF_VSOCK test cases Stefano Garzarella (4): VSOCK: add vsock_get_local_cid() test utility vsock_test: add --transport parameter vsock_test: skip read() in test_stream*close tests on a VMCI host vsock_test: wait for the remote to close the connection tools/testing/vsock/.gitignore

[PATCH v2 01/11] VSOCK: fix header include in vsock_diag_test

2019-08-01 Thread Stefano Garzarella
Hajnoczi Signed-off-by: Stefano Garzarella --- tools/testing/vsock/Makefile | 2 +- tools/testing/vsock/README| 2 +- tools/testing/vsock/vsock_diag_test.c | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/testing/vsock/Makefile b/tools/testing/vsock

Re: [PATCH v4 1/5] vsock/virtio: limit the memory used per-socket

2019-08-01 Thread Stefano Garzarella
On Thu, Aug 01, 2019 at 09:21:15AM -0400, Michael S. Tsirkin wrote: > On Thu, Aug 01, 2019 at 12:47:54PM +0200, Stefano Garzarella wrote: > > On Tue, Jul 30, 2019 at 04:42:25PM -0400, Michael S. Tsirkin wrote: > > > On Tue, Jul 30, 2019 at 11:35:39AM +0200, Stefan

Re: [PATCH v4 1/5] vsock/virtio: limit the memory used per-socket

2019-08-01 Thread Stefano Garzarella
On Tue, Jul 30, 2019 at 04:42:25PM -0400, Michael S. Tsirkin wrote: > On Tue, Jul 30, 2019 at 11:35:39AM +0200, Stefano Garzarella wrote: (...) > > > > The problem here is the compatibility. Before this series virtio-vsock > > and vhost-vsock modules had the RX b

Re: [PATCH V2 9/9] vhost: do not return -EAGIAN for non blocking invalidation too early

2019-07-31 Thread Stefano Garzarella
A little typo in the title: s/EAGIAN/EAGAIN Thanks, Stefano On Wed, Jul 31, 2019 at 04:46:55AM -0400, Jason Wang wrote: > Instead of returning -EAGAIN unconditionally, we'd better do that only > we're sure the range is overlapped with the metadata area. > > Reported-by: Jason Gunthorpe >

Re: [PATCH net-next v5 0/5] vsock/virtio: optimizations to increase the throughput

2019-07-30 Thread Stefano Garzarella
On Tue, Jul 30, 2019 at 11:55:09AM -0400, Michael S. Tsirkin wrote: > On Tue, Jul 30, 2019 at 11:54:53AM -0400, Michael S. Tsirkin wrote: > > On Tue, Jul 30, 2019 at 05:43:29PM +0200, Stefano Garzarella wrote: > > > This series tries to increase the throughput of virtio

[PATCH net-next v5 5/5] vsock/virtio: change the maximum packet size allowed

2019-07-30 Thread Stefano Garzarella
Since now we are able to split packets, we can avoid limiting their sizes to VIRTIO_VSOCK_DEFAULT_RX_BUF_SIZE. Instead, we can use VIRTIO_VSOCK_MAX_PKT_BUF_SIZE as the max packet size. Signed-off-by: Stefano Garzarella Reviewed-by: Stefan Hajnoczi Acked-by: Michael S. Tsirkin --- net

[PATCH net-next v5 4/5] vhost/vsock: split packets to send using multiple buffers

2019-07-30 Thread Stefano Garzarella
If the packets to sent to the guest are bigger than the buffer available, we can split them, using multiple buffers and fixing the length in the packet header. This is safe since virtio-vsock supports only stream sockets. Signed-off-by: Stefano Garzarella Reviewed-by: Stefan Hajnoczi Acked

[PATCH net-next v5 1/5] vsock/virtio: limit the memory used per-socket

2019-07-30 Thread Stefano Garzarella
of other sockets. This patch mitigates this issue copying the payload of small packets (< 128 bytes) into the buffer of last packet queued, in order to avoid wasting memory. Signed-off-by: Stefano Garzarella Reviewed-by: Stefan Hajnoczi Acked-by: Michael S. Tsirkin --- drivers/vhost/vsoc

[PATCH net-next v5 3/5] vsock/virtio: fix locking in virtio_transport_inc_tx_pkt()

2019-07-30 Thread Stefano Garzarella
fwd_cnt and last_fwd_cnt are protected by rx_lock, so we should use the same spinlock also if we are in the TX path. Move also buf_alloc under the same lock. Signed-off-by: Stefano Garzarella Reviewed-by: Stefan Hajnoczi Acked-by: Michael S. Tsirkin --- include/linux/virtio_vsock.h

[PATCH net-next v5 0/5] vsock/virtio: optimizations to increase the throughput

2019-07-30 Thread Stefano Garzarella
174.70 32K 147.06144.74 146.02 282.48 64K 145.25143.99 141.62 406.40 128K 149.34146.96 147.49 489.34 256K 156.35149.81 152.21 536.37 512K 151.65150.74 151.52 519.93 [1] https://github.com/stefano-garzarella/iperf/ Stefano Garzarella (5):

[PATCH net-next v5 2/5] vsock/virtio: reduce credit update messages

2019-07-30 Thread Stefano Garzarella
In order to reduce the number of credit update messages, we send them only when the space available seen by the transmitter is less than VIRTIO_VSOCK_MAX_PKT_BUF_SIZE. Signed-off-by: Stefano Garzarella Reviewed-by: Stefan Hajnoczi Acked-by: Michael S. Tsirkin --- include/linux/virtio_vsock.h

Re: [PATCH v4 0/5] vsock/virtio: optimizations to increase the throughput

2019-07-30 Thread Stefano Garzarella
On Tue, Jul 30, 2019 at 06:03:24PM +0800, Jason Wang wrote: > > On 2019/7/30 下午5:40, Stefano Garzarella wrote: > > On Mon, Jul 29, 2019 at 09:59:23AM -0400, Michael S. Tsirkin wrote: > > > On Wed, Jul 17, 2019 at 01:30:25PM +0200, Stefano Garzarella wrote: > > > &

Re: [PATCH v4 0/5] vsock/virtio: optimizations to increase the throughput

2019-07-30 Thread Stefano Garzarella
On Mon, Jul 29, 2019 at 09:59:23AM -0400, Michael S. Tsirkin wrote: > On Wed, Jul 17, 2019 at 01:30:25PM +0200, Stefano Garzarella wrote: > > This series tries to increase the throughput of virtio-vsock with slight > > changes. > > While I was testing the v2 of this series I d

Re: [PATCH v4 1/5] vsock/virtio: limit the memory used per-socket

2019-07-30 Thread Stefano Garzarella
On Mon, Jul 29, 2019 at 03:10:15PM -0400, Michael S. Tsirkin wrote: > On Mon, Jul 29, 2019 at 06:50:56PM +0200, Stefano Garzarella wrote: > > On Mon, Jul 29, 2019 at 06:19:03PM +0200, Stefano Garzarella wrote: > > > On Mon, Jul 29, 2019 at 11:49:02AM -0400, Michael S. Tsirkin wro

Re: [PATCH v4 1/5] vsock/virtio: limit the memory used per-socket

2019-07-29 Thread Stefano Garzarella
On Mon, Jul 29, 2019 at 06:19:03PM +0200, Stefano Garzarella wrote: > On Mon, Jul 29, 2019 at 11:49:02AM -0400, Michael S. Tsirkin wrote: > > On Mon, Jul 29, 2019 at 05:36:56PM +0200, Stefano Garzarella wrote: > > > On Mon, Jul 29, 2019 at 10:04:29AM -0400, Michael S. Tsirkin wro

Re: [PATCH v4 1/5] vsock/virtio: limit the memory used per-socket

2019-07-29 Thread Stefano Garzarella
On Mon, Jul 29, 2019 at 12:01:37PM -0400, Michael S. Tsirkin wrote: > On Mon, Jul 29, 2019 at 05:36:56PM +0200, Stefano Garzarella wrote: > > On Mon, Jul 29, 2019 at 10:04:29AM -0400, Michael S. Tsirkin wrote: > > > On Wed, Jul 17, 2019 at 01:30:26PM +0200, Stefano Garzarella wr

Re: [PATCH v4 1/5] vsock/virtio: limit the memory used per-socket

2019-07-29 Thread Stefano Garzarella
On Mon, Jul 29, 2019 at 11:49:02AM -0400, Michael S. Tsirkin wrote: > On Mon, Jul 29, 2019 at 05:36:56PM +0200, Stefano Garzarella wrote: > > On Mon, Jul 29, 2019 at 10:04:29AM -0400, Michael S. Tsirkin wrote: > > > On Wed, Jul 17, 2019 at 01:30:26PM +0200, Stefano Garzarella wr

Re: [PATCH v4 1/5] vsock/virtio: limit the memory used per-socket

2019-07-29 Thread Stefano Garzarella
On Mon, Jul 29, 2019 at 10:04:29AM -0400, Michael S. Tsirkin wrote: > On Wed, Jul 17, 2019 at 01:30:26PM +0200, Stefano Garzarella wrote: > > Since virtio-vsock was introduced, the buffers filled by the host > > and pushed to the guest using the vring, are directly queued in > &

Re: [PATCH v4 0/5] vsock/virtio: optimizations to increase the throughput

2019-07-22 Thread Stefano Garzarella
On Mon, Jul 22, 2019 at 10:08:35AM +0100, Stefan Hajnoczi wrote: > On Wed, Jul 17, 2019 at 01:30:25PM +0200, Stefano Garzarella wrote: > > This series tries to increase the throughput of virtio-vsock with slight > > changes. > > While I was testing the v2 of this series I d

Re: [PATCH v4 4/5] vhost/vsock: split packets to send using multiple buffers

2019-07-19 Thread Stefano Garzarella
On Fri, Jul 19, 2019 at 04:51:00PM +0800, Jason Wang wrote: > > On 2019/7/19 下午4:39, Stefano Garzarella wrote: > > On Fri, Jul 19, 2019 at 04:21:52PM +0800, Jason Wang wrote: > > > On 2019/7/19 下午4:08, Stefano Garzarella wrote: > > > > On Thu, Jul 18, 2019 at 07:

Re: [PATCH v4 4/5] vhost/vsock: split packets to send using multiple buffers

2019-07-19 Thread Stefano Garzarella
On Fri, Jul 19, 2019 at 04:21:52PM +0800, Jason Wang wrote: > > On 2019/7/19 下午4:08, Stefano Garzarella wrote: > > On Thu, Jul 18, 2019 at 07:35:46AM -0400, Michael S. Tsirkin wrote: > > > On Thu, Jul 18, 2019 at 11:37:30AM +0200, Stefano Garzarella wrote: > > > >

Re: [PATCH v4 5/5] vsock/virtio: change the maximum packet size allowed

2019-07-19 Thread Stefano Garzarella
On Thu, Jul 18, 2019 at 08:33:40AM -0400, Michael S. Tsirkin wrote: > On Thu, Jul 18, 2019 at 09:52:41AM +0200, Stefano Garzarella wrote: > > On Wed, Jul 17, 2019 at 5:00 PM Michael S. Tsirkin wrote: > > > > > > On Wed, Jul 17, 2019 at 01:30:30PM +0200, Stefano Garzarel

Re: [PATCH v4 4/5] vhost/vsock: split packets to send using multiple buffers

2019-07-19 Thread Stefano Garzarella
On Thu, Jul 18, 2019 at 07:35:46AM -0400, Michael S. Tsirkin wrote: > On Thu, Jul 18, 2019 at 11:37:30AM +0200, Stefano Garzarella wrote: > > On Thu, Jul 18, 2019 at 10:13 AM Michael S. Tsirkin wrote: > > > On Thu, Jul 18, 2019 at 09:50:14AM +0200, Stefano Garzarella wrote: >

Re: [PATCH v4 4/5] vhost/vsock: split packets to send using multiple buffers

2019-07-18 Thread Stefano Garzarella
On Thu, Jul 18, 2019 at 10:13 AM Michael S. Tsirkin wrote: > On Thu, Jul 18, 2019 at 09:50:14AM +0200, Stefano Garzarella wrote: > > On Wed, Jul 17, 2019 at 4:55 PM Michael S. Tsirkin wrote: > > > On Wed, Jul 17, 2019 at 01:30:29PM +0200, Stefano Garzarella wrote: > > &g

Re: [PATCH v4 5/5] vsock/virtio: change the maximum packet size allowed

2019-07-18 Thread Stefano Garzarella
On Wed, Jul 17, 2019 at 5:00 PM Michael S. Tsirkin wrote: > > On Wed, Jul 17, 2019 at 01:30:30PM +0200, Stefano Garzarella wrote: > > Since now we are able to split packets, we can avoid limiting > > their sizes to VIRTIO_VSOCK_DEFAULT_RX_BUF_SIZE. >

Re: [PATCH v4 4/5] vhost/vsock: split packets to send using multiple buffers

2019-07-18 Thread Stefano Garzarella
On Wed, Jul 17, 2019 at 4:55 PM Michael S. Tsirkin wrote: > > On Wed, Jul 17, 2019 at 01:30:29PM +0200, Stefano Garzarella wrote: > > If the packets to sent to the guest are bigger than the buffer > > available, we can split them, using multiple buffers and fixing > >

Re: [PATCH v4 3/5] vsock/virtio: fix locking in virtio_transport_inc_tx_pkt()

2019-07-18 Thread Stefano Garzarella
On Wed, Jul 17, 2019 at 4:51 PM Michael S. Tsirkin wrote: > > On Wed, Jul 17, 2019 at 01:30:28PM +0200, Stefano Garzarella wrote: > > fwd_cnt and last_fwd_cnt are protected by rx_lock, so we should use > > the same spinlock also if we are in the TX path. > > > > Move

[PATCH v4 2/5] vsock/virtio: reduce credit update messages

2019-07-17 Thread Stefano Garzarella
In order to reduce the number of credit update messages, we send them only when the space available seen by the transmitter is less than VIRTIO_VSOCK_MAX_PKT_BUF_SIZE. Signed-off-by: Stefano Garzarella --- include/linux/virtio_vsock.h| 1 + net/vmw_vsock/virtio_transport_common.c

[PATCH v4 3/5] vsock/virtio: fix locking in virtio_transport_inc_tx_pkt()

2019-07-17 Thread Stefano Garzarella
fwd_cnt and last_fwd_cnt are protected by rx_lock, so we should use the same spinlock also if we are in the TX path. Move also buf_alloc under the same lock. Signed-off-by: Stefano Garzarella --- include/linux/virtio_vsock.h| 2 +- net/vmw_vsock/virtio_transport_common.c | 4

[PATCH v4 1/5] vsock/virtio: limit the memory used per-socket

2019-07-17 Thread Stefano Garzarella
of other sockets. This patch mitigates this issue copying the payload of small packets (< 128 bytes) into the buffer of last packet queued, in order to avoid wasting memory. Reviewed-by: Stefan Hajnoczi Signed-off-by: Stefano Garzarella --- drivers/vhost/vsock.c | 2 + incl

[PATCH v4 5/5] vsock/virtio: change the maximum packet size allowed

2019-07-17 Thread Stefano Garzarella
Since now we are able to split packets, we can avoid limiting their sizes to VIRTIO_VSOCK_DEFAULT_RX_BUF_SIZE. Instead, we can use VIRTIO_VSOCK_MAX_PKT_BUF_SIZE as the max packet size. Signed-off-by: Stefano Garzarella --- net/vmw_vsock/virtio_transport_common.c | 4 ++-- 1 file changed, 2

[PATCH v4 4/5] vhost/vsock: split packets to send using multiple buffers

2019-07-17 Thread Stefano Garzarella
If the packets to sent to the guest are bigger than the buffer available, we can split them, using multiple buffers and fixing the length in the packet header. This is safe since virtio-vsock supports only stream sockets. Signed-off-by: Stefano Garzarella --- drivers/vhost/vsock.c

[PATCH v4 0/5] vsock/virtio: optimizations to increase the throughput

2019-07-17 Thread Stefano Garzarella
145.25143.99 141.62 406.40 128K 149.34146.96 147.49 489.34 256K 156.35149.81 152.21 536.37 512K 151.65150.74 151.52 519.93 [1] https://github.com/stefano-garzarella/iperf/ Stefano Garzarella (5): vsock/virtio: limit the memory used per-socket

[PATCH v3 2/3] vsock/virtio: stop workers during the .remove()

2019-07-05 Thread Stefano Garzarella
config->del_vqs(vdev). Suggested-by: Stefan Hajnoczi Suggested-by: Michael S. Tsirkin Signed-off-by: Stefano Garzarella --- net/vmw_vsock/virtio_transport.c | 51 +++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/net/vmw_vsock/virtio_transport

[PATCH v3 3/3] vsock/virtio: fix flush of works during the .remove()

2019-07-05 Thread Stefano Garzarella
gt;config->reset(vdev), so we can safely move the workers' flush. Before the vdev->config->del_vqs(vdev), workers can be scheduled by VQ callbacks, so we must flush them after del_vqs(), to avoid use-after-free of 'vsock' object. Suggested-by: Michael S. Tsirkin Signed-off-by: Stefano Ga

[PATCH v3 1/3] vsock/virtio: use RCU to avoid use-after-free on the_virtio_vsock

2019-07-05 Thread Stefano Garzarella
dev->priv, because after the vdev->config->del_vqs() we are sure that they are ended and will no longer be invoked. We also take the mutex during the .remove() to avoid that .probe() can run while we are resetting the device. Signed-off-by: Stefano Garzarella --- net/vmw_vsock/virtio_tran

[PATCH v3 0/3] vsock/virtio: several fixes in the .probe() and .remove()

2019-07-05 Thread Stefano Garzarella
& cat /dev/urandom | nc-vsock 3 6321 > /dev/null & cat /dev/urandom | nc-vsock 3 7321 > /dev/null & sleep 2 echo "device_del v1" | nc 127.0.0.1 1234 sleep 1 echo "device_add vhost-vsock-pci,id=v1,guest-cid=3" | nc 127.0.0.1 1234

Re: [PATCH v2 1/3] vsock/virtio: use RCU to avoid use-after-free on the_virtio_vsock

2019-07-04 Thread Stefano Garzarella
On Thu, Jul 04, 2019 at 11:58:00AM +0800, Jason Wang wrote: > > On 2019/7/3 下午6:41, Stefano Garzarella wrote: > > On Wed, Jul 03, 2019 at 05:53:58PM +0800, Jason Wang wrote: > > > On 2019/6/28 下午8:36, Stefano Garzarella wrote: > > > > Some callbacks used by

Re: [PATCH v2 1/3] vsock/virtio: use RCU to avoid use-after-free on the_virtio_vsock

2019-07-03 Thread Stefano Garzarella
On Wed, Jul 03, 2019 at 05:53:58PM +0800, Jason Wang wrote: > > On 2019/6/28 下午8:36, Stefano Garzarella wrote: > > Some callbacks used by the upper layers can run while we are in the > > .remove(). A potential use-after-free can happen, because we free > > the_virt

Re: [PATCH v2 0/3] vsock/virtio: several fixes in the .probe() and .remove()

2019-07-03 Thread Stefano Garzarella
On Wed, Jul 03, 2019 at 10:14:53AM +0100, Stefan Hajnoczi wrote: > On Mon, Jul 01, 2019 at 07:03:57PM +0200, Stefano Garzarella wrote: > > On Mon, Jul 01, 2019 at 04:11:13PM +0100, Stefan Hajnoczi wrote: > > > On Fri, Jun 28, 2019 at 02:36:56PM +0200, Stefano Garzarella wro

Re: [PATCH v2 0/3] vsock/virtio: several fixes in the .probe() and .remove()

2019-07-01 Thread Stefano Garzarella
On Mon, Jul 01, 2019 at 04:11:13PM +0100, Stefan Hajnoczi wrote: > On Fri, Jun 28, 2019 at 02:36:56PM +0200, Stefano Garzarella wrote: > > During the review of "[PATCH] vsock/virtio: Initialize core virtio vsock > > before registering the driver", Stefan pointed

[PATCH v2 1/3] vsock/virtio: use RCU to avoid use-after-free on the_virtio_vsock

2019-06-28 Thread Stefano Garzarella
dev->priv, because after the vdev->config->del_vqs() we are sure that they are ended and will no longer be invoked. We also take the mutex during the .remove() to avoid that .probe() can run while we are resetting the device. Signed-off-by: Stefano Garzarella --- net/vmw_vsock/virtio_tran

[PATCH v2 2/3] vsock/virtio: stop workers during the .remove()

2019-06-28 Thread Stefano Garzarella
config->del_vqs(vdev). Suggested-by: Stefan Hajnoczi Suggested-by: Michael S. Tsirkin Signed-off-by: Stefano Garzarella --- net/vmw_vsock/virtio_transport.c | 51 +++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/net/vmw_vsock/virtio_transport

[PATCH v2 3/3] vsock/virtio: fix flush of works during the .remove()

2019-06-28 Thread Stefano Garzarella
gt;config->reset(vdev), so we can safely move the workers' flush. Before the vdev->config->del_vqs(vdev), workers can be scheduled by VQ callbacks, so we must flush them after del_vqs(), to avoid use-after-free of 'vsock' object. Suggested-by: Michael S. Tsirkin Signed-off-by: Stefano Ga

[PATCH v2 0/3] vsock/virtio: several fixes in the .probe() and .remove()

2019-06-28 Thread Stefano Garzarella
Patch 1: use RCU to protect 'the_virtio_vsock' pointer - Patch 2: no changes - Patch 3: flush works only at the end of .remove() - Removed patch 4 because virtqueue_detach_unused_buf() returns all the buffers allocated. v1: https://patchwork.kernel.org/cover/10964733/ Stefano Garzarella (3): vsock

Re: [PATCH 3/4] vsock/virtio: fix flush of works during the .remove()

2019-06-27 Thread Stefano Garzarella
On Thu, Jun 13, 2019 at 04:57:15PM +0800, Jason Wang wrote: > > On 2019/6/6 下午4:11, Stefano Garzarella wrote: > > On Fri, May 31, 2019 at 05:56:39PM +0800, Jason Wang wrote: > > > On 2019/5/31 下午4:18, Stefano Garzarella wrote: > > > > On Thu, May 30, 2019 at 0

Re: [PATCH 0/4] vsock/virtio: several fixes in the .probe() and .remove()

2019-06-27 Thread Stefano Garzarella
On Mon, Jun 10, 2019 at 02:09:45PM +0100, Stefan Hajnoczi wrote: > On Tue, May 28, 2019 at 12:56:19PM +0200, Stefano Garzarella wrote: > > During the review of "[PATCH] vsock/virtio: Initialize core virtio vsock > > before registering the driver", Stefan pointed

Re: [PATCH 3/4] vsock/virtio: fix flush of works during the .remove()

2019-06-06 Thread Stefano Garzarella
On Fri, May 31, 2019 at 05:56:39PM +0800, Jason Wang wrote: > On 2019/5/31 下午4:18, Stefano Garzarella wrote: > > On Thu, May 30, 2019 at 07:59:14PM +0800, Jason Wang wrote: > > > On 2019/5/30 下午6:10, Stefano Garzarella wrote: > > > > On Thu, May 30, 2019 at 05:4

Re: [PATCH v3 2/5] vsock/virtio: fix locking for fwd_cnt and buf_alloc

2019-06-03 Thread Stefano Garzarella
On Sun, Jun 02, 2019 at 06:03:34PM -0700, David Miller wrote: > From: Stefano Garzarella > Date: Fri, 31 May 2019 15:39:51 +0200 > > > @@ -434,7 +434,9 @@ void virtio_transport_set_buffer_size(struct vsock_sock > > *vsk, u64 val) > > if (val > vvs->

[PATCH v3 5/5] vsock/virtio: change the maximum packet size allowed

2019-05-31 Thread Stefano Garzarella
Since now we are able to split packets, we can avoid limiting their sizes to VIRTIO_VSOCK_DEFAULT_RX_BUF_SIZE. Instead, we can use VIRTIO_VSOCK_MAX_PKT_BUF_SIZE as the max packet size. Signed-off-by: Stefano Garzarella --- net/vmw_vsock/virtio_transport_common.c | 4 ++-- 1 file changed, 2

[PATCH v3 3/5] vsock/virtio: reduce credit update messages

2019-05-31 Thread Stefano Garzarella
In order to reduce the number of credit update messages, we send them only when the space available seen by the transmitter is less than VIRTIO_VSOCK_MAX_PKT_BUF_SIZE. Signed-off-by: Stefano Garzarella --- include/linux/virtio_vsock.h| 1 + net/vmw_vsock/virtio_transport_common.c

[PATCH v3 4/5] vhost/vsock: split packets to send using multiple buffers

2019-05-31 Thread Stefano Garzarella
If the packets to sent to the guest are bigger than the buffer available, we can split them, using multiple buffers and fixing the length in the packet header. This is safe since virtio-vsock supports only stream sockets. Signed-off-by: Stefano Garzarella --- drivers/vhost/vsock.c

[PATCH v3 2/5] vsock/virtio: fix locking for fwd_cnt and buf_alloc

2019-05-31 Thread Stefano Garzarella
fwd_cnt is written with rx_lock, so we should read it using the same spinlock also if we are in the TX path. Move also buf_alloc under rx_lock and add a missing locking when we modify it. Signed-off-by: Stefano Garzarella --- include/linux/virtio_vsock.h| 2 +- net/vmw_vsock

[PATCH v3 1/5] vsock/virtio: limit the memory used per-socket

2019-05-31 Thread Stefano Garzarella
of other sockets. This patch mitigates this issue copying the payload of small packets (< 128 bytes) into the buffer of last packet queued, in order to avoid wasting memory. Signed-off-by: Stefano Garzarella --- drivers/vhost/vsock.c | 2 + include/linux/virtio_vsoc

[PATCH v3 0/5] vsock/virtio: optimizations to increase the throughput

2019-05-31 Thread Stefano Garzarella
140.68153.65 152.64 516.622 [1] https://github.com/stefano-garzarella/iperf/ Stefano Garzarella (5): vsock/virtio: limit the memory used per-socket vsock/virtio: fix locking for fwd_cnt and buf_alloc vsock/virtio: reduce credit update messages vhost/vsock: split packets to send usi

Re: [PATCH 3/4] vsock/virtio: fix flush of works during the .remove()

2019-05-31 Thread Stefano Garzarella
On Thu, May 30, 2019 at 07:59:14PM +0800, Jason Wang wrote: > > On 2019/5/30 下午6:10, Stefano Garzarella wrote: > > On Thu, May 30, 2019 at 05:46:18PM +0800, Jason Wang wrote: > > > On 2019/5/29 下午6:58, Stefano Garzarella wrote: > > > > On Wed, May 29, 2019 at 1

Re: [PATCH 1/4] vsock/virtio: fix locking around 'the_virtio_vsock'

2019-05-30 Thread Stefano Garzarella
On Wed, May 29, 2019 at 09:28:52PM -0700, David Miller wrote: > From: Stefano Garzarella > Date: Tue, 28 May 2019 12:56:20 +0200 > > > @@ -68,7 +68,13 @@ struct virtio_vsock { > > > > static struct virtio_vsock *virtio_vsock_get(void) > > { > > -

Re: [PATCH 3/4] vsock/virtio: fix flush of works during the .remove()

2019-05-30 Thread Stefano Garzarella
On Thu, May 30, 2019 at 05:46:18PM +0800, Jason Wang wrote: > > On 2019/5/29 下午6:58, Stefano Garzarella wrote: > > On Wed, May 29, 2019 at 11:22:40AM +0800, Jason Wang wrote: > > > On 2019/5/28 下午6:56, Stefano Garzarella wrote: > > > > We flush all pending works b

Re: [PATCH 3/4] vsock/virtio: fix flush of works during the .remove()

2019-05-29 Thread Stefano Garzarella
On Wed, May 29, 2019 at 11:22:40AM +0800, Jason Wang wrote: > > On 2019/5/28 下午6:56, Stefano Garzarella wrote: > > We flush all pending works before to call vdev->config->reset(vdev), > > but other works can be queued before the vdev->config->del_vqs(vdev), >

Re: [PATCH v2 1/8] vsock/virtio: limit the memory used per-socket

2019-05-28 Thread Stefano Garzarella
On Wed, May 15, 2019 at 10:48:44AM +0800, Jason Wang wrote: > > On 2019/5/15 上午12:35, Stefano Garzarella wrote: > > On Tue, May 14, 2019 at 11:25:34AM +0800, Jason Wang wrote: > > > On 2019/5/14 上午1:23, Stefano Garzarella wrote: > > > > On Mon, May 13, 2019 at 0

[PATCH 1/4] vsock/virtio: fix locking around 'the_virtio_vsock'

2019-05-28 Thread Stefano Garzarella
the end of the function. Signed-off-by: Stefano Garzarella --- net/vmw_vsock/virtio_transport.c | 19 +-- 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c index 96ab344f17bb..d3ba7747aa73 100644

[PATCH 2/4] vsock/virtio: stop workers during the .remove()

2019-05-28 Thread Stefano Garzarella
config->del_vqs(vdev). Suggested-by: Stefan Hajnoczi Suggested-by: Michael S. Tsirkin Signed-off-by: Stefano Garzarella --- net/vmw_vsock/virtio_transport.c | 49 +++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/net/vmw_vsock/virtio_transport

[PATCH 3/4] vsock/virtio: fix flush of works during the .remove()

2019-05-28 Thread Stefano Garzarella
We flush all pending works before to call vdev->config->reset(vdev), but other works can be queued before the vdev->config->del_vqs(vdev), so we add another flush after it, to avoid use after free. Suggested-by: Michael S. Tsirkin Signed-off-by: Stefano Garzarella --- n

[PATCH 4/4] vsock/virtio: free used buffers during the .remove()

2019-05-28 Thread Stefano Garzarella
Before this patch, we only freed unused buffers, but there may still be used buffers to be freed. Signed-off-by: Stefano Garzarella --- net/vmw_vsock/virtio_transport.c | 18 ++ 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/net/vmw_vsock/virtio_transport.c b/net

[PATCH 0/4] vsock/virtio: several fixes in the .probe() and .remove()

2019-05-28 Thread Stefano Garzarella
d of the .remove() to avoid use after free. - Patch 4 free also used buffers in the virtqueues during the .remove(). Stefano Garzarella (4): vsock/virtio: fix locking around 'the_virtio_vsock' vsock/virtio: stop workers during the .remove() vsock/virtio: fix flush of works during the .remove() vs

Re: [PATCH v2 0/8] vsock/virtio: optimizations to increase the throughput

2019-05-20 Thread Stefano Garzarella
On Mon, May 13, 2019 at 05:33:40PM +0800, Jason Wang wrote: > > On 2019/5/10 下午8:58, Stefano Garzarella wrote: > > While I was testing this new series (v2) I discovered an huge use of memory > > and a memory leak in the virtio-vsock driver in the guest when I sent > > 1-b

Re: [PATCH v2 2/8] vsock/virtio: free packets during the socket release

2019-05-17 Thread Stefano Garzarella
On Thu, May 16, 2019 at 04:32:18PM +0100, Stefan Hajnoczi wrote: > On Fri, May 10, 2019 at 02:58:37PM +0200, Stefano Garzarella wrote: > > When the socket is released, we should free all packets > > queued in the per-socket list in order to avoid a memory > > leak. > >

Re: [PATCH] vsock/virtio: Initialize core virtio vsock before registering the driver

2019-05-16 Thread Stefano Garzarella
On Wed, May 15, 2019 at 04:24:00PM +0100, Stefan Hajnoczi wrote: > On Tue, May 07, 2019 at 02:25:43PM +0200, Stefano Garzarella wrote: > > Hi Jorge, > > > > On Mon, May 06, 2019 at 01:19:55PM -0700, Jorge Moreira Broche wrote: > > > > On Wed, May 01, 2019 at

Re: [PATCH v2 8/8] vsock/virtio: make the RX buffer size tunable

2019-05-14 Thread Stefano Garzarella
On Mon, May 13, 2019 at 08:46:19PM +0800, Jason Wang wrote: > > On 2019/5/13 下午6:05, Jason Wang wrote: > > > > On 2019/5/10 下午8:58, Stefano Garzarella wrote: > > > The RX buffer size determines the memory consumption of the > > > vsock/virtio guest d

[PATCH v2 7/8] vsock/virtio: increase RX buffer size to 64 KiB

2019-05-10 Thread Stefano Garzarella
In order to increase host -> guest throughput with large packets, we can use 64 KiB RX buffers. Signed-off-by: Stefano Garzarella --- include/linux/virtio_vsock.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/virtio_vsock.h b/include/linux/virtio_vsoc

[PATCH v2 0/8] vsock/virtio: optimizations to increase the throughput

2019-05-10 Thread Stefano Garzarella
326.42333.32 512K 157.29153.35 152.22 546.52 533.24315.55302.27 [1] https://github.com/stefano-garzarella/iperf/ Stefano Garzarella (8): vsock/virtio: limit the memory used per-socket vsock/virtio: free packets during the socket release vsock/virtio:

[PATCH v2 6/8] vsock/virtio: change the maximum packet size allowed

2019-05-10 Thread Stefano Garzarella
Since now we are able to split packets, we can avoid limiting their sizes to VIRTIO_VSOCK_DEFAULT_RX_BUF_SIZE. Instead, we can use VIRTIO_VSOCK_MAX_PKT_BUF_SIZE as the max packet size. Signed-off-by: Stefano Garzarella --- net/vmw_vsock/virtio_transport_common.c | 4 ++-- 1 file changed, 2

[PATCH v2 5/8] vhost/vsock: split packets to send using multiple buffers

2019-05-10 Thread Stefano Garzarella
If the packets to sent to the guest are bigger than the buffer available, we can split them, using multiple buffers and fixing the length in the packet header. This is safe since virtio-vsock supports only stream sockets. Signed-off-by: Stefano Garzarella --- drivers/vhost/vsock.c

Re: [PATCH v2] vsock/virtio: fix kernel panic from virtio_transport_reset_no_sock

2019-03-07 Thread Stefano Garzarella
ops virtio_net psmouse drm net_failover pata_acpi > virtio_blk failover floppy > > Fixes: 22b5c0b63f32 ("vsock/virtio: fix kernel panic after device hot-unplug") > Reported-by: Alexandru Herghelegiu > Signed-off-by: Adalbert Lazăr > Co-developed-by:

Re: [PATCH] vsock/virtio: fix kernel panic from virtio_transport_reset_no_sock

2019-03-06 Thread Stefano Garzarella
Hi Adalbert, thanks for catching this issue, I have a comment below. On Tue, Mar 05, 2019 at 08:01:45PM +0200, Adalbert Lazăr wrote: > Previous to commit 22b5c0b63f32 ("vsock/virtio: fix kernel panic after device > hot-unplug"), > vsock_core_init() was called from virtio_vsock_probe(). Now, >

[PATCH v3 0/2] vsock/virtio: fix issues on device hot-unplug

2019-02-01 Thread Stefano Garzarella
to this approach for now. The vsock_core proto_ops expect a valid pointer to the transport device, so we can't call vsock_core_exit() until there are open sockets. v2 -> v3: - Rebased on master v1 -> v2: - Fixed commit message of patch 1. - Added Reviewed-by, Acked-by tags by Stefan S

[PATCH v3 1/2] vsock/virtio: fix kernel panic after device hot-unplug

2019-02-01 Thread Stefano Garzarella
_core_exit() in the virtio_vsock respectively in module_init and module_exit functions, that cannot be invoked until there are open sockets. Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1609699 Reported-by: Yan Fu Signed-off-by: Stefano Garzarella Acked-by: Stefan Hajnoczi --- net

[PATCH v3 2/2] vsock/virtio: reset connected sockets on device removal

2019-02-01 Thread Stefano Garzarella
When the virtio transport device disappear, we should reset all connected sockets in order to inform the users. Signed-off-by: Stefano Garzarella Reviewed-by: Stefan Hajnoczi --- net/vmw_vsock/virtio_transport.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/vmw_vsock

<    2   3   4   5   6   7