Re: [mst-vhost:vhost 26/43] drivers/vhost/vdpa.c:1003:3-9: preceding lock on line 991 (fwd)

2022-05-23 Thread Stefano Garzarella
On Fri, May 20, 2022 at 06:37:01PM +0200, Julia Lawall wrote: Please check whether an unlock is needed before line 1003. Yep, I think so. Same also for line 1016. I just saw that there is already a patch posted to solve this problem:

Re: [PATCH 4/4] vdpa_sim: Implement stop vdpa op

2022-05-23 Thread Stefano Garzarella
On Fri, May 20, 2022 at 07:23:25PM +0200, Eugenio Pérez wrote: Implement stop operation for vdpa_sim devices, so vhost-vdpa will offer that backend feature and userspace can effectively stop the device. This is a must before get virtqueue indexes (base) for live migration, since the device

Re: [PATCH v2] vdpasim: allow to enable a vq repeatedly

2022-05-19 Thread Stefano Garzarella
tor") Cc: sta...@vger.kernel.org Signed-off-by: Eugenio Pérez --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) Reviewed-by: Stefano Garzarella ___ Virtualization mailing list Virtualization@lists.linux-f

Re: [PATCH] vdpasim: allow to enable a vq repeatedly

2022-05-19 Thread Stefano Garzarella
On Thu, May 19, 2022 at 04:31:45PM +0200, Eugenio Pérez wrote: Code must be resilient to enable a queue many times. At the moment the queue is resetting so it's definitely not the expected behavior. Fixes: 2c53d0f64c06 ("vdpasim: vDPA device simulator") Cc: sta...@vger.kernel.org

Re: [PATCH V5 9/9] virtio: use WARN_ON() to warn illegal status value

2022-05-19 Thread Stefano Garzarella
: "Paul E. McKenney" Cc: Marc Zyngier Cc: Halil Pasic Cc: Cornelia Huck Cc: Vineeth Vijayan Cc: Peter Oberparleiter Cc: linux-s...@vger.kernel.org Signed-off-by: Jason Wang --- include/linux/virtio_config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Stefano

Re: [PATCH V5 3/9] virtio: introduce config op to synchronize vring callbacks

2022-05-19 Thread Stefano Garzarella
leiter Cc: linux-s...@vger.kernel.org Reviewed-by: Cornelia Huck Signed-off-by: Jason Wang --- include/linux/virtio_config.h | 25 + 1 file changed, 25 insertions(+) Reviewed-by: Stefano Garzarella ___ Virtualization ma

Re: [PATCH V5 2/9] virtio: use virtio_reset_device() when possible

2022-05-19 Thread Stefano Garzarella
leiter Cc: linux-s...@vger.kernel.org Reviewed-by: Cornelia Huck Signed-off-by: Jason Wang --- drivers/virtio/virtio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Reviewed-by: Stefano Garzarella ___ Virtualization mailing list Virt

Re: [RFC PATCH v1 0/8] virtio/vsock: experimental zerocopy receive

2022-05-19 Thread Stefano Garzarella
On Wed, May 18, 2022 at 11:04:30AM +, Arseniy Krasnov wrote: Hello Stefano, On 17.05.2022 18:14, Stefano Garzarella wrote: Hi Arseniy, On Thu, May 12, 2022 at 05:04:11AM +, Arseniy Krasnov wrote: INTRODUCTION Hello, this is experimental

Re: [PATCH V3 4/8] vhost_test: remove vhost_test_flush_vq()

2022-05-18 Thread Stefano Garzarella
1 file changed, 3 insertions(+), 8 deletions(-) Reviewed-by: Stefano Garzarella ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Re: [RFC PATCH v1 0/8] virtio/vsock: experimental zerocopy receive

2022-05-17 Thread Stefano Garzarella
Hi Arseniy, On Thu, May 12, 2022 at 05:04:11AM +, Arseniy Krasnov wrote: INTRODUCTION Hello, this is experimental implementation of virtio vsock zerocopy receive. It was inspired by TCP zerocopy receive by Eric Dumazet. This API uses same idea: call

Re: [PATCH V2 0/8] vhost flush cleanups

2022-05-17 Thread Stefano Garzarella
On Sun, May 15, 2022 at 03:29:14PM -0500, Mike Christie wrote: The following patches are Andrey Ryabinin's flush cleanups and some from me. They reduce the number of flush calls and remove some bogus ones where we don't even have a worker running anymore or they were based on outdated or

Re: [PATCH V2 8/8] vhost: rename vhost_work_dev_flush

2022-05-17 Thread Stefano Garzarella
/vsock.c | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) Reviewed-by: Stefano Garzarella ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Re: [PATCH V2 4/8] vhost_test: remove vhost_test_flush_vq()

2022-05-17 Thread Stefano Garzarella
On Sun, May 15, 2022 at 03:29:18PM -0500, Mike Christie wrote: From: Andrey Ryabinin vhost_test_flush_vq() just a simple wrapper around vhost_work_dev_flush() which seems have no value. It's just easier to call vhost_work_dev_flush() directly. Besides there is no point in obtaining vhost_dev

Re: [PATCH V2 3/8] vhost_net: get rid of vhost_net_flush_vq() and extra flush calls

2022-05-17 Thread Stefano Garzarella
ed-off-by: Mike Christie --- drivers/vhost/net.c | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) Reviewed-by: Stefano Garzarella ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundati

Re: [PATCH V2 2/8] vhost: flush dev once during vhost_dev_stop

2022-05-17 Thread Stefano Garzarella
-by: Mike Christie --- drivers/vhost/vhost.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) Reviewed-by: Stefano Garzarella ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman

Re: [PATCH V2 1/8] vhost: get rid of vhost_poll_flush() wrapper

2022-05-17 Thread Stefano Garzarella
ate understanding of the code and leads to mistakes like flushing the same vhost_dev several times in a row. Just remove vhost_poll_flush() and call vhost_work_dev_flush() directly. Signed-off-by: Andrey Ryabinin [merge vhost_poll_flush removal from Stefano Garzarella] Signed-off-by: Mike Chris

Re: [PATCH] vdpa_sim_blk: add support for VIRTIO_BLK_T_FLUSH

2022-05-05 Thread Stefano Garzarella
On Thu, May 05, 2022 at 04:26:24PM +0800, Jason Wang wrote: On Fri, Apr 29, 2022 at 3:14 PM Stefano Garzarella wrote: On Fri, Apr 29, 2022 at 10:46:40AM +0800, Jason Wang wrote: >On Thu, Apr 28, 2022 at 11:13 PM Stefano Garzarella wrote: >> >> The simulator behaves like a

Re: [PATCH] vdpa_sim_blk: add support for VIRTIO_BLK_T_FLUSH

2022-04-29 Thread Stefano Garzarella
On Fri, Apr 29, 2022 at 10:46:40AM +0800, Jason Wang wrote: On Thu, Apr 28, 2022 at 11:13 PM Stefano Garzarella wrote: The simulator behaves like a ramdisk, so we don't have to do anything when a VIRTIO_BLK_T_FLUSH request is received, but it could be useful to test driver behavior. Let's

[PATCH] vdpa_sim_blk: add support for VIRTIO_BLK_T_FLUSH

2022-04-28 Thread Stefano Garzarella
The simulator behaves like a ramdisk, so we don't have to do anything when a VIRTIO_BLK_T_FLUSH request is received, but it could be useful to test driver behavior. Let's expose the VIRTIO_BLK_F_FLUSH feature to inform the driver that we support the flush command. Signed-off-by: Stefano

[PATCH net-next 2/2] vsock/virtio: add support for device suspend/resume

2022-04-28 Thread Stefano Garzarella
Implement .freeze and .restore callbacks of struct virtio_driver to support device suspend/resume. During suspension all connected sockets are reset and VQs deleted. During resume the VQs are re-initialized. Reported by: Vilas R K Signed-off-by: Stefano Garzarella --- net/vmw_vsock

[PATCH net-next 1/2] vsock/virtio: factor our the code to initialize and delete VQs

2022-04-28 Thread Stefano Garzarella
Add virtio_vsock_vqs_init() and virtio_vsock_vqs_del() with the code that was in virtio_vsock_probe() and virtio_vsock_remove to initialize and delete VQs. These new functions will be used in the next commit to support device suspend/resume Signed-off-by: Stefano Garzarella --- net/vmw_vsock

[PATCH net-next 0/2] vsock/virtio: add support for device suspend/resume

2022-04-28 Thread Stefano Garzarella
ver to support device suspend/resume. The first patch factors our the code to initialize and delete VQs. The second patch uses that code to support device suspend/resume. Signed-off-by: Stefano Garzarella Stefano Garzarella (2): vsock/virtio: factor our the code to initialize and delete VQs vs

Re: [PATCH v2 3/5] hv_sock: Add validation for untrusted Hyper-V values

2022-04-27 Thread Stefano Garzarella
vs_recv_buf *)(hvs->recv_desc + 1); payload_len = recv_buf->hdr.data_size; - if (payload_len > HVS_MTU_SIZE) + if (payload_len > pkt_len - HVS_HEADER_LEN || + payload_len > HVS_MTU_SIZE) return -EIO; if (payload_len ==

Re: [PATCH v2 2/5] hv_sock: Copy packets sent by Hyper-V out of the ring buffer

2022-04-27 Thread Stefano Garzarella
sc = hv_pkt_iter_next(hvs->chan, hvs->recv_desc); if (hvs->recv_desc) { ret = hvs_update_recv_data(hvs); if (ret) -- 2.25.1 Reviewed-by: Stefano Garzarella ___ Virtualiz

Re: [PATCH 3/5] hv_sock: Add validation for untrusted Hyper-V values

2022-04-21 Thread Stefano Garzarella
On Thu, Apr 21, 2022 at 5:30 PM Andrea Parri wrote: > > > > @@ -577,12 +577,19 @@ static bool hvs_dgram_allow(u32 cid, u32 port) > > > static int hvs_update_recv_data(struct hvsock *hvs) > > > { > > > struct hvs_recv_buf *recv_buf; > > > - u32 payload_len; > > > + u32 pkt_len,

Re: [PATCH 3/5] hv_sock: Add validation for untrusted Hyper-V values

2022-04-21 Thread Stefano Garzarella
On Wed, Apr 20, 2022 at 10:07:18PM +0200, Andrea Parri (Microsoft) wrote: For additional robustness in the face of Hyper-V errors or malicious behavior, validate all values that originate from packets that Hyper-V has sent to the guest in the host-to-guest ring buffer. Ensure that invalid

Re: [PATCH 2/5] hv_sock: Copy packets sent by Hyper-V out of the ring buffer

2022-04-21 Thread Stefano Garzarella
On Wed, Apr 20, 2022 at 10:07:17PM +0200, Andrea Parri (Microsoft) wrote: Pointers to VMbus packets sent by Hyper-V are used by the hv_sock driver within the guest VM. Hyper-V can send packets with erroneous values or modify packet fields after they are processed by the guest. To defend

Re: [PATCH 1/5] hv_sock: Check hv_pkt_iter_first_raw()'s return value

2022-04-21 Thread Stefano Garzarella
t;chan); + if (!hvs->recv_desc) + return -ENOBUFS; ret = hvs_update_recv_data(hvs); if (ret) return ret; -- 2.25.1 Reviewed-by: Stefano Garzarella ___ Virtu

Re: [PATCH 2/2] virtio_ring: add unlikely annotation for free descs check

2022-03-29 Thread Stefano Garzarella
On Mon, Mar 28, 2022 at 06:58:17PM +0800, Xianting Tian wrote: The 'if (vq->vq.num_free < descs_used)' check will almost always be false. Signed-off-by: Xianting Tian --- drivers/virtio/virtio_ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Stefano Garz

Re: [PATCH 1/2] virtio_ring: remove unnecessary to_vvq call in vring hot path

2022-03-29 Thread Stefano Garzarella
+++- 1 file changed, 3 insertions(+), 5 deletions(-) Reviewed-by: Stefano Garzarella diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 962f1477b1fa..d597fc0874ec 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -205,11 +205,9

Re: [PATCH] virtio_ring: remove unnecessary to_vvq call in vring hot path

2022-03-28 Thread Stefano Garzarella
On Thu, Mar 24, 2022 at 03:33:40PM +0800, Xianting Tian wrote: It passes '_vq' to virtqueue_use_indirect(), which still calls to_vvq to get 'vq', let's directly pass 'vq'. It can avoid unnecessary call of to_vvq in hot path. It seems reasonable to me. Other tiny optimization: Add unlikely

Re: [PATCH 1/3] virtio: use virtio_device_ready() in virtio_device_restore()

2022-03-24 Thread Stefano Garzarella
On Thu, Mar 24, 2022 at 07:07:09AM -0400, Michael S. Tsirkin wrote: On Thu, Mar 24, 2022 at 12:03:07PM +0100, Stefano Garzarella wrote: On Thu, Mar 24, 2022 at 06:48:05AM -0400, Michael S. Tsirkin wrote: > On Thu, Mar 24, 2022 at 04:40:02PM +0800, Jason Wang wrote: > > From: Stefano G

Re: [PATCH 2/3] virtio: use virtio_reset_device() when possible

2022-03-24 Thread Stefano Garzarella
Reviewed-by: Stefano Garzarella ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Re: [PATCH 1/3] virtio: use virtio_device_ready() in virtio_device_restore()

2022-03-24 Thread Stefano Garzarella
On Thu, Mar 24, 2022 at 06:48:05AM -0400, Michael S. Tsirkin wrote: On Thu, Mar 24, 2022 at 04:40:02PM +0800, Jason Wang wrote: From: Stefano Garzarella This avoids setting DRIVER_OK twice for those drivers that call virtio_device_ready() in the .restore Is this trying to say it's faster

[PATCH net v3 3/3] vsock/virtio: enable VQs early on probe

2022-03-23 Thread Stefano Garzarella
. Fixes: 0ea9e1d3a9e3 ("VSOCK: Introduce virtio_transport.ko") Signed-off-by: Stefano Garzarella --- net/vmw_vsock/virtio_transport.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c index 3954d3be9083..ba1c8cc0c

[PATCH net v3 2/3] vsock/virtio: read the negotiated features before using VQs

2022-03-23 Thread Stefano Garzarella
Complete the driver configuration, reading the negotiated features, before using the VQs in the virtio_vsock_probe(). Fixes: 53efbba12cc7 ("virtio/vsock: enable SEQPACKET for transport") Suggested-by: Michael S. Tsirkin Reviewed-by: Stefan Hajnoczi Signed-off-by: Stefano Garzarella

[PATCH net v3 1/3] vsock/virtio: initialize vdev->priv before using VQs

2022-03-23 Thread Stefano Garzarella
el S. Tsirkin Signed-off-by: Stefano Garzarella --- net/vmw_vsock/virtio_transport.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c index 5afc194a58bb..3e5513934c9f 100644 --- a/net/vmw_vsock/virtio_transpor

[PATCH net v3 0/3] vsock/virtio: enable VQs early on probe and finish the setup before using them

2022-03-23 Thread Stefano Garzarella
/20220323084954.11769-1-sgarz...@redhat.com/ v1: https://lore.kernel.org/netdev/20220322103823.83411-1-sgarz...@redhat.com/ Stefano Garzarella (3): vsock/virtio: initialize vdev->priv before using VQs vsock/virtio: read the negotiated features before using VQs vsock/virtio: enable VQs ea

Re: [PATCH net v2 1/3] vsock/virtio: enable VQs early on probe

2022-03-23 Thread Stefano Garzarella
On Wed, Mar 23, 2022 at 01:44:42PM +, Stefan Hajnoczi wrote: On Wed, Mar 23, 2022 at 09:49:52AM +0100, Stefano Garzarella wrote: virtio spec requires drivers to set DRIVER_OK before using VQs. This is set automatically after probe returns, but virtio-vsock driver uses VQs in the probe

Re: [PATCH net v2 0/3] vsock/virtio: enable VQs early on probe and finish the setup before using them

2022-03-23 Thread Stefano Garzarella
On Wed, Mar 23, 2022 at 09:22:02AM -0400, Michael S. Tsirkin wrote: On Wed, Mar 23, 2022 at 09:49:51AM +0100, Stefano Garzarella wrote: The first patch fixes a virtio-spec violation. The other two patches complete the driver configuration before using the VQs in the probe. The patch order

[PATCH net v2 3/3] vsock/virtio: read the negotiated features before using VQs

2022-03-23 Thread Stefano Garzarella
Complete the driver configuration, reading the negotiated features, before using the VQs and tell the device that the driver is ready in the virtio_vsock_probe(). Fixes: 53efbba12cc7 ("virtio/vsock: enable SEQPACKET for transport") Suggested-by: Michael S. Tsirkin Signed-off-b

[PATCH net v2 1/3] vsock/virtio: enable VQs early on probe

2022-03-23 Thread Stefano Garzarella
. Fixes: 0ea9e1d3a9e3 ("VSOCK: Introduce virtio_transport.ko") Signed-off-by: Stefano Garzarella --- net/vmw_vsock/virtio_transport.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c index 5afc194a58bb..b1962f8cd

[PATCH net v2 2/3] vsock/virtio: initialize vdev->priv before using VQs

2022-03-23 Thread Stefano Garzarella
el S. Tsirkin Signed-off-by: Stefano Garzarella --- net/vmw_vsock/virtio_transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c index b1962f8cd502..fff67ad39087 100644 --- a/net/vmw_vsock/virtio_transpor

[PATCH net v2 0/3] vsock/virtio: enable VQs early on probe and finish the setup before using them

2022-03-23 Thread Stefano Garzarella
before using the VQs in the probe [MST] v1: https://lore.kernel.org/netdev/20220322103823.83411-1-sgarz...@redhat.com/ Stefano Garzarella (3): vsock/virtio: enable VQs early on probe vsock/virtio: initialize vdev->priv before using VQs vsock/virtio: read the negotiated features before us

Re: [PATCH] virtio: use virtio_device_ready() in virtio_device_restore()

2022-03-23 Thread Stefano Garzarella
On Wed, Mar 23, 2022 at 11:10:27AM +0800, Jason Wang wrote: On Tue, Mar 22, 2022 at 10:07 PM Michael S. Tsirkin wrote: On Tue, Mar 22, 2022 at 12:43:13PM +0100, Stefano Garzarella wrote: > After waking up a suspended VM, the kernel prints the following trace > for virtio drivers wh

Re: [PATCH net] vsock/virtio: enable VQs early on probe

2022-03-22 Thread Stefano Garzarella
On Tue, Mar 22, 2022 at 10:09:06AM -0400, Michael S. Tsirkin wrote: On Tue, Mar 22, 2022 at 03:05:00PM +0100, Stefano Garzarella wrote: On Tue, Mar 22, 2022 at 09:36:14AM -0400, Michael S. Tsirkin wrote: > On Tue, Mar 22, 2022 at 11:38:23AM +0100, Stefano Garzarella wrote: > > vi

Re: [PATCH net] vsock/virtio: enable VQs early on probe

2022-03-22 Thread Stefano Garzarella
On Tue, Mar 22, 2022 at 09:36:14AM -0400, Michael S. Tsirkin wrote: On Tue, Mar 22, 2022 at 11:38:23AM +0100, Stefano Garzarella wrote: virtio spec requires drivers to set DRIVER_OK before using VQs. This is set automatically after probe returns, but virtio-vsock driver uses VQs in the probe

[PATCH] virtio: use virtio_device_ready() in virtio_device_restore()

2022-03-22 Thread Stefano Garzarella
. Fixes: d50497eb4e55 ("virtio_config: introduce a new .enable_cbs method") Signed-off-by: Stefano Garzarella --- I'm not sure about the fixes tag. That one is more generic, but the following one I think introduced the issue. Fixes: 9e35276a5344 ("virtio_pci: harden MSI-X interrupts&q

[PATCH net] vsock/virtio: enable VQs early on probe

2022-03-22 Thread Stefano Garzarella
. Fixes: 0ea9e1d3a9e3 ("VSOCK: Introduce virtio_transport.ko") Signed-off-by: Stefano Garzarella --- net/vmw_vsock/virtio_transport.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c index 5afc194a58bb..b1962f8cd

Re: [PATCH] vhost: handle error while adding split ranges to iotlb

2022-03-18 Thread Stefano Garzarella
start = mid + 1; } -- 2.35.1 Reviewed-by: Stefano Garzarella ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Re: [PATCH net-next v4 1/2] af_vsock: SOCK_SEQPACKET receive timeout test

2022-03-17 Thread Stefano Garzarella
: 1) Fix stupid bug about invalid 'if()' line. tools/testing/vsock/vsock_test.c | 84 1 file changed, 84 insertions(+) Everything is okay now, tests pass and the patch looks good to me: Reviewed-by: Stefano Garzarella Thanks, Stef

Re: [PATCH net-next v3 2/2] af_vsock: SOCK_SEQPACKET broken buffer test

2022-03-17 Thread Stefano Garzarella
g/vsock/vsock_test.c | 131 +++ 1 file changed, 131 insertions(+) Reviewed-by: Stefano Garzarella ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Re: [PATCH net-next v3 1/2] af_vsock: SOCK_SEQPACKET receive timeout test

2022-03-17 Thread Stefano Garzarella
On Thu, Mar 17, 2022 at 05:26:45AM +, Krasnov Arseniy Vladimirovich wrote: Test for receive timeout check: connection is established, receiver sets timeout, but sender does nothing. Receiver's 'read()' call must return EAGAIN. Signed-off-by: Krasnov Arseniy Vladimirovich --- v2 -> v3: 1)

Re: [RFC PATCH v2 0/2] af_vsock: add two new tests for SOCK_SEQPACKET

2022-03-16 Thread Stefano Garzarella
On Wed, Mar 16, 2022 at 07:25:07AM +, Krasnov Arseniy Vladimirovich wrote: This adds two tests: for receive timeout and reading to invalid buffer provided by user. I forgot to put both patches to main patchset. Arseniy Krasnov(2): af_vsock: SOCK_SEQPACKET receive timeout test af_vsock:

Re: [RFC PATCH v2 2/2] af_vsock: SOCK_SEQPACKET broken buffer test

2022-03-16 Thread Stefano Garzarella
On Wed, Mar 16, 2022 at 07:29:28AM +, Krasnov Arseniy Vladimirovich wrote: Add test where sender sends two message, each with own data pattern. Reader tries to read first to broken buffer: it has three pages size, but middle page is unmapped. Then, reader tries to read second message to

Re: [RFC PATCH v2 1/2] af_vsock: SOCK_SEQPACKET receive timeout test

2022-03-16 Thread Stefano Garzarella
On Wed, Mar 16, 2022 at 07:27:45AM +, Krasnov Arseniy Vladimirovich wrote: Test for receive timeout check: connection is established, receiver sets timeout, but sender does nothing. Receiver's 'read()' call must return EAGAIN. Signed-off-by: Arseniy Krasnov --- v1 -> v2: 1) Check amount of

Re: [RFC PATCH v1 3/3] af_vsock: SOCK_SEQPACKET broken buffer test

2022-03-15 Thread Stefano Garzarella
On Tue, Mar 15, 2022 at 12:43:13PM +, Krasnov Arseniy Vladimirovich wrote: On 15.03.2022 12:35, Arseniy Krasnov wrote: On 15.03.2022 11:36, Stefano Garzarella wrote: On Fri, Mar 11, 2022 at 10:58:32AM +, Krasnov Arseniy Vladimirovich wrote: Add test where sender sends two message

Re: [RFC PATCH v1 3/3] af_vsock: SOCK_SEQPACKET broken buffer test

2022-03-15 Thread Stefano Garzarella
On Tue, Mar 15, 2022 at 09:34:35AM +, Krasnov Arseniy Vladimirovich wrote: On 15.03.2022 11:36, Stefano Garzarella wrote: Is this the right behavior? If read() fails because the buffer is invalid, do we throw out the whole packet? I was expecting the packet not to be consumed, have you

Re: [PATCH v2 3/3] vdpa: support exposing the count of vqs to userspace

2022-03-15 Thread Stefano Garzarella
since we use "num_queues" also in the spec [1]. But I'm fine also with this: Reviewed-by: Stefano Garzarella [1] https://docs.oasis-open.org/virtio/virtio/v1.1/csprd01/virtio-v1.1-csprd01.html#x1-1120003 ___ Virtualization mailing list Virt

Re: [PATCH v2 2/3] vdpa: change the type of nvqs to u32

2022-03-15 Thread Stefano Garzarella
insertions(+), 10 deletions(-) Reviewed-by: Stefano Garzarella ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Re: [PATCH v2 1/3] vdpa: support exposing the config size to userspace

2022-03-15 Thread Stefano Garzarella
Reviewed-by: Stefano Garzarella ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Re: [RFC PATCH v1 1/3] af_vsock: add two new tests for SOCK_SEQPACKET

2022-03-15 Thread Stefano Garzarella
Hi Arseniy, On Fri, Mar 11, 2022 at 10:52:36AM +, Krasnov Arseniy Vladimirovich wrote: This adds two tests: for receive timeout and reading to invalid buffer provided by user. I forgot to put both patches to main patchset. Arseniy Krasnov(2): af_vsock: SOCK_SEQPACKET receive timeout test

Re: [RFC PATCH v1 3/3] af_vsock: SOCK_SEQPACKET broken buffer test

2022-03-15 Thread Stefano Garzarella
On Fri, Mar 11, 2022 at 10:58:32AM +, Krasnov Arseniy Vladimirovich wrote: Add test where sender sends two message, each with own data pattern. Reader tries to read first to broken buffer: it has three pages size, but middle page is unmapped. Then, reader tries to read second message to

Re: [RFC PATCH v1 2/3] af_vsock: SOCK_SEQPACKET receive timeout test

2022-03-15 Thread Stefano Garzarella
On Fri, Mar 11, 2022 at 10:55:42AM +, Krasnov Arseniy Vladimirovich wrote: Test for receive timeout check: connection is established, receiver sets timeout, but sender does nothing. Receiver's 'read()' call must return EAGAIN. Signed-off-by: Arseniy Krasnov ---

Re: [PATCH v3] vsock: each transport cycles only on its own sockets

2022-03-10 Thread Stefano Garzarella
| 3 ++- net/vmw_vsock/af_vsock.c | 9 +++-- net/vmw_vsock/virtio_transport.c | 7 +-- net/vmw_vsock/vmci_transport.c | 5 - 5 files changed, 20 insertions(+), 7 deletions(-) It seems okay now, I ran my test suite and everything seems to be fine: Reviewed-by: Stefano

Re: [PATCH v2] vsock: each transport cycles only on its own sockets

2022-03-10 Thread Stefano Garzarella
On Thu, Mar 10, 2022 at 10:28:29PM +0900, Jiyong Park wrote: When iterating over sockets using vsock_for_each_connected_socket, make sure that a transport filters out sockets that don't belong to the transport. There actually was an issue caused by this; in a nested VM configuration, destroying

Re: [PATCH 1/2] vsock: each transport cycles only on its own sockets

2022-03-10 Thread Stefano Garzarella
On Thu, Mar 10, 2022 at 08:01:53AM -0500, Michael S. Tsirkin wrote: On Thu, Mar 10, 2022 at 09:54:24PM +0900, Jiyong Park wrote: When iterating over sockets using vsock_for_each_connected_socket, make sure that a transport filters out sockets that don't belong to the transport. There actually

Re: [PATCH] vhost/vsock: reset only the h2g connections upon release

2022-03-10 Thread Stefano Garzarella
On Thu, Mar 10, 2022 at 07:41:54PM +0900, Jiyong Park wrote: Hi Stefano, On Thu, Mar 10, 2022 at 5:59 PM Stefano Garzarella wrote: Hi Jiyong, On Thu, Mar 10, 2022 at 05:18:54PM +0900, Jiyong Park wrote: >Filtering non-h2g connections out when determining orphaned connections. >Oth

Re: [PATCH] vhost/vsock: reset only the h2g connections upon release

2022-03-10 Thread Stefano Garzarella
Hi Jiyong, On Thu, Mar 10, 2022 at 05:18:54PM +0900, Jiyong Park wrote: Filtering non-h2g connections out when determining orphaned connections. Otherwise, in a nested VM configuration, destroying the nested VM (which often involves the closing of /dev/vhost-vsock if there was h2g connections

Re: [PATCH 1/1] vhost: Provide a kernel warning if mutex is held whilst clean-up in progress

2022-03-03 Thread Stefano Garzarella
On Thu, Mar 03, 2022 at 04:01:06PM -0500, Michael S. Tsirkin wrote: On Thu, Mar 03, 2022 at 09:14:36PM +0200, Leon Romanovsky wrote: On Thu, Mar 03, 2022 at 03:19:29PM +, Lee Jones wrote: > All workers/users should be halted before any clean-up should take place. > > Suggested-by: Michael

Re: [virtio-comment] [PATCH v5 1/2] virtio-vsock: add description for datagram type

2022-03-03 Thread Stefano Garzarella
On Thu, Mar 03, 2022 at 03:29:31AM +, Bobby Eshleman wrote: On Wed, Mar 02, 2022 at 05:09:58PM +0100, Stefano Garzarella wrote: Hi Bobby, Sorry for the delay, but I saw these patches today. Please, can you keep me in CC? Hey Stefano, sorry about that. I'm not sure how I lost your CC

Re: [PATCH 1/1] vhost: Protect the virtqueue from being cleared whilst still in use

2022-03-02 Thread Stefano Garzarella
On Wed, Mar 02, 2022 at 04:49:17PM +, Lee Jones wrote: On Wed, 02 Mar 2022, Michael S. Tsirkin wrote: On Wed, Mar 02, 2022 at 05:28:31PM +0100, Stefano Garzarella wrote: > On Wed, Mar 2, 2022 at 3:57 PM Lee Jones wrote: > > > > On Wed, 02 Mar 2022, Michael S

Re: [PATCH 1/1] vhost: Protect the virtqueue from being cleared whilst still in use

2022-03-02 Thread Stefano Garzarella
On Wed, Mar 2, 2022 at 3:57 PM Lee Jones wrote: > > On Wed, 02 Mar 2022, Michael S. Tsirkin wrote: > > > On Wed, Mar 02, 2022 at 01:56:35PM +, Lee Jones wrote: > > > On Wed, 02 Mar 2022, Michael S. Tsirkin wrote: > > > > > > > On Wed, Mar 02, 2022 at 07:54:21AM +, Lee Jones wrote: > > > >

Re: [virtio-comment] [PATCH v5 2/2] virtio-vsock: add mergeable buffer feature bit

2022-03-02 Thread Stefano Garzarella
On Thu, Feb 24, 2022 at 10:15:47PM +, beshleman.dev...@gmail.com wrote: From: Jiang Wang Add support for mergeable buffers for virtio-vsock. Mergeable buffers allow individual large packets to be spread across multiple buffers while still using only a single packet header. This avoids

Re: [virtio-comment] [PATCH v5 1/2] virtio-vsock: add description for datagram type

2022-03-02 Thread Stefano Garzarella
Hi Bobby, Sorry for the delay, but I saw these patches today. Please, can you keep me in CC? On Thu, Feb 24, 2022 at 10:15:46PM +, beshleman.dev...@gmail.com wrote: From: Jiang Wang Add supports for datagram type for virtio-vsock. Datagram sockets are connectionless and unreliable. To

Re: [PATCH 1/1] vhost: Protect the virtqueue from being cleared whilst still in use

2022-03-02 Thread Stefano Garzarella
On Wed, Mar 02, 2022 at 09:50:38AM -0500, Michael S. Tsirkin wrote: On Wed, Mar 02, 2022 at 03:11:21PM +0100, Stefano Garzarella wrote: On Wed, Mar 02, 2022 at 08:35:08AM -0500, Michael S. Tsirkin wrote: > On Wed, Mar 02, 2022 at 10:34:46AM +0100, Stefano Garzarella wrote: > > On We

Re: [PATCH 1/1] vhost: Protect the virtqueue from being cleared whilst still in use

2022-03-02 Thread Stefano Garzarella
On Wed, Mar 02, 2022 at 08:35:08AM -0500, Michael S. Tsirkin wrote: On Wed, Mar 02, 2022 at 10:34:46AM +0100, Stefano Garzarella wrote: On Wed, Mar 02, 2022 at 07:54:21AM +, Lee Jones wrote: > vhost_vsock_handle_tx_kick() already holds the mutex during its call > to vhost_get_v

Re: [PATCH 1/1] vhost: Protect the virtqueue from being cleared whilst still in use

2022-03-02 Thread Stefano Garzarella
ter in vhost_dev_cleanup() the worker should be already stopped, so it shouldn't be necessary to take the mutex. But in order to prevent future issues maybe it's better to take them, so: Reviewed-by: Stefano Garzarella [1] https://syzkaller.appspot.com/bug?id=993d8b5e64393ed9e6a70f9ae4de0119c605a

Re: [syzbot] kernel BUG in vhost_get_vq_desc

2022-03-02 Thread Stefano Garzarella
On Wed, Mar 02, 2022 at 10:18:07AM +0100, Stefano Garzarella wrote: On Wed, Mar 02, 2022 at 08:29:41AM +, Lee Jones wrote: On Fri, 18 Feb 2022, Michael S. Tsirkin wrote: On Thu, Feb 17, 2022 at 05:21:20PM -0800, syzbot wrote: syzbot has found a reproducer for the following issue

Re: [syzbot] kernel BUG in vhost_get_vq_desc

2022-03-02 Thread Stefano Garzarella
On Wed, Mar 02, 2022 at 08:29:41AM +, Lee Jones wrote: On Fri, 18 Feb 2022, Michael S. Tsirkin wrote: On Thu, Feb 17, 2022 at 05:21:20PM -0800, syzbot wrote: > syzbot has found a reproducer for the following issue on: > > HEAD commit:f71077a4d84b Merge tag 'mmc-v5.17-rc1-2' of

Re: [PATCH] vdpa: fix use-after-free on vp_vdpa_remove

2022-03-01 Thread Stefano Garzarella
struct vp_vdpa *vp_vdpa = pci_get_drvdata(pdev); > > - vdpa_unregister_device(_vdpa->vdpa); > vp_modern_remove(_vdpa->mdev); > + vdpa_unregister_device(_vdpa->vdpa); > } > > static struct pci_driver vp_vdpa_driver = { > -- > 2.27.0

[PATCH v2] vhost/vsock: don't check owner in vhost_vsock_stop() while releasing

2022-02-22 Thread Stefano Garzarella
"VSOCK: Introduce vhost_vsock.ko") Cc: sta...@vger.kernel.org Reported-by: syzbot+1e3ea63db39f2b444...@syzkaller.appspotmail.com Reported-and-tested-by: syzbot+3140b17cb44a7b174...@syzkaller.appspotmail.com Signed-off-by: Stefano Garzarella --- v2: - initialized `ret` in vhost_vsock_stop [Dan]

Re: [PATCH] vhost/vsock: don't check owner in vhost_vsock_stop() while releasing

2022-02-22 Thread Stefano Garzarella
On Tue, Feb 22, 2022 at 01:06:12AM +0530, Anirudh Rayabharam wrote: On Mon, Feb 21, 2022 at 07:26:28PM +0100, Stefano Garzarella wrote: On Mon, Feb 21, 2022 at 11:33:11PM +0530, Anirudh Rayabharam wrote: > On Mon, Feb 21, 2022 at 05:44:20PM +0100, Stefano Garzarella wrote: > > On Mo

Re: [PATCH] vhost/vsock: don't check owner in vhost_vsock_stop() while releasing

2022-02-22 Thread Stefano Garzarella
On Tue, Feb 22, 2022 at 08:30:17AM +0300, Dan Carpenter wrote: Hi Stefano, url: https://github.com/0day-ci/linux/commits/Stefano-Garzarella/vhost-vsock-don-t-check-owner-in-vhost_vsock_stop-while-releasing/20220221-195038 base: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git

Re: [PATCH] vhost/vsock: don't check owner in vhost_vsock_stop() while releasing

2022-02-21 Thread Stefano Garzarella
On Mon, Feb 21, 2022 at 11:33:11PM +0530, Anirudh Rayabharam wrote: On Mon, Feb 21, 2022 at 05:44:20PM +0100, Stefano Garzarella wrote: On Mon, Feb 21, 2022 at 09:44:39PM +0530, Anirudh Rayabharam wrote: > On Mon, Feb 21, 2022 at 02:59:30PM +0100, Stefano Garzarella wrote: > > On Mo

Re: [PATCH] tools/virtio: Test virtual address range detection

2022-02-21 Thread Stefano Garzarella
On Mon, Feb 21, 2022 at 04:15:22PM +, David Woodhouse wrote: As things stand, an application which wants to use vhost with a trivial 1:1 mapping of its virtual address space is forced to jump through hoops to detect what the address range might be. The VHOST_SET_MEM_TABLE ioctl helpfully

Re: [PATCH] vhost: handle zero regions in vhost_set_memory

2022-02-21 Thread Stefano Garzarella
On Mon, Feb 21, 2022 at 12:58:51PM +0530, Anirudh Rayabharam wrote: Return early when userspace sends zero regions in the VHOST_SET_MEM_TABLE ioctl. Otherwise, this causes an erroneous entry to be added to the iotlb. This entry has a range size of 0 (due to u64 overflow). This then causes

Re: [PATCH] vhost/vsock: don't check owner in vhost_vsock_stop() while releasing

2022-02-21 Thread Stefano Garzarella
On Mon, Feb 21, 2022 at 09:44:39PM +0530, Anirudh Rayabharam wrote: On Mon, Feb 21, 2022 at 02:59:30PM +0100, Stefano Garzarella wrote: On Mon, Feb 21, 2022 at 12:49 PM Stefano Garzarella wrote: > > vhost_vsock_stop() calls vhost_dev_check_owner() to check the device > ownership. I

Re: [syzbot] INFO: task hung in vhost_work_dev_flush

2022-02-21 Thread Stefano Garzarella
On Mon, Feb 21, 2022 at 09:23:04PM +0530, Anirudh Rayabharam wrote: On Mon, Feb 21, 2022 at 03:12:33PM +0100, Stefano Garzarella wrote: #syz test: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/ f71077a4d84b Patch sent upstream: https://lore.kernel.org/virtualization

Re: [PATCH] vhost/vsock: don't check owner in vhost_vsock_stop() while releasing

2022-02-21 Thread Stefano Garzarella
On Mon, Feb 21, 2022 at 10:03:39AM -0500, Michael S. Tsirkin wrote: On Mon, Feb 21, 2022 at 12:49:16PM +0100, Stefano Garzarella wrote: vhost_vsock_stop() calls vhost_dev_check_owner() to check the device ownership. It expects current->mm to be valid. vhost_vsock_stop() is also cal

Re: [syzbot] INFO: task hung in vhost_work_dev_flush

2022-02-21 Thread Stefano Garzarella
30: 65 48 8b 14 25 00 70mov%gs:0x27000,%rdx > 37: 02 00 > 39: a9 00 01 ff 00 test $0xff0100,%eax > 3e: 74 0e je 0x4e > > > --- > This report is generated by a bot. It may contain errors. > See https://goo.gl/tpsmEJ for more

Re: [PATCH] vhost/vsock: don't check owner in vhost_vsock_stop() while releasing

2022-02-21 Thread Stefano Garzarella
On Mon, Feb 21, 2022 at 12:49 PM Stefano Garzarella wrote: > > vhost_vsock_stop() calls vhost_dev_check_owner() to check the device > ownership. It expects current->mm to be valid. > > vhost_vsock_stop() is also called by vhost_vsock_dev_release() when > the user has not don

Re: [syzbot] general protection fault in vhost_iotlb_itree_first

2022-02-21 Thread Stefano Garzarella
#syz test: https://github.com/stefano-garzarella/linux.git vsock-fix-stop On Sat, Feb 19, 2022 at 01:18:24AM -0800, syzbot wrote: Hello, syzbot found the following issue on: HEAD commit:359303076163 tty: n_tty: do not look ahead for EOL charact.. git tree: upstream console output

[PATCH] vhost/vsock: don't check owner in vhost_vsock_stop() while releasing

2022-02-21 Thread Stefano Garzarella
we're releasing the device, so we should clean it anyway. Let's check the owner only when vhost_vsock_stop() is called by an ioctl. Fixes: 433fc58e6bf2 ("VSOCK: Introduce vhost_vsock.ko") Cc: sta...@vger.kernel.org Reported-by: syzbot+1e3ea63db39f2b444...@syzkaller.appspotmail.com Signed

Re: [syzbot] WARNING in vhost_dev_cleanup (2)

2022-02-21 Thread Stefano Garzarella
On Fri, Feb 18, 2022 at 12:23:10PM -0600, Mike Christie wrote: On 2/18/22 11:53 AM, Mike Christie wrote: On 2/17/22 3:48 AM, Stefano Garzarella wrote: On Thu, Feb 17, 2022 at 8:50 AM Michael S. Tsirkin wrote: On Thu, Feb 17, 2022 at 03:39:48PM +0800, Jason Wang wrote: On Thu, Feb 17, 2022

Re: [PATCH v2] vsock: remove vsock from connected table when connect is interrupted by a signal

2022-02-17 Thread Stefano Garzarella
? TCP_CLOSING : TCP_CLOSE; sock->state = SS_UNCONNECTED; vsock_transport_cancel_pkt(vsk); + vsock_remove_connected(vsk); goto out_wait; } else if (timeout == 0) { err = -ETIMEDOUT; -- 2

Re: [PATCH] virtio: Add definition for VIRTIO_F_NOTIFICATION_DATA feature flag

2022-02-17 Thread Stefano Garzarella
that the driver can pass extra data beyond + * virtqueue identification when sending notifications + */ +#define VIRTIO_F_NOTIFICATION_DATA 38 + #endif /* _UAPI_LINUX_VIRTIO_CONFIG_H */ -- 2.32.0 Reviewed-by: Stefano Garzarella ___ Virtualization mailing list

Re: [syzbot] WARNING in vhost_dev_cleanup (2)

2022-02-17 Thread Stefano Garzarella
On Thu, Feb 17, 2022 at 8:50 AM Michael S. Tsirkin wrote: > > On Thu, Feb 17, 2022 at 03:39:48PM +0800, Jason Wang wrote: > > On Thu, Feb 17, 2022 at 3:36 PM Michael S. Tsirkin wrote: > > > > > > On Thu, Feb 17, 2022 at 03:34:13PM +0800, Jason Wang wrote: > > > > On Thu, Feb 17, 2022 at 10:01

Re: [PATCH] vsock: remove vsock from connected table when connect is interrupted by a signal

2022-02-17 Thread Stefano Garzarella
On Wed, Feb 16, 2022 at 08:14:59PM -0800, Jakub Kicinski wrote: On Wed, 16 Feb 2022 17:11:22 +0100 Stefano Garzarella wrote: On Wed, Feb 16, 2022 at 08:32:22AM -0600, Seth Forshee wrote: >vsock_connect() expects that the socket could already be in the >TCP_ESTABLISHED state when the conn

Re: [PATCH] vsock: remove vsock from connected table when connect is interrupted by a signal

2022-02-16 Thread Stefano Garzarella
eout == 0) { err = -ETIMEDOUT; -- 2.32.0 Thanks for this fix! The patch LGTM: Reviewed-by: Stefano Garzarella @Dave, @Jakub, since we need this also in stable branches, I was going to suggest adding a Fixes tag, but I'm a little confused: the issue seems to have always been there, so fr

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