vsock: add multi-transports support
Subsystems (10)
Stefano Garzarella
maintainercover vsock: add multi-transports support
Hi all,
this series adds the multi-transports support to vsock, following this proposal:
https://www.spinics.net/lists/netdev/msg575792.html
With the multi-transports support, we can use vsock with nested VMs (using also different hypervisors) loading both guest->host and host->guest transports at the same time.
Before this series, vmci-transport supported this behavior but only using VMware hypervisor on L0, L1, etc.
The first 8 patches are cleanups and preparations, maybe some of these can go regardless of this series.
Patch 9 changes the hvs_remote_addr_init(). setting the VMADDR_CID_HOST as remote CID instead of VMADDR_CID_ANY to make the choice of transport to be used work properly. @Dexuan Could this change break anything?
Patch 10 adds multi-transports support.
RFC:
- I'd like to move MODULE_ALIAS_NETPROTO(PF_VSOCK) to af_vsock.c. @Jorgen could this break the VMware products?
- DGRAM sockets are handled as before, I don't know if make sense work on it now, or when another transport will support DGRAM. The big issues here is that we cannot link 1-1 a socket to transport as for stream sockets since DGRAM is not connection-oriented.
Patches 11 and 12 maybe can be merged with patch 10.
Patch 11 maybe is tricky, but it allows to have vmci_transport and vhost_vsock loaded at the same time and it also alleviates the problem of having MODULE_ALIAS_NETPROTO(PF_VSOCK) in vmci_transport.c Patch 12 prevents the transport modules unloading while sockets are assigned to them.
Patch 13 fixes an issue in the bind() logic discoverable only with the new multi-transport support.
I've tested this series with nested KVM (vsock-transport [L0,L1], virtio-transport[L1,L2]) and with VMware (L0) + KVM (L1) (vmci-transport [L0,L1], vhost-transport [L1], virtio-transport[L2]).
@Dexuan please can you test on HyperV that I didn't break anything even without nested VMs?
I'll try to setup a Windows host where to test the nested VMs.
Thanks in advance for your comments and suggestions, Stefano
Stefano Garzarella (13):
vsock/vmci: remove unused VSOCK_DEFAULT_CONNECT_TIMEOUT
vsock: remove vm_sockets_get_local_cid()
vsock: remove include/linux/vm_sockets.h file
vsock: add 'transport' member in the struct vsock_sock vsock/virtio: add transport parameter to the
virtio_transport_reset_no_sock()
vsock: add 'struct vsock_sock *' param to vsock_core_get_transport()
vsock: handle buffer_size sockopts in the core
vsock: move vsock_insert_unbound() in the vsock_create()
hv_sock: set VMADDR_CID_HOST in the hvs_remote_addr_init()
vsock: add multi-transports support
vsock: add 'transport_hg' to handle g2h\h2g transports
vsock: prevent transport modules unloading
vsock: fix bind() behaviour taking care of CID
drivers/vhost/vsock.c | 96 +++--- include/linux/virtio_vsock.h | 18 +- include/linux/vm_sockets.h | 15 - include/net/af_vsock.h | 35 ++- include/net/vsock_addr.h | 2 +- net/vmw_vsock/af_vsock.c | 374 ++++++++++++++++++------ net/vmw_vsock/hyperv_transport.c | 68 ++--- net/vmw_vsock/virtio_transport.c | 177 ++++++----- net/vmw_vsock/virtio_transport_common.c | 127 +++----- net/vmw_vsock/vmci_transport.c | 123 +++----- net/vmw_vsock/vmci_transport.h | 3 - net/vmw_vsock/vmci_transport_notify.h | 1 - 12 files changed, 555 insertions(+), 484 deletions(-) delete mode 100644 include/linux/vm_sockets.h
Signature · 1 line
2.21.0
Stefano Garzarella
maintainerRFC PATCH 1/13 vsock/vmci: remove unused VSOCK_DEFAULT_CONNECT_TIMEOUT
The VSOCK_DEFAULT_CONNECT_TIMEOUT definition was introduced with commit d021c344051af ("VSOCK: Introduce VM Sockets"), but it is never used in the net/vmw_vsock/vmci_transport.c.
VSOCK_DEFAULT_CONNECT_TIMEOUT is used and defined in net/vmw_vsock/af_vsock.c
--- net/vmw_vsock/vmci_transport.c | 5 ----- 1 file changed, 5 deletions(-)
net/vmw_vsock/vmci_transport.c +0 -5
@@ -78,11 +78,6 @@ static int PROTOCOL_OVERRIDE = -1;#define VMCI_TRANSPORT_DEFAULT_QP_SIZE 262144#define VMCI_TRANSPORT_DEFAULT_QP_SIZE_MAX 262144 -/* The default peer timeout indicates how long we will wait for a peer response -* to a control message. -*/ -#define VSOCK_DEFAULT_CONNECT_TIMEOUT (2 * HZ) -/* Helper function to convert from a VMCI error code to a VSock error code. */ static s32 vmci_transport_error_to_vsock_error (s32 vmci_error)
Signature · 1 line
2.21.0
Re: [RFC PATCH 01/13] vsock/vmci: remove unused VSOCK_DEFAULT_CONNECT_TIMEOUT
Quoted 11 lines · Stefano Garzarella
The
VSOCK_DEFAULT_CONNECT_TIMEOUTdefinition was introduced with commitd021c344051af("VSOCK: Introduce VM Sockets"), but it is never used in thenet/vmw_vsock/vmci_transport.c.
VSOCK_DEFAULT_CONNECT_TIMEOUTis used and defined innet/vmw_vsock/af_vsock.cSigned-off-by Stefano Garzarella <[email protected]>--- net/vmw_vsock/vmci_transport.c | 5 ----- 1 file changed, 5 deletions(-)
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [RFC PATCH 01/13] vsock/vmci: remove unused VSOCK_DEFAULT_CONNECT_TIMEOUT
In reply to Stefano GarzarellaQuoted 11 lines · Stefano Garzarella
The
VSOCK_DEFAULT_CONNECT_TIMEOUTdefinition was introduced with commitd021c344051af("VSOCK: Introduce VM Sockets"), but it is never used in thenet/vmw_vsock/vmci_transport.c.
VSOCK_DEFAULT_CONNECT_TIMEOUTis used and defined innet/vmw_vsock/af_vsock.cSigned-off-by Stefano Garzarella <[email protected]>--- net/vmw_vsock/vmci_transport.c | 5 ----- 1 file changed, 5 deletions(-)
Stefano Garzarella
maintainerRFC PATCH 2/13 vsock: remove vm_sockets_get_local_cid()
In reply to Stefano Garzarellavm_sockets_get_local_cid() is only used in virtio_transport_common.c. We can replace it calling the virtio_transport_get_ops() and using the get_local_cid() callback registered by the transport.
--- include/linux/vm_sockets.h | 2 -- net/vmw_vsock/af_vsock.c | 10 ---------- net/vmw_vsock/virtio_transport_common.c | 2 +- 3 files changed, 1 insertion(+), 13 deletions(-)
include/linux/vm_sockets.h +0 -2
@@ -10,6 +10,4 @@#include <uapi/linux/vm_sockets.h> -int vm_sockets_get_local_cid (void ); -#endif /* _VM_SOCKETS_H */
net/vmw_vsock/af_vsock.c +0 -10
@@ -129,16 +129,6 @@ static struct proto vsock_proto = {static const struct vsock_transport *transport;static DEFINE_MUTEX (vsock_register_mutex); -/**** EXPORTS ****/ - -/* Get the ID of the local context. This is transport dependent. */ - -int vm_sockets_get_local_cid (void ) -{ -return transport->get_local_cid (); -} -EXPORT_SYMBOL_GPL (vm_sockets_get_local_cid); -/**** UTILS ****/ /* Each bound VSocket is stored in the bind hash table and each connected
net/vmw_vsock/virtio_transport_common.c +1 -1
@@ -168,7 +168,7 @@ static int virtio_transport_send_pkt_info(struct vsock_sock *vsk,struct virtio_vsock_pkt *pkt;u32 pkt_len = info->pkt_len; - src_cid =vm_sockets_get_local_cid (); + src_cid =virtio_transport_get_ops ()->transport.get_local_cid (); src_port = vsk->local_addr.svm_port;if (!info->remote_cid) { dst_cid = vsk->remote_addr.svm_cid;
Signature · 1 line
2.21.0
Stefano Garzarella
maintainerRFC PATCH 2/13 vsock: remove vm_sockets_get_local_cid()
In reply to Stefano Garzarellavm_sockets_get_local_cid() is only used in virtio_transport_common.c. We can replace it calling the virtio_transport_get_ops() and using the get_local_cid() callback registered by the transport.
--- include/linux/vm_sockets.h | 2 -- net/vmw_vsock/af_vsock.c | 10 ---------- net/vmw_vsock/virtio_transport_common.c | 2 +- 3 files changed, 1 insertion(+), 13 deletions(-)
include/linux/vm_sockets.h +0 -2
@@ -10,6 +10,4 @@#include <uapi/linux/vm_sockets.h> -int vm_sockets_get_local_cid (void ); -#endif /* _VM_SOCKETS_H */
net/vmw_vsock/af_vsock.c +0 -10
@@ -129,16 +129,6 @@ static struct proto vsock_proto = {static const struct vsock_transport *transport;static DEFINE_MUTEX (vsock_register_mutex); -/**** EXPORTS ****/ - -/* Get the ID of the local context. This is transport dependent. */ - -int vm_sockets_get_local_cid (void ) -{ -return transport->get_local_cid (); -} -EXPORT_SYMBOL_GPL (vm_sockets_get_local_cid); -/**** UTILS ****/ /* Each bound VSocket is stored in the bind hash table and each connected
net/vmw_vsock/virtio_transport_common.c +1 -1
@@ -168,7 +168,7 @@ static int virtio_transport_send_pkt_info(struct vsock_sock *vsk,struct virtio_vsock_pkt *pkt;u32 pkt_len = info->pkt_len; - src_cid =vm_sockets_get_local_cid (); + src_cid =virtio_transport_get_ops ()->transport.get_local_cid (); src_port = vsk->local_addr.svm_port;if (!info->remote_cid) { dst_cid = vsk->remote_addr.svm_cid;
Signature · 1 line
2.21.0
Re: [RFC PATCH 02/13] vsock: remove vm_sockets_get_local_cid()
Quoted 10 lines · Stefano Garzarella
vm_sockets_get_local_cid()is only used invirtio_transport_common.c. We can replace it calling thevirtio_transport_get_ops()and using theget_local_cid()callback registered by the transport.Signed-off-by Stefano Garzarella <[email protected]>--- include/linux/vm_sockets.h | 2 -- net/vmw_vsock/af_vsock.c | 10 ---------- net/vmw_vsock/virtio_transport_common.c | 2 +- 3 files changed, 1 insertion(+), 13 deletions(-)
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [RFC PATCH 02/13] vsock: remove vm_sockets_get_local_cid()
In reply to Stefano GarzarellaQuoted 10 lines · Stefano Garzarella
vm_sockets_get_local_cid()is only used invirtio_transport_common.c. We can replace it calling thevirtio_transport_get_ops()and using theget_local_cid()callback registered by the transport.Signed-off-by Stefano Garzarella <[email protected]>--- include/linux/vm_sockets.h | 2 -- net/vmw_vsock/af_vsock.c | 10 ---------- net/vmw_vsock/virtio_transport_common.c | 2 +- 3 files changed, 1 insertion(+), 13 deletions(-)
Stefano Garzarella
maintainerRFC PATCH 3/13 vsock: remove include/linux/vm_sockets.h file
In reply to Stefano GarzarellaThis header file now only includes the "uapi/linux/vm_sockets.h". We can include directly it when needed.
--- include/linux/vm_sockets.h | 13 ------------- include/net/af_vsock.h | 2 +- include/net/vsock_addr.h | 2 +- net/vmw_vsock/vmci_transport_notify.h | 1 - 4 files changed, 2 insertions(+), 16 deletions(-) delete mode 100644 include/linux/vm_sockets.h
include/linux/vm_sockets.h deleted +0 -13
@@ -1,13 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* -* VMware vSockets Driver -* -* Copyright (C) 2007-2013 VMware, Inc. All rights reserved. -*/ - -#ifndef _VM_SOCKETS_H -#define _VM_SOCKETS_H - -#include <uapi/linux/vm_sockets.h> - -#endif /* _VM_SOCKETS_H */
include/net/af_vsock.h +1 -1
@@ -10,7 +10,7 @@#include <linux/kernel.h> #include <linux/workqueue.h> -#include <linux/vm_sockets.h> +#include <uapi/linux/vm_sockets.h> #include "vsock_addr.h"
include/net/vsock_addr.h +1 -1
@@ -8,7 +8,7 @@#ifndef _VSOCK_ADDR_H_#define _VSOCK_ADDR_H_ -#include <linux/vm_sockets.h> +#include <uapi/linux/vm_sockets.h> void vsock_addr_init (struct sockaddr_vm *addr,u32 cid,u32 port);int vsock_addr_validate (const struct sockaddr_vm *addr);
net/vmw_vsock/vmci_transport_notify.h +0 -1
@@ -11,7 +11,6 @@#include <linux/types.h> #include <linux/vmw_vmci_defs.h> #include <linux/vmw_vmci_api.h> -#include <linux/vm_sockets.h> #include "vmci_transport.h"
Signature · 1 line
2.21.0
Stefano Garzarella
maintainerRFC PATCH 3/13 vsock: remove include/linux/vm_sockets.h file
In reply to Stefano GarzarellaThis header file now only includes the "uapi/linux/vm_sockets.h". We can include directly it when needed.
--- include/linux/vm_sockets.h | 13 ------------- include/net/af_vsock.h | 2 +- include/net/vsock_addr.h | 2 +- net/vmw_vsock/vmci_transport_notify.h | 1 - 4 files changed, 2 insertions(+), 16 deletions(-) delete mode 100644 include/linux/vm_sockets.h
include/linux/vm_sockets.h deleted +0 -13
@@ -1,13 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* -* VMware vSockets Driver -* -* Copyright (C) 2007-2013 VMware, Inc. All rights reserved. -*/ - -#ifndef _VM_SOCKETS_H -#define _VM_SOCKETS_H - -#include <uapi/linux/vm_sockets.h> - -#endif /* _VM_SOCKETS_H */
include/net/af_vsock.h +1 -1
@@ -10,7 +10,7 @@#include <linux/kernel.h> #include <linux/workqueue.h> -#include <linux/vm_sockets.h> +#include <uapi/linux/vm_sockets.h> #include "vsock_addr.h"
include/net/vsock_addr.h +1 -1
@@ -8,7 +8,7 @@#ifndef _VSOCK_ADDR_H_#define _VSOCK_ADDR_H_ -#include <linux/vm_sockets.h> +#include <uapi/linux/vm_sockets.h> void vsock_addr_init (struct sockaddr_vm *addr,u32 cid,u32 port);int vsock_addr_validate (const struct sockaddr_vm *addr);
net/vmw_vsock/vmci_transport_notify.h +0 -1
@@ -11,7 +11,6 @@#include <linux/types.h> #include <linux/vmw_vmci_defs.h> #include <linux/vmw_vmci_api.h> -#include <linux/vm_sockets.h> #include "vmci_transport.h"
Signature · 1 line
2.21.0
Re: [RFC PATCH 03/13] vsock: remove include/linux/vm_sockets.h file
Quoted 11 lines · Stefano Garzarella
This header file now only includes the "
uapi/linux/vm_sockets.h". We can include directly it when needed.Signed-off-by Stefano Garzarella <[email protected]>--- include/linux/vm_sockets.h | 13 ------------- include/net/af_vsock.h | 2 +- include/net/vsock_addr.h | 2 +- net/vmw_vsock/vmci_transport_notify.h | 1 - 4 files changed, 2 insertions(+), 16 deletions(-) delete mode 100644 include/linux/vm_sockets.h
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [RFC PATCH 03/13] vsock: remove include/linux/vm_sockets.h file
In reply to Stefano GarzarellaQuoted 11 lines · Stefano Garzarella
This header file now only includes the "
uapi/linux/vm_sockets.h". We can include directly it when needed.Signed-off-by Stefano Garzarella <[email protected]>--- include/linux/vm_sockets.h | 13 ------------- include/net/af_vsock.h | 2 +- include/net/vsock_addr.h | 2 +- net/vmw_vsock/vmci_transport_notify.h | 1 - 4 files changed, 2 insertions(+), 16 deletions(-) delete mode 100644 include/linux/vm_sockets.h
Stefano Garzarella
maintainerRFC PATCH 4/13 vsock: add 'transport' member in the struct vsock_sock
In reply to Stefano GarzarellaAs a preparation to support multiple transports, this patch adds the 'transport' member at the 'struct vsock_sock'. This new field is initialized during the creation in the __vsock_create() function.
This patch also renames the global 'transport' pointer to 'transport_single', since for now we're only supporting a single transport registered at run-time.
--- include/net/af_vsock.h | 1 + net/vmw_vsock/af_vsock.c | 56 +++++++++++++++++++++++++++------------- 2 files changed, 39 insertions(+), 18 deletions(-)
include/net/af_vsock.h +1 -0
@@ -27,6 +27,7 @@ extern spinlock_t vsock_table_lock;struct vsock_sock {/* sk must be the first member. */ struct sock sk; +const struct vsock_transport *transport;struct sockaddr_vm local_addr;struct sockaddr_vm remote_addr;/* Links for the global tables of bound and connected sockets. */
net/vmw_vsock/af_vsock.c +38 -18
247 lines not on this page · raw message
Signature · 1 line
2.21.0
Stefano Garzarella
maintainerRFC PATCH 4/13 vsock: add 'transport' member in the struct vsock_sock
In reply to Stefano GarzarellaAs a preparation to support multiple transports, this patch adds the 'transport' member at the 'struct vsock_sock'. This new field is initialized during the creation in the __vsock_create() function.
This patch also renames the global 'transport' pointer to 'transport_single', since for now we're only supporting a single transport registered at run-time.
--- include/net/af_vsock.h | 1 + net/vmw_vsock/af_vsock.c | 56 +++++++++++++++++++++++++++------------- 2 files changed, 39 insertions(+), 18 deletions(-)
include/net/af_vsock.h +1 -0
@@ -27,6 +27,7 @@ extern spinlock_t vsock_table_lock;struct vsock_sock {/* sk must be the first member. */ struct sock sk; +const struct vsock_transport *transport;struct sockaddr_vm local_addr;struct sockaddr_vm remote_addr;/* Links for the global tables of bound and connected sockets. */
net/vmw_vsock/af_vsock.c +38 -18
247 lines not on this page · raw message
Signature · 1 line
2.21.0
Re: [RFC PATCH 04/13] vsock: add 'transport' member in the struct vsock_sock
Quoted 9 lines · Stefano Garzarella
As a preparation to support multiple transports, this patch adds the 'transport' member at the 'struct
vsock_sock'. This new field is initialized during the creation in the__vsock_create()function.This patch also renames the global 'transport' pointer to '
transport_single', since for now we're only supporting a single transport registered at run-time.
Quoted 5 lines
Signed-off-by Stefano Garzarella <[email protected]>--- include/net/af_vsock.h | 1 + net/vmw_vsock/af_vsock.c | 56 +++++++++++++++++++++++++++------------- 2 files changed, 39 insertions(+), 18 deletions(-)
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [RFC PATCH 04/13] vsock: add 'transport' member in the struct vsock_sock
In reply to Stefano GarzarellaQuoted 9 lines · Stefano Garzarella
As a preparation to support multiple transports, this patch adds the 'transport' member at the 'struct
vsock_sock'. This new field is initialized during the creation in the__vsock_create()function.This patch also renames the global 'transport' pointer to '
transport_single', since for now we're only supporting a single transport registered at run-time.
Quoted 5 lines
Signed-off-by Stefano Garzarella <[email protected]>--- include/net/af_vsock.h | 1 + net/vmw_vsock/af_vsock.c | 56 +++++++++++++++++++++++++++------------- 2 files changed, 39 insertions(+), 18 deletions(-)
Stefano Garzarella
maintainerRFC PATCH 5/13 vsock/virtio: add transport parameter to the virtio_transport_reset_no_sock()
In reply to Stefano GarzarellaWe are going to add 'struct vsock_sock *' parameter to virtio_transport_get_ops().
In some cases, like in the virtio_transport_reset_no_sock(), we don't have any socket assigned to the packet received, so we can't use the virtio_transport_get_ops().
In order to allow virtio_transport_reset_no_sock() to use the '.send_pkt' callback from the 'vhost_transport' or 'virtio_transport', we add the 'struct virtio_transport *' to it and to its caller:virtio_transport_recv_pkt().
We moved the 'vhost_transport' and 'virtio_transport' definition, to pass their address to the virtio_transport_recv_pkt().
--- drivers/vhost/vsock.c | 94 +++++++------- include/linux/virtio_vsock.h | 3 +- net/vmw_vsock/virtio_transport.c | 160 ++++++++++++------------ net/vmw_vsock/virtio_transport_common.c | 12 +- 4 files changed, 135 insertions(+), 134 deletions(-)
drivers/vhost/vsock.c +47 -47
@@ -384,6 +384,52 @@ static bool vhost_vsock_more_replies(struct vhost_vsock *vsock)return val < vq->num; } +static struct virtio_transport vhost_transport = { + .transport = { + .get_local_cid = vhost_transport_get_local_cid, + + .init = virtio_transport_do_socket_init, + .destruct = virtio_transport_destruct, + .release = virtio_transport_release, + .connect = virtio_transport_connect, + .shutdown = virtio_transport_shutdown, + .cancel_pkt = vhost_transport_cancel_pkt, + + .dgram_enqueue = virtio_transport_dgram_enqueue, + .dgram_dequeue = virtio_transport_dgram_dequeue, + .dgram_bind = virtio_transport_dgram_bind, + .dgram_allow = virtio_transport_dgram_allow, + + .stream_enqueue = virtio_transport_stream_enqueue, + .stream_dequeue = virtio_transport_stream_dequeue, + .stream_has_data = virtio_transport_stream_has_data, + .stream_has_space = virtio_transport_stream_has_space, + .stream_rcvhiwat = virtio_transport_stream_rcvhiwat, + .stream_is_active = virtio_transport_stream_is_active, + .stream_allow = virtio_transport_stream_allow, + + .notify_poll_in = virtio_transport_notify_poll_in, + .notify_poll_out = virtio_transport_notify_poll_out, + .notify_recv_init = virtio_transport_notify_recv_init, + .notify_recv_pre_block = virtio_transport_notify_recv_pre_block, + .notify_recv_pre_dequeue = virtio_transport_notify_recv_pre_dequeue, + .notify_recv_post_dequeue = virtio_transport_notify_recv_post_dequeue, + .notify_send_init = virtio_transport_notify_send_init, + .notify_send_pre_block = virtio_transport_notify_send_pre_block, + .notify_send_pre_enqueue = virtio_transport_notify_send_pre_enqueue, + .notify_send_post_enqueue = virtio_transport_notify_send_post_enqueue, + + .set_buffer_size = virtio_transport_set_buffer_size, + .set_min_buffer_size = virtio_transport_set_min_buffer_size, + .set_max_buffer_size = virtio_transport_set_max_buffer_size, + .get_buffer_size = virtio_transport_get_buffer_size, + .get_min_buffer_size = virtio_transport_get_min_buffer_size, + .get_max_buffer_size = virtio_transport_get_max_buffer_size, + }, + + .send_pkt = vhost_transport_send_pkt, +}; +static void vhost_vsock_handle_tx_kick (struct vhost_work *work) { struct vhost_virtqueue *vq = container_of(work, struct vhost_virtqueue,
@@ -438,7 +484,7 @@ static void vhost_vsock_handle_tx_kick(struct vhost_work *work)/* Only accept correctly addressed packets */ if (le64_to_cpu (pkt->hdr.src_cid) == vsock->guest_cid) -virtio_transport_recv_pkt (pkt); +virtio_transport_recv_pkt (&vhost_transport, pkt);else virtio_transport_free_pkt (pkt);
@@ -786,52 +832,6 @@ static struct miscdevice vhost_vsock_misc = { .fops = &vhost_vsock_fops, }; -static struct virtio_transport vhost_transport = { - .transport = { - .get_local_cid = vhost_transport_get_local_cid, - - .init = virtio_transport_do_socket_init, - .destruct = virtio_transport_destruct, - .release = virtio_transport_release, - .connect = virtio_transport_connect, - .shutdown = virtio_transport_shutdown, - .cancel_pkt = vhost_transport_cancel_pkt, - - .dgram_enqueue = virtio_transport_dgram_enqueue, - .dgram_dequeue = virtio_transport_dgram_dequeue, - .dgram_bind = virtio_transport_dgram_bind, - .dgram_allow = virtio_transport_dgram_allow, - - .stream_enqueue = virtio_transport_stream_enqueue, - .stream_dequeue = virtio_transport_stream_dequeue, - .stream_has_data = virtio_transport_stream_has_data, - .stream_has_space = virtio_transport_stream_has_space, - .stream_rcvhiwat = virtio_transport_stream_rcvhiwat, - .stream_is_active = virtio_transport_stream_is_active, - .stream_allow = virtio_transport_stream_allow, - - .notify_poll_in = virtio_transport_notify_poll_in, - .notify_poll_out = virtio_transport_notify_poll_out, - .notify_recv_init = virtio_transport_notify_recv_init, - .notify_recv_pre_block = virtio_transport_notify_recv_pre_block, - .notify_recv_pre_dequeue = virtio_transport_notify_recv_pre_dequeue, - .notify_recv_post_dequeue = virtio_transport_notify_recv_post_dequeue, - .notify_send_init = virtio_transport_notify_send_init, - .notify_send_pre_block = virtio_transport_notify_send_pre_block, - .notify_send_pre_enqueue = virtio_transport_notify_send_pre_enqueue, - .notify_send_post_enqueue = virtio_transport_notify_send_post_enqueue, - - .set_buffer_size = virtio_transport_set_buffer_size, - .set_min_buffer_size = virtio_transport_set_min_buffer_size, - .set_max_buffer_size = virtio_transport_set_max_buffer_size, - .get_buffer_size = virtio_transport_get_buffer_size, - .get_min_buffer_size = virtio_transport_get_min_buffer_size, - .get_max_buffer_size = virtio_transport_get_max_buffer_size, - }, - - .send_pkt = vhost_transport_send_pkt, -}; -static int __init vhost_vsock_init (void ) {int ret;
include/linux/virtio_vsock.h +2 -1
@@ -151,7 +151,8 @@ virtio_transport_dgram_enqueue(struct vsock_sock *vsk,void virtio_transport_destruct (struct vsock_sock *vsk); -void virtio_transport_recv_pkt (struct virtio_vsock_pkt *pkt); +void virtio_transport_recv_pkt (struct virtio_transport *t, +struct virtio_vsock_pkt *pkt);void virtio_transport_free_pkt (struct virtio_vsock_pkt *pkt);void virtio_transport_inc_tx_pkt (struct virtio_vsock_sock *vvs,struct virtio_vsock_pkt *pkt);u32 virtio_transport_get_credit (struct virtio_vsock_sock *vvs,u32 wanted);
net/vmw_vsock/virtio_transport.c +80 -80
178 lines not on this page · raw message
net/vmw_vsock/virtio_transport_common.c +6 -6
@@ -689,9 +689,9 @@ static int virtio_transport_reset(struct vsock_sock *vsk,/* Normally packets are associated with a socket. There may be no socket if an * attempt was made to connect to a socket that does not exist. */ -static int virtio_transport_reset_no_sock (struct virtio_vsock_pkt *pkt) +static int virtio_transport_reset_no_sock (const struct virtio_transport *t, +struct virtio_vsock_pkt *pkt) { -const struct virtio_transport *t;struct virtio_vsock_pkt *reply;struct virtio_vsock_pkt_info info = { .op =VIRTIO_VSOCK_OP_RST ,
@@ -711,7 +711,6 @@ static int virtio_transport_reset_no_sock(struct virtio_vsock_pkt *pkt)if (!reply)return -ENOMEM ; - t =virtio_transport_get_ops ();if (!t) {virtio_transport_free_pkt (reply);return -ENOTCONN ;
@@ -1047,7 +1046,8 @@ static bool virtio_transport_space_update(struct sock *sk,/* We are under the virtio-vsock's vsock->rx_lock or vhost-vsock's vq->mutex * lock. */ -void virtio_transport_recv_pkt (struct virtio_vsock_pkt *pkt) +void virtio_transport_recv_pkt (struct virtio_transport *t, +struct virtio_vsock_pkt *pkt) {struct sockaddr_vm src, dst;struct vsock_sock *vsk;
@@ -1069,7 +1069,7 @@ void virtio_transport_recv_pkt(struct virtio_vsock_pkt *pkt) le32_to_cpu(pkt->hdr.fwd_cnt));if (le16_to_cpu (pkt->hdr.type) !=VIRTIO_VSOCK_TYPE_STREAM ) { - (void )virtio_transport_reset_no_sock (pkt); + (void )virtio_transport_reset_no_sock (t, pkt); goto free_pkt; }
@@ -1080,7 +1080,7 @@ void virtio_transport_recv_pkt(struct virtio_vsock_pkt *pkt)if (!sk) { sk =vsock_find_bound_socket (&dst);if (!sk) { - (void )virtio_transport_reset_no_sock (pkt); + (void )virtio_transport_reset_no_sock (t, pkt); goto free_pkt; } }
Signature · 1 line
2.21.0
Stefano Garzarella
maintainerRFC PATCH 5/13 vsock/virtio: add transport parameter to the virtio_transport_reset_no_sock()
In reply to Stefano GarzarellaWe are going to add 'struct vsock_sock *' parameter to virtio_transport_get_ops().
In some cases, like in the virtio_transport_reset_no_sock(), we don't have any socket assigned to the packet received, so we can't use the virtio_transport_get_ops().
In order to allow virtio_transport_reset_no_sock() to use the '.send_pkt' callback from the 'vhost_transport' or 'virtio_transport', we add the 'struct virtio_transport *' to it and to its caller:virtio_transport_recv_pkt().
We moved the 'vhost_transport' and 'virtio_transport' definition, to pass their address to the virtio_transport_recv_pkt().
--- drivers/vhost/vsock.c | 94 +++++++------- include/linux/virtio_vsock.h | 3 +- net/vmw_vsock/virtio_transport.c | 160 ++++++++++++------------ net/vmw_vsock/virtio_transport_common.c | 12 +- 4 files changed, 135 insertions(+), 134 deletions(-)
drivers/vhost/vsock.c +47 -47
@@ -384,6 +384,52 @@ static bool vhost_vsock_more_replies(struct vhost_vsock *vsock)return val < vq->num; } +static struct virtio_transport vhost_transport = { + .transport = { + .get_local_cid = vhost_transport_get_local_cid, + + .init = virtio_transport_do_socket_init, + .destruct = virtio_transport_destruct, + .release = virtio_transport_release, + .connect = virtio_transport_connect, + .shutdown = virtio_transport_shutdown, + .cancel_pkt = vhost_transport_cancel_pkt, + + .dgram_enqueue = virtio_transport_dgram_enqueue, + .dgram_dequeue = virtio_transport_dgram_dequeue, + .dgram_bind = virtio_transport_dgram_bind, + .dgram_allow = virtio_transport_dgram_allow, + + .stream_enqueue = virtio_transport_stream_enqueue, + .stream_dequeue = virtio_transport_stream_dequeue, + .stream_has_data = virtio_transport_stream_has_data, + .stream_has_space = virtio_transport_stream_has_space, + .stream_rcvhiwat = virtio_transport_stream_rcvhiwat, + .stream_is_active = virtio_transport_stream_is_active, + .stream_allow = virtio_transport_stream_allow, + + .notify_poll_in = virtio_transport_notify_poll_in, + .notify_poll_out = virtio_transport_notify_poll_out, + .notify_recv_init = virtio_transport_notify_recv_init, + .notify_recv_pre_block = virtio_transport_notify_recv_pre_block, + .notify_recv_pre_dequeue = virtio_transport_notify_recv_pre_dequeue, + .notify_recv_post_dequeue = virtio_transport_notify_recv_post_dequeue, + .notify_send_init = virtio_transport_notify_send_init, + .notify_send_pre_block = virtio_transport_notify_send_pre_block, + .notify_send_pre_enqueue = virtio_transport_notify_send_pre_enqueue, + .notify_send_post_enqueue = virtio_transport_notify_send_post_enqueue, + + .set_buffer_size = virtio_transport_set_buffer_size, + .set_min_buffer_size = virtio_transport_set_min_buffer_size, + .set_max_buffer_size = virtio_transport_set_max_buffer_size, + .get_buffer_size = virtio_transport_get_buffer_size, + .get_min_buffer_size = virtio_transport_get_min_buffer_size, + .get_max_buffer_size = virtio_transport_get_max_buffer_size, + }, + + .send_pkt = vhost_transport_send_pkt, +}; +static void vhost_vsock_handle_tx_kick (struct vhost_work *work) { struct vhost_virtqueue *vq = container_of(work, struct vhost_virtqueue,
@@ -438,7 +484,7 @@ static void vhost_vsock_handle_tx_kick(struct vhost_work *work)/* Only accept correctly addressed packets */ if (le64_to_cpu (pkt->hdr.src_cid) == vsock->guest_cid) -virtio_transport_recv_pkt (pkt); +virtio_transport_recv_pkt (&vhost_transport, pkt);else virtio_transport_free_pkt (pkt);
@@ -786,52 +832,6 @@ static struct miscdevice vhost_vsock_misc = { .fops = &vhost_vsock_fops, }; -static struct virtio_transport vhost_transport = { - .transport = { - .get_local_cid = vhost_transport_get_local_cid, - - .init = virtio_transport_do_socket_init, - .destruct = virtio_transport_destruct, - .release = virtio_transport_release, - .connect = virtio_transport_connect, - .shutdown = virtio_transport_shutdown, - .cancel_pkt = vhost_transport_cancel_pkt, - - .dgram_enqueue = virtio_transport_dgram_enqueue, - .dgram_dequeue = virtio_transport_dgram_dequeue, - .dgram_bind = virtio_transport_dgram_bind, - .dgram_allow = virtio_transport_dgram_allow, - - .stream_enqueue = virtio_transport_stream_enqueue, - .stream_dequeue = virtio_transport_stream_dequeue, - .stream_has_data = virtio_transport_stream_has_data, - .stream_has_space = virtio_transport_stream_has_space, - .stream_rcvhiwat = virtio_transport_stream_rcvhiwat, - .stream_is_active = virtio_transport_stream_is_active, - .stream_allow = virtio_transport_stream_allow, - - .notify_poll_in = virtio_transport_notify_poll_in, - .notify_poll_out = virtio_transport_notify_poll_out, - .notify_recv_init = virtio_transport_notify_recv_init, - .notify_recv_pre_block = virtio_transport_notify_recv_pre_block, - .notify_recv_pre_dequeue = virtio_transport_notify_recv_pre_dequeue, - .notify_recv_post_dequeue = virtio_transport_notify_recv_post_dequeue, - .notify_send_init = virtio_transport_notify_send_init, - .notify_send_pre_block = virtio_transport_notify_send_pre_block, - .notify_send_pre_enqueue = virtio_transport_notify_send_pre_enqueue, - .notify_send_post_enqueue = virtio_transport_notify_send_post_enqueue, - - .set_buffer_size = virtio_transport_set_buffer_size, - .set_min_buffer_size = virtio_transport_set_min_buffer_size, - .set_max_buffer_size = virtio_transport_set_max_buffer_size, - .get_buffer_size = virtio_transport_get_buffer_size, - .get_min_buffer_size = virtio_transport_get_min_buffer_size, - .get_max_buffer_size = virtio_transport_get_max_buffer_size, - }, - - .send_pkt = vhost_transport_send_pkt, -}; -static int __init vhost_vsock_init (void ) {int ret;
include/linux/virtio_vsock.h +2 -1
@@ -151,7 +151,8 @@ virtio_transport_dgram_enqueue(struct vsock_sock *vsk,void virtio_transport_destruct (struct vsock_sock *vsk); -void virtio_transport_recv_pkt (struct virtio_vsock_pkt *pkt); +void virtio_transport_recv_pkt (struct virtio_transport *t, +struct virtio_vsock_pkt *pkt);void virtio_transport_free_pkt (struct virtio_vsock_pkt *pkt);void virtio_transport_inc_tx_pkt (struct virtio_vsock_sock *vvs,struct virtio_vsock_pkt *pkt);u32 virtio_transport_get_credit (struct virtio_vsock_sock *vvs,u32 wanted);
net/vmw_vsock/virtio_transport.c +80 -80
178 lines not on this page · raw message
net/vmw_vsock/virtio_transport_common.c +6 -6
@@ -689,9 +689,9 @@ static int virtio_transport_reset(struct vsock_sock *vsk,/* Normally packets are associated with a socket. There may be no socket if an * attempt was made to connect to a socket that does not exist. */ -static int virtio_transport_reset_no_sock (struct virtio_vsock_pkt *pkt) +static int virtio_transport_reset_no_sock (const struct virtio_transport *t, +struct virtio_vsock_pkt *pkt) { -const struct virtio_transport *t;struct virtio_vsock_pkt *reply;struct virtio_vsock_pkt_info info = { .op =VIRTIO_VSOCK_OP_RST ,
@@ -711,7 +711,6 @@ static int virtio_transport_reset_no_sock(struct virtio_vsock_pkt *pkt)if (!reply)return -ENOMEM ; - t =virtio_transport_get_ops ();if (!t) {virtio_transport_free_pkt (reply);return -ENOTCONN ;
@@ -1047,7 +1046,8 @@ static bool virtio_transport_space_update(struct sock *sk,/* We are under the virtio-vsock's vsock->rx_lock or vhost-vsock's vq->mutex * lock. */ -void virtio_transport_recv_pkt (struct virtio_vsock_pkt *pkt) +void virtio_transport_recv_pkt (struct virtio_transport *t, +struct virtio_vsock_pkt *pkt) {struct sockaddr_vm src, dst;struct vsock_sock *vsk;
@@ -1069,7 +1069,7 @@ void virtio_transport_recv_pkt(struct virtio_vsock_pkt *pkt) le32_to_cpu(pkt->hdr.fwd_cnt));if (le16_to_cpu (pkt->hdr.type) !=VIRTIO_VSOCK_TYPE_STREAM ) { - (void )virtio_transport_reset_no_sock (pkt); + (void )virtio_transport_reset_no_sock (t, pkt); goto free_pkt; }
@@ -1080,7 +1080,7 @@ void virtio_transport_recv_pkt(struct virtio_vsock_pkt *pkt)if (!sk) { sk =vsock_find_bound_socket (&dst);if (!sk) { - (void )virtio_transport_reset_no_sock (pkt); + (void )virtio_transport_reset_no_sock (t, pkt); goto free_pkt; } }
Signature · 1 line
2.21.0
Re: [RFC PATCH 05/13] vsock/virtio: add transport parameter to the virtio_transport_reset_no_sock()
Quoted 15 lines · Stefano Garzarella
We are going to add 'struct
vsock_sock*' parameter tovirtio_transport_get_ops().In some cases, like in the
virtio_transport_reset_no_sock(), we don't have any socket assigned to the packet received, so we can't use thevirtio_transport_get_ops().In order to allow
virtio_transport_reset_no_sock()to use the '.send_pkt' callback from the 'vhost_transport' or 'virtio_transport', we add the 'structvirtio_transport*' to it and to its caller:virtio_transport_recv_pkt().We moved the '
vhost_transport' and 'virtio_transport' definition, to pass their address to thevirtio_transport_recv_pkt().
Quoted 7 lines
Signed-off-by Stefano Garzarella <[email protected]>--- drivers/vhost/vsock.c | 94 +++++++------- include/linux/virtio_vsock.h | 3 +- net/vmw_vsock/virtio_transport.c | 160 ++++++++++++------------ net/vmw_vsock/virtio_transport_common.c | 12 +- 4 files changed, 135 insertions(+), 134 deletions(-)
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [RFC PATCH 05/13] vsock/virtio: add transport parameter to the virtio_transport_reset_no_sock()
In reply to Stefano GarzarellaQuoted 15 lines · Stefano Garzarella
We are going to add 'struct
vsock_sock*' parameter tovirtio_transport_get_ops().In some cases, like in the
virtio_transport_reset_no_sock(), we don't have any socket assigned to the packet received, so we can't use thevirtio_transport_get_ops().In order to allow
virtio_transport_reset_no_sock()to use the '.send_pkt' callback from the 'vhost_transport' or 'virtio_transport', we add the 'structvirtio_transport*' to it and to its caller:virtio_transport_recv_pkt().We moved the '
vhost_transport' and 'virtio_transport' definition, to pass their address to thevirtio_transport_recv_pkt().
Quoted 7 lines
Signed-off-by Stefano Garzarella <[email protected]>--- drivers/vhost/vsock.c | 94 +++++++------- include/linux/virtio_vsock.h | 3 +- net/vmw_vsock/virtio_transport.c | 160 ++++++++++++------------ net/vmw_vsock/virtio_transport_common.c | 12 +- 4 files changed, 135 insertions(+), 134 deletions(-)
Stefano Garzarella
maintainerRFC PATCH 6/13 vsock: add 'struct vsock_sock *' param to vsock_core_get_transport()
In reply to Stefano GarzarellaSince now the 'struct vsock_sock' object contains a pointer to the transport, this patch adds a parameter to the vsock_core_get_transport() to return the right transport assigned to the socket.
This patch modifies also the virtio_transport_get_ops(), that uses the vsock_core_get_transport(), adding the 'struct vsock_sock *' parameter.
--- include/net/af_vsock.h | 2 +- net/vmw_vsock/af_vsock.c | 4 ++-- net/vmw_vsock/virtio_transport_common.c | 9 +++++---- 3 files changed, 8 insertions(+), 7 deletions(-)
include/net/af_vsock.h +1 -1
@@ -166,7 +166,7 @@ static inline int vsock_core_init(const struct vsock_transport *t)void vsock_core_exit (void );/* The transport may downcast this to access transport-specific functions */ -const struct vsock_transport *vsock_core_get_transport (void ); +const struct vsock_transport *vsock_core_get_transport (struct vsock_sock *vsk);/**** UTILS ****/
net/vmw_vsock/af_vsock.c +2 -2
@@ -1993,12 +1993,12 @@ void vsock_core_exit(void) }EXPORT_SYMBOL_GPL (vsock_core_exit); -const struct vsock_transport *vsock_core_get_transport (void ) +const struct vsock_transport *vsock_core_get_transport (struct vsock_sock *vsk) {/* vsock_register_mutex not taken since only the transport uses this * function and only while registered. */ -return transport_single; +return vsk->transport; }EXPORT_SYMBOL_GPL (vsock_core_get_transport);
net/vmw_vsock/virtio_transport_common.c +5 -4
@@ -29,9 +29,10 @@/* Threshold for detecting small packets to copy */ #define GOOD_COPY_LEN 128 -static const struct virtio_transport *virtio_transport_get_ops (void ) +static const struct virtio_transport * +virtio_transport_get_ops (struct vsock_sock *vsk) { -const struct vsock_transport *t =vsock_core_get_transport (); +const struct vsock_transport *t =vsock_core_get_transport (vsk); return container_of(t, struct virtio_transport, transport); }
@@ -168,7 +169,7 @@ static int virtio_transport_send_pkt_info(struct vsock_sock *vsk,struct virtio_vsock_pkt *pkt;u32 pkt_len = info->pkt_len; - src_cid =virtio_transport_get_ops ()->transport.get_local_cid (); + src_cid =virtio_transport_get_ops (vsk)->transport.get_local_cid (); src_port = vsk->local_addr.svm_port;if (!info->remote_cid) { dst_cid = vsk->remote_addr.svm_cid;
@@ -201,7 +202,7 @@ static int virtio_transport_send_pkt_info(struct vsock_sock *vsk,virtio_transport_inc_tx_pkt (vvs, pkt); -return virtio_transport_get_ops ()->send_pkt (pkt); +return virtio_transport_get_ops (vsk)->send_pkt (pkt); } static void virtio_transport_inc_rx_pkt(struct virtio_vsock_sock *vvs,
Signature · 1 line
2.21.0
Stefano Garzarella
maintainerRFC PATCH 6/13 vsock: add 'struct vsock_sock *' param to vsock_core_get_transport()
In reply to Stefano GarzarellaSince now the 'struct vsock_sock' object contains a pointer to the transport, this patch adds a parameter to the vsock_core_get_transport() to return the right transport assigned to the socket.
This patch modifies also the virtio_transport_get_ops(), that uses the vsock_core_get_transport(), adding the 'struct vsock_sock *' parameter.
--- include/net/af_vsock.h | 2 +- net/vmw_vsock/af_vsock.c | 4 ++-- net/vmw_vsock/virtio_transport_common.c | 9 +++++---- 3 files changed, 8 insertions(+), 7 deletions(-)
include/net/af_vsock.h +1 -1
@@ -166,7 +166,7 @@ static inline int vsock_core_init(const struct vsock_transport *t)void vsock_core_exit (void );/* The transport may downcast this to access transport-specific functions */ -const struct vsock_transport *vsock_core_get_transport (void ); +const struct vsock_transport *vsock_core_get_transport (struct vsock_sock *vsk);/**** UTILS ****/
net/vmw_vsock/af_vsock.c +2 -2
@@ -1993,12 +1993,12 @@ void vsock_core_exit(void) }EXPORT_SYMBOL_GPL (vsock_core_exit); -const struct vsock_transport *vsock_core_get_transport (void ) +const struct vsock_transport *vsock_core_get_transport (struct vsock_sock *vsk) {/* vsock_register_mutex not taken since only the transport uses this * function and only while registered. */ -return transport_single; +return vsk->transport; }EXPORT_SYMBOL_GPL (vsock_core_get_transport);
net/vmw_vsock/virtio_transport_common.c +5 -4
@@ -29,9 +29,10 @@/* Threshold for detecting small packets to copy */ #define GOOD_COPY_LEN 128 -static const struct virtio_transport *virtio_transport_get_ops (void ) +static const struct virtio_transport * +virtio_transport_get_ops (struct vsock_sock *vsk) { -const struct vsock_transport *t =vsock_core_get_transport (); +const struct vsock_transport *t =vsock_core_get_transport (vsk); return container_of(t, struct virtio_transport, transport); }
@@ -168,7 +169,7 @@ static int virtio_transport_send_pkt_info(struct vsock_sock *vsk,struct virtio_vsock_pkt *pkt;u32 pkt_len = info->pkt_len; - src_cid =virtio_transport_get_ops ()->transport.get_local_cid (); + src_cid =virtio_transport_get_ops (vsk)->transport.get_local_cid (); src_port = vsk->local_addr.svm_port;if (!info->remote_cid) { dst_cid = vsk->remote_addr.svm_cid;
@@ -201,7 +202,7 @@ static int virtio_transport_send_pkt_info(struct vsock_sock *vsk,virtio_transport_inc_tx_pkt (vvs, pkt); -return virtio_transport_get_ops ()->send_pkt (pkt); +return virtio_transport_get_ops (vsk)->send_pkt (pkt); } static void virtio_transport_inc_rx_pkt(struct virtio_vsock_sock *vvs,
Signature · 1 line
2.21.0
Re: [RFC PATCH 06/13] vsock: add 'struct vsock_sock *' param to vsock_core_get_transport()
net/vmw_vsock/af_vsock.c void vsock_core_exit(void) · line 2001
Quoted 7 lines · Stefano Garzarella
net/vmw_vsock/af_vsock.c +1
-2-const struct vsock_transport *vsock_core_get_transport (void ) +const struct vsock_transport *vsock_core_get_transport (struct vsock_sock *vsk) {/* vsock_register_mutex not taken since only the transport uses this * function and only while registered. */ -return transport_single;
This comment is about protecting transport_single. It no longer applies when using vsk->transport. Please drop it.
Otherwise:
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [RFC PATCH 06/13] vsock: add 'struct vsock_sock *' param to vsock_core_get_transport()
In reply to Stefano Garzarellanet/vmw_vsock/af_vsock.c void vsock_core_exit(void) · line 2001
Quoted 7 lines · Stefano Garzarella
net/vmw_vsock/af_vsock.c +1
-2-const struct vsock_transport *vsock_core_get_transport (void ) +const struct vsock_transport *vsock_core_get_transport (struct vsock_sock *vsk) {/* vsock_register_mutex not taken since only the transport uses this * function and only while registered. */ -return transport_single;
This comment is about protecting transport_single. It no longer applies when using vsk->transport. Please drop it.
Otherwise:
Stefano Garzarella
maintainerRe: [RFC PATCH 06/13] vsock: add 'struct vsock_sock *' param to vsock_core_get_transport()
Quoted 11 lines · Stefan Hajnoczi
net/vmw_vsock/af_vsock.c void vsock_core_exit(void) · line 2001
Quoted 7 lines · Stefano Garzarella
net/vmw_vsock/af_vsock.c +1
-2-const struct vsock_transport *vsock_core_get_transport (void ) +const struct vsock_transport *vsock_core_get_transport (struct vsock_sock *vsk) {/* vsock_register_mutex not taken since only the transport uses this * function and only while registered. */ -return transport_single;This comment is about protecting
transport_single. It no longer applies when usingvsk->transport. Please drop it.
Right, dropped.
Quoted 4 lines
Otherwise:
Reviewed-by Stefan Hajnoczi <[email protected]>
Thanks,
Stefano
Stefano Garzarella
maintainerRFC PATCH 7/13 vsock: handle buffer_size sockopts in the core
In reply to Stefano Garzarellavirtio_transport and vmci_transport handle the buffer_size sockopts in a very similar way.
In order to support multiple transports, this patch moves this handling in the core to allow the user to change the options also if the socket is not yet assigned to any transport.
This patch also adds the '.notify_buffer_size' callback in the 'struct virtio_transport' in order to inform the transport, when the buffer_size is changed by the user. It is also useful to limit the 'buffer_size' requested (e.g. virtio transports).
--- drivers/vhost/vsock.c | 7 +- include/linux/virtio_vsock.h | 15 +---- include/net/af_vsock.h | 14 ++-- net/vmw_vsock/af_vsock.c | 43 ++++++++++--- net/vmw_vsock/hyperv_transport.c | 36 ----------- net/vmw_vsock/virtio_transport.c | 8 +-- net/vmw_vsock/virtio_transport_common.c | 78 ++++------------------ net/vmw_vsock/vmci_transport.c | 86 +++---------------------- net/vmw_vsock/vmci_transport.h | 3 - 9 files changed, 64 insertions(+), 226 deletions(-)
drivers/vhost/vsock.c +1 -6
@@ -418,13 +418,8 @@ static struct virtio_transport vhost_transport = { .notify_send_pre_block = virtio_transport_notify_send_pre_block, .notify_send_pre_enqueue = virtio_transport_notify_send_pre_enqueue, .notify_send_post_enqueue = virtio_transport_notify_send_post_enqueue, + .notify_buffer_size = virtio_transport_notify_buffer_size, - .set_buffer_size = virtio_transport_set_buffer_size, - .set_min_buffer_size = virtio_transport_set_min_buffer_size, - .set_max_buffer_size = virtio_transport_set_max_buffer_size, - .get_buffer_size = virtio_transport_get_buffer_size, - .get_min_buffer_size = virtio_transport_get_min_buffer_size, - .get_max_buffer_size = virtio_transport_get_max_buffer_size, }, .send_pkt = vhost_transport_send_pkt,
include/linux/virtio_vsock.h +1 -14
@@ -7,9 +7,6 @@#include <net/sock.h> #include <net/af_vsock.h> -#define VIRTIO_VSOCK_DEFAULT_MIN_BUF_SIZE 128 -#define VIRTIO_VSOCK_DEFAULT_BUF_SIZE (1024 * 256) -#define VIRTIO_VSOCK_DEFAULT_MAX_BUF_SIZE (1024 * 256)#define VIRTIO_VSOCK_DEFAULT_RX_BUF_SIZE (1024 * 4)#define VIRTIO_VSOCK_MAX_BUF_SIZE 0xFFFFFFFFUL#define VIRTIO_VSOCK_MAX_PKT_BUF_SIZE (1024 * 64)
@@ -25,11 +22,6 @@ enum {struct virtio_vsock_sock {struct vsock_sock *vsk; -/* Protected by lock_sock(sk_vsock(trans->vsk)) */ -u32 buf_size; -u32 buf_size_min; -u32 buf_size_max; -spinlock_t tx_lock;spinlock_t rx_lock;
@@ -93,12 +85,6 @@ s64 virtio_transport_stream_has_space(struct vsock_sock *vsk);int virtio_transport_do_socket_init (struct vsock_sock *vsk,struct vsock_sock *psk); -u64 virtio_transport_get_buffer_size (struct vsock_sock *vsk); -u64 virtio_transport_get_min_buffer_size (struct vsock_sock *vsk); -u64 virtio_transport_get_max_buffer_size (struct vsock_sock *vsk); -void virtio_transport_set_buffer_size (struct vsock_sock *vsk,u64 val); -void virtio_transport_set_min_buffer_size (struct vsock_sock *vsk,u64 val); -void virtio_transport_set_max_buffer_size (struct vsock_sock *vs,u64 val); int virtio_transport_notify_poll_in(struct vsock_sock *vsk, size_t target,
@@ -125,6 +111,7 @@ int virtio_transport_notify_send_pre_enqueue(struct vsock_sock *vsk, struct vsock_transport_send_notify_data *data);int virtio_transport_notify_send_post_enqueue (struct vsock_sock *vsk,ssize_t written,struct vsock_transport_send_notify_data *data); +int virtio_transport_notify_buffer_size (struct vsock_sock *vsk,u64 *val);u64 virtio_transport_stream_rcvhiwat (struct vsock_sock *vsk);bool virtio_transport_stream_is_active (struct vsock_sock *vsk);
include/net/af_vsock.h +6 -8
@@ -65,6 +65,11 @@ struct vsock_sock {bool sent_request;bool ignore_connecting_rst; +/* Protected by lock_sock(sk) */ +u64 buffer_size; +u64 buffer_min_size; +u64 buffer_max_size; +/* Private to transport. */ void *trans; };
@@ -140,18 +145,11 @@ struct vsock_transport { struct vsock_transport_send_notify_data *); int (*notify_send_post_enqueue)(struct vsock_sock *, ssize_t,struct vsock_transport_send_notify_data *); +int (*notify_buffer_size)(struct vsock_sock *,u64 *);/* Shutdown. */ int (*shutdown)(struct vsock_sock *,int ); -/* Buffer sizes. */ -void (*set_buffer_size)(struct vsock_sock *,u64 ); -void (*set_min_buffer_size)(struct vsock_sock *,u64 ); -void (*set_max_buffer_size)(struct vsock_sock *,u64 ); -u64 (*get_buffer_size)(struct vsock_sock *); -u64 (*get_min_buffer_size)(struct vsock_sock *); -u64 (*get_max_buffer_size)(struct vsock_sock *); -/* Addressing. */ u32 (*get_local_cid)(void); };
net/vmw_vsock/af_vsock.c +35 -8
102 lines not on this page · raw message
net/vmw_vsock/hyperv_transport.c +0 -36
@@ -843,36 +843,6 @@ int hvs_notify_send_post_enqueue(struct vsock_sock *vsk, ssize_t written,return 0 ; } -static void hvs_set_buffer_size (struct vsock_sock *vsk,u64 val) -{ -/* Ignored. */ -} - -static void hvs_set_min_buffer_size (struct vsock_sock *vsk,u64 val) -{ -/* Ignored. */ -} - -static void hvs_set_max_buffer_size (struct vsock_sock *vsk,u64 val) -{ -/* Ignored. */ -} - -static u64 hvs_get_buffer_size (struct vsock_sock *vsk) -{ -return -ENOPROTOOPT ; -} - -static u64 hvs_get_min_buffer_size (struct vsock_sock *vsk) -{ -return -ENOPROTOOPT ; -} - -static u64 hvs_get_max_buffer_size (struct vsock_sock *vsk) -{ -return -ENOPROTOOPT ; -} -static struct vsock_transport hvs_transport = { .get_local_cid = hvs_get_local_cid,
@@ -906,12 +876,6 @@ static struct vsock_transport hvs_transport = { .notify_send_pre_enqueue = hvs_notify_send_pre_enqueue, .notify_send_post_enqueue = hvs_notify_send_post_enqueue, - .set_buffer_size = hvs_set_buffer_size, - .set_min_buffer_size = hvs_set_min_buffer_size, - .set_max_buffer_size = hvs_set_max_buffer_size, - .get_buffer_size = hvs_get_buffer_size, - .get_min_buffer_size = hvs_get_min_buffer_size, - .get_max_buffer_size = hvs_get_max_buffer_size, }; static int hvs_probe(struct hv_device *hdev,
net/vmw_vsock/virtio_transport.c +1 -7
@@ -494,13 +494,7 @@ static struct virtio_transport virtio_transport = { .notify_send_pre_block = virtio_transport_notify_send_pre_block, .notify_send_pre_enqueue = virtio_transport_notify_send_pre_enqueue, .notify_send_post_enqueue = virtio_transport_notify_send_post_enqueue, - - .set_buffer_size = virtio_transport_set_buffer_size, - .set_min_buffer_size = virtio_transport_set_min_buffer_size, - .set_max_buffer_size = virtio_transport_set_max_buffer_size, - .get_buffer_size = virtio_transport_get_buffer_size, - .get_min_buffer_size = virtio_transport_get_min_buffer_size, - .get_max_buffer_size = virtio_transport_get_max_buffer_size, + .notify_buffer_size = virtio_transport_notify_buffer_size, }, .send_pkt = virtio_transport_send_pkt,
net/vmw_vsock/virtio_transport_common.c +11 -67
105 lines not on this page · raw message
net/vmw_vsock/vmci_transport.c +9 -77
148 lines not on this page · raw message
net/vmw_vsock/vmci_transport.h +0 -3
@@ -108,9 +108,6 @@ struct vmci_transport {struct vmci_qp *qpair;u64 produce_size;u64 consume_size; -u64 queue_pair_size; -u64 queue_pair_min_size; -u64 queue_pair_max_size;u32 detach_sub_id;union vmci_transport_notify notify;const struct vmci_transport_notify_ops *notify_ops;
Signature · 1 line
2.21.0
Stefano Garzarella
maintainerRFC PATCH 7/13 vsock: handle buffer_size sockopts in the core
In reply to Stefano Garzarellavirtio_transport and vmci_transport handle the buffer_size sockopts in a very similar way.
In order to support multiple transports, this patch moves this handling in the core to allow the user to change the options also if the socket is not yet assigned to any transport.
This patch also adds the '.notify_buffer_size' callback in the 'struct virtio_transport' in order to inform the transport, when the buffer_size is changed by the user. It is also useful to limit the 'buffer_size' requested (e.g. virtio transports).
--- drivers/vhost/vsock.c | 7 +- include/linux/virtio_vsock.h | 15 +---- include/net/af_vsock.h | 14 ++-- net/vmw_vsock/af_vsock.c | 43 ++++++++++--- net/vmw_vsock/hyperv_transport.c | 36 ----------- net/vmw_vsock/virtio_transport.c | 8 +-- net/vmw_vsock/virtio_transport_common.c | 78 ++++------------------ net/vmw_vsock/vmci_transport.c | 86 +++---------------------- net/vmw_vsock/vmci_transport.h | 3 - 9 files changed, 64 insertions(+), 226 deletions(-)
drivers/vhost/vsock.c +1 -6
@@ -418,13 +418,8 @@ static struct virtio_transport vhost_transport = { .notify_send_pre_block = virtio_transport_notify_send_pre_block, .notify_send_pre_enqueue = virtio_transport_notify_send_pre_enqueue, .notify_send_post_enqueue = virtio_transport_notify_send_post_enqueue, + .notify_buffer_size = virtio_transport_notify_buffer_size, - .set_buffer_size = virtio_transport_set_buffer_size, - .set_min_buffer_size = virtio_transport_set_min_buffer_size, - .set_max_buffer_size = virtio_transport_set_max_buffer_size, - .get_buffer_size = virtio_transport_get_buffer_size, - .get_min_buffer_size = virtio_transport_get_min_buffer_size, - .get_max_buffer_size = virtio_transport_get_max_buffer_size, }, .send_pkt = vhost_transport_send_pkt,
include/linux/virtio_vsock.h +1 -14
@@ -7,9 +7,6 @@#include <net/sock.h> #include <net/af_vsock.h> -#define VIRTIO_VSOCK_DEFAULT_MIN_BUF_SIZE 128 -#define VIRTIO_VSOCK_DEFAULT_BUF_SIZE (1024 * 256) -#define VIRTIO_VSOCK_DEFAULT_MAX_BUF_SIZE (1024 * 256)#define VIRTIO_VSOCK_DEFAULT_RX_BUF_SIZE (1024 * 4)#define VIRTIO_VSOCK_MAX_BUF_SIZE 0xFFFFFFFFUL#define VIRTIO_VSOCK_MAX_PKT_BUF_SIZE (1024 * 64)
@@ -25,11 +22,6 @@ enum {struct virtio_vsock_sock {struct vsock_sock *vsk; -/* Protected by lock_sock(sk_vsock(trans->vsk)) */ -u32 buf_size; -u32 buf_size_min; -u32 buf_size_max; -spinlock_t tx_lock;spinlock_t rx_lock;
@@ -93,12 +85,6 @@ s64 virtio_transport_stream_has_space(struct vsock_sock *vsk);int virtio_transport_do_socket_init (struct vsock_sock *vsk,struct vsock_sock *psk); -u64 virtio_transport_get_buffer_size (struct vsock_sock *vsk); -u64 virtio_transport_get_min_buffer_size (struct vsock_sock *vsk); -u64 virtio_transport_get_max_buffer_size (struct vsock_sock *vsk); -void virtio_transport_set_buffer_size (struct vsock_sock *vsk,u64 val); -void virtio_transport_set_min_buffer_size (struct vsock_sock *vsk,u64 val); -void virtio_transport_set_max_buffer_size (struct vsock_sock *vs,u64 val); int virtio_transport_notify_poll_in(struct vsock_sock *vsk, size_t target,
@@ -125,6 +111,7 @@ int virtio_transport_notify_send_pre_enqueue(struct vsock_sock *vsk, struct vsock_transport_send_notify_data *data);int virtio_transport_notify_send_post_enqueue (struct vsock_sock *vsk,ssize_t written,struct vsock_transport_send_notify_data *data); +int virtio_transport_notify_buffer_size (struct vsock_sock *vsk,u64 *val);u64 virtio_transport_stream_rcvhiwat (struct vsock_sock *vsk);bool virtio_transport_stream_is_active (struct vsock_sock *vsk);
include/net/af_vsock.h +6 -8
@@ -65,6 +65,11 @@ struct vsock_sock {bool sent_request;bool ignore_connecting_rst; +/* Protected by lock_sock(sk) */ +u64 buffer_size; +u64 buffer_min_size; +u64 buffer_max_size; +/* Private to transport. */ void *trans; };
@@ -140,18 +145,11 @@ struct vsock_transport { struct vsock_transport_send_notify_data *); int (*notify_send_post_enqueue)(struct vsock_sock *, ssize_t,struct vsock_transport_send_notify_data *); +int (*notify_buffer_size)(struct vsock_sock *,u64 *);/* Shutdown. */ int (*shutdown)(struct vsock_sock *,int ); -/* Buffer sizes. */ -void (*set_buffer_size)(struct vsock_sock *,u64 ); -void (*set_min_buffer_size)(struct vsock_sock *,u64 ); -void (*set_max_buffer_size)(struct vsock_sock *,u64 ); -u64 (*get_buffer_size)(struct vsock_sock *); -u64 (*get_min_buffer_size)(struct vsock_sock *); -u64 (*get_max_buffer_size)(struct vsock_sock *); -/* Addressing. */ u32 (*get_local_cid)(void); };
net/vmw_vsock/af_vsock.c +35 -8
102 lines not on this page · raw message
net/vmw_vsock/hyperv_transport.c +0 -36
@@ -843,36 +843,6 @@ int hvs_notify_send_post_enqueue(struct vsock_sock *vsk, ssize_t written,return 0 ; } -static void hvs_set_buffer_size (struct vsock_sock *vsk,u64 val) -{ -/* Ignored. */ -} - -static void hvs_set_min_buffer_size (struct vsock_sock *vsk,u64 val) -{ -/* Ignored. */ -} - -static void hvs_set_max_buffer_size (struct vsock_sock *vsk,u64 val) -{ -/* Ignored. */ -} - -static u64 hvs_get_buffer_size (struct vsock_sock *vsk) -{ -return -ENOPROTOOPT ; -} - -static u64 hvs_get_min_buffer_size (struct vsock_sock *vsk) -{ -return -ENOPROTOOPT ; -} - -static u64 hvs_get_max_buffer_size (struct vsock_sock *vsk) -{ -return -ENOPROTOOPT ; -} -static struct vsock_transport hvs_transport = { .get_local_cid = hvs_get_local_cid,
@@ -906,12 +876,6 @@ static struct vsock_transport hvs_transport = { .notify_send_pre_enqueue = hvs_notify_send_pre_enqueue, .notify_send_post_enqueue = hvs_notify_send_post_enqueue, - .set_buffer_size = hvs_set_buffer_size, - .set_min_buffer_size = hvs_set_min_buffer_size, - .set_max_buffer_size = hvs_set_max_buffer_size, - .get_buffer_size = hvs_get_buffer_size, - .get_min_buffer_size = hvs_get_min_buffer_size, - .get_max_buffer_size = hvs_get_max_buffer_size, }; static int hvs_probe(struct hv_device *hdev,
net/vmw_vsock/virtio_transport.c +1 -7
@@ -494,13 +494,7 @@ static struct virtio_transport virtio_transport = { .notify_send_pre_block = virtio_transport_notify_send_pre_block, .notify_send_pre_enqueue = virtio_transport_notify_send_pre_enqueue, .notify_send_post_enqueue = virtio_transport_notify_send_post_enqueue, - - .set_buffer_size = virtio_transport_set_buffer_size, - .set_min_buffer_size = virtio_transport_set_min_buffer_size, - .set_max_buffer_size = virtio_transport_set_max_buffer_size, - .get_buffer_size = virtio_transport_get_buffer_size, - .get_min_buffer_size = virtio_transport_get_min_buffer_size, - .get_max_buffer_size = virtio_transport_get_max_buffer_size, + .notify_buffer_size = virtio_transport_notify_buffer_size, }, .send_pkt = virtio_transport_send_pkt,
net/vmw_vsock/virtio_transport_common.c +11 -67
105 lines not on this page · raw message
net/vmw_vsock/vmci_transport.c +9 -77
148 lines not on this page · raw message
net/vmw_vsock/vmci_transport.h +0 -3
@@ -108,9 +108,6 @@ struct vmci_transport {struct vmci_qp *qpair;u64 produce_size;u64 consume_size; -u64 queue_pair_size; -u64 queue_pair_min_size; -u64 queue_pair_max_size;u32 detach_sub_id;union vmci_transport_notify notify;const struct vmci_transport_notify_ops *notify_ops;
Signature · 1 line
2.21.0
RE: [RFC PATCH 07/13] vsock: handle buffer_size sockopts in the core
Quoted 17 lines
From: Stefano Garzarella <[email protected]>
Sent: Friday, September 27, 2019 4:27 AM
To: [email protected]
virtio_transportandvmci_transporthandle thebuffer_sizesockopts in a very similar way.In order to support multiple transports, this patch moves this handling in the core to allow the user to change the options also if the socket is not yet assigned to any transport.
This patch also adds the '.notify_buffer_size' callback in the 'struct
virtio_transport' in order to inform the transport, when thebuffer_sizeis changed by the user. It is also useful to limit the 'buffer_size' requested (e.g. virtio transports).Signed-off-by Stefano Garzarella <[email protected]>
Quoted 12 lines
--- drivers/vhost/vsock.c | 7 +- include/linux/virtio_vsock.h | 15 +---- include/net/af_vsock.h | 14 ++-- net/vmw_vsock/af_vsock.c | 43 ++++++++++--- net/vmw_vsock/hyperv_transport.c | 36 ----------- net/vmw_vsock/virtio_transport.c | 8 +-- net/vmw_vsock/virtio_transport_common.c | 78 ++++------------------ net/vmw_vsock/vmci_transport.c | 86 +++---------------------- net/vmw_vsock/vmci_transport.h | 3 - 9 files changed, 64 insertions(+), 226 deletions(-)
The hv_sock part (hyperv_transport.c) looks good to me.
Re: [RFC PATCH 07/13] vsock: handle buffer_size sockopts in the core
In reply to Stefano Garzarellainclude/net/af_vsock.h struct vsock_transport { · line 148
Quoted 5 lines · Stefano Garzarella
include/net/af_vsock.h +1
-0@@ -140,18 +145,11 @@ struct vsock_transport { struct vsock_transport_send_notify_data *); int (*notify_send_post_enqueue)(struct vsock_sock *, ssize_t,struct vsock_transport_send_notify_data *); +int (*notify_buffer_size)(struct vsock_sock *,u64 *);
Is ->notify_buffer_size() called under lock_sock(sk)? If yes, please document it.
net/vmw_vsock/af_vsock.c static int vsock_listen(struct socket *sock, int backlog) · line 1385
Quoted 13 lines
net/vmw_vsock/af_vsock.c +13
-0+static void vsock_update_buffer_size (struct vsock_sock *vsk, +const struct vsock_transport *transport, +u64 val) +{ +if (val > vsk->buffer_max_size) + val = vsk->buffer_max_size; + +if (val < vsk->buffer_min_size) + val = vsk->buffer_min_size; + +if (val != vsk->buffer_size && + transport && transport->notify_buffer_size) + transport->notify_buffer_size (vsk, &val);
Why does this function return an int if we don't check the return value?
Quoted 11 lines
net/vmw_vsock/virtio_transport_common.c +0
-3@@ -403,17 +403,13 @@ int virtio_transport_do_socket_init(struct vsock_sock *vsk,if (psk) {struct virtio_vsock_sock *ptrans = psk->trans; - vvs->buf_size = ptrans->buf_size; - vvs->buf_size_min = ptrans->buf_size_min; - vvs->buf_size_max = ptrans->buf_size_max;
net/vmw_vsock/virtio_transport_common.c int virtio_transport_do_socket_init(struct vsock_sock *vsk, · line 410
Quoted 10 lines
net/vmw_vsock/virtio_transport_common.c +2
-5vvs->peer_buf_alloc = ptrans->peer_buf_alloc; - }else { - vvs->buf_size =VIRTIO_VSOCK_DEFAULT_BUF_SIZE ; - vvs->buf_size_min =VIRTIO_VSOCK_DEFAULT_MIN_BUF_SIZE ; - vvs->buf_size_max =VIRTIO_VSOCK_DEFAULT_MAX_BUF_SIZE ; } - vvs->buf_alloc = vvs->buf_size; +if (vsk->buffer_size >VIRTIO_VSOCK_MAX_BUF_SIZE ) + vsk->buffer_size =VIRTIO_VSOCK_MAX_BUF_SIZE ;
Hmm...this could be outside the [min, max] range. I'm not sure how much it matters.
Another issue is that this patch drops the VIRTIO_VSOCK_MAX_BUF_SIZE limit that used to be enforced by virtio_transport_set_buffer_size(). Now the limit is only applied at socket init time. If the buffer size is changed later then VIRTIO_VSOCK_MAX_BUF_SIZE can be exceeded. If that doesn't matter, why even bother with VIRTIO_VSOCK_MAX_BUF_SIZE here?
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [RFC PATCH 07/13] vsock: handle buffer_size sockopts in the core
In reply to Stefano Garzarellainclude/net/af_vsock.h struct vsock_transport { · line 148
Quoted 5 lines · Stefano Garzarella
include/net/af_vsock.h +1
-0@@ -140,18 +145,11 @@ struct vsock_transport { struct vsock_transport_send_notify_data *); int (*notify_send_post_enqueue)(struct vsock_sock *, ssize_t,struct vsock_transport_send_notify_data *); +int (*notify_buffer_size)(struct vsock_sock *,u64 *);
Is ->notify_buffer_size() called under lock_sock(sk)? If yes, please document it.
net/vmw_vsock/af_vsock.c static int vsock_listen(struct socket *sock, int backlog) · line 1385
Quoted 13 lines
net/vmw_vsock/af_vsock.c +13
-0+static void vsock_update_buffer_size (struct vsock_sock *vsk, +const struct vsock_transport *transport, +u64 val) +{ +if (val > vsk->buffer_max_size) + val = vsk->buffer_max_size; + +if (val < vsk->buffer_min_size) + val = vsk->buffer_min_size; + +if (val != vsk->buffer_size && + transport && transport->notify_buffer_size) + transport->notify_buffer_size (vsk, &val);
Why does this function return an int if we don't check the return value?
Quoted 11 lines
net/vmw_vsock/virtio_transport_common.c +0
-3@@ -403,17 +403,13 @@ int virtio_transport_do_socket_init(struct vsock_sock *vsk,if (psk) {struct virtio_vsock_sock *ptrans = psk->trans; - vvs->buf_size = ptrans->buf_size; - vvs->buf_size_min = ptrans->buf_size_min; - vvs->buf_size_max = ptrans->buf_size_max;
net/vmw_vsock/virtio_transport_common.c int virtio_transport_do_socket_init(struct vsock_sock *vsk, · line 410
Quoted 10 lines
net/vmw_vsock/virtio_transport_common.c +2
-5vvs->peer_buf_alloc = ptrans->peer_buf_alloc; - }else { - vvs->buf_size =VIRTIO_VSOCK_DEFAULT_BUF_SIZE ; - vvs->buf_size_min =VIRTIO_VSOCK_DEFAULT_MIN_BUF_SIZE ; - vvs->buf_size_max =VIRTIO_VSOCK_DEFAULT_MAX_BUF_SIZE ; } - vvs->buf_alloc = vvs->buf_size; +if (vsk->buffer_size >VIRTIO_VSOCK_MAX_BUF_SIZE ) + vsk->buffer_size =VIRTIO_VSOCK_MAX_BUF_SIZE ;
Hmm...this could be outside the [min, max] range. I'm not sure how much it matters.
Another issue is that this patch drops the VIRTIO_VSOCK_MAX_BUF_SIZE limit that used to be enforced by virtio_transport_set_buffer_size(). Now the limit is only applied at socket init time. If the buffer size is changed later then VIRTIO_VSOCK_MAX_BUF_SIZE can be exceeded. If that doesn't matter, why even bother with VIRTIO_VSOCK_MAX_BUF_SIZE here?
Stefano Garzarella
maintainerRe: [RFC PATCH 07/13] vsock: handle buffer_size sockopts in the core
Quoted 9 lines · Stefan Hajnoczi
include/net/af_vsock.h struct vsock_transport { · line 148
Quoted 5 lines · Stefano Garzarella
include/net/af_vsock.h +1
-0@@ -140,18 +145,11 @@ struct vsock_transport { struct vsock_transport_send_notify_data *); int (*notify_send_post_enqueue)(struct vsock_sock *, ssize_t,struct vsock_transport_send_notify_data *); +int (*notify_buffer_size)(struct vsock_sock *,u64 *);Is ->notify_buffer_size() called under
lock_sock(sk)? If yes, please document it.
Yes, it is. I'll document it!
Quoted 17 lines
Quoted 4 lines
net/vmw_vsock/af_vsock.c +3
-0+static void vsock_update_buffer_size (struct vsock_sock *vsk, +const struct vsock_transport *transport, +u64 val)net/vmw_vsock/af_vsock.c static int vsock_listen(struct socket *sock, int backlog) · line 1385
Quoted 10 lines
net/vmw_vsock/af_vsock.c +10
-0+{ +if (val > vsk->buffer_max_size) + val = vsk->buffer_max_size; + +if (val < vsk->buffer_min_size) + val = vsk->buffer_min_size; + +if (val != vsk->buffer_size && + transport && transport->notify_buffer_size) + transport->notify_buffer_size (vsk, &val);Why does this function return an int if we don't check the return value?
Copy and past :-(
I'll fix it returning void since I don't think it can fail.
Quoted 18 lines
Quoted 18 lines
net/vmw_vsock/virtio_transport_common.c +0
-7@@ -403,17 +403,13 @@ int virtio_transport_do_socket_init(struct vsock_sock *vsk,if (psk) {struct virtio_vsock_sock *ptrans = psk->trans; - vvs->buf_size = ptrans->buf_size; - vvs->buf_size_min = ptrans->buf_size_min; - vvs->buf_size_max = ptrans->buf_size_max; vvs->peer_buf_alloc = ptrans->peer_buf_alloc; - }else { - vvs->buf_size =VIRTIO_VSOCK_DEFAULT_BUF_SIZE ; - vvs->buf_size_min =VIRTIO_VSOCK_DEFAULT_MIN_BUF_SIZE ; - vvs->buf_size_max =VIRTIO_VSOCK_DEFAULT_MAX_BUF_SIZE ; }
Quoted 6 lines
net/vmw_vsock/virtio_transport_common.c int virtio_transport_do_socket_init(struct vsock_sock *vsk, · line 410
Quoted 3 lines
net/vmw_vsock/virtio_transport_common.c +2
-1- vvs->buf_alloc = vvs->buf_size; +if (vsk->buffer_size >VIRTIO_VSOCK_MAX_BUF_SIZE ) + vsk->buffer_size =VIRTIO_VSOCK_MAX_BUF_SIZE ;Hmm...this could be outside the [min, max] range. I'm not sure how much it matters.
The core guarantees that vsk->buffer_size is <= of the max, so since we are lowering it, the max should be respected. For the min you are right, but I think this limit is stricter than the min set by the user.
Quoted 8 lines
Another issue is that this patch drops the
VIRTIO_VSOCK_MAX_BUF_SIZElimit that used to be enforced byvirtio_transport_set_buffer_size(). Now the limit is only applied at socket init time. If the buffer size is changed later thenVIRTIO_VSOCK_MAX_BUF_SIZEcan be exceeded. If that doesn't matter, why even bother withVIRTIO_VSOCK_MAX_BUF_SIZEhere?
The .notify_buffer_size() should avoid this issue, since it allows the transport to limit the buffer size requested after the initialization.
But again the min set by the user can not be respected and in the previous implementation we forced it to VIRTIO_VSOCK_MAX_BUF_SIZE.
Now we don't limit the min, but we guarantee only that vsk->buffer_size is lower than VIRTIO_VSOCK_MAX_BUF_SIZE.
Can that be an acceptable compromise?
Thanks,
Stefano
Stefano Garzarella
maintainerRe: [RFC PATCH 07/13] vsock: handle buffer_size sockopts in the core
In reply to Stefan HajnocziQuoted 9 lines · Stefan Hajnoczi
include/net/af_vsock.h struct vsock_transport { · line 148
Quoted 5 lines · Stefano Garzarella
include/net/af_vsock.h +1
-0@@ -140,18 +145,11 @@ struct vsock_transport { struct vsock_transport_send_notify_data *); int (*notify_send_post_enqueue)(struct vsock_sock *, ssize_t,struct vsock_transport_send_notify_data *); +int (*notify_buffer_size)(struct vsock_sock *,u64 *);Is ->notify_buffer_size() called under
lock_sock(sk)? If yes, please document it.
Yes, it is. I'll document it!
Quoted 17 lines
Quoted 4 lines
net/vmw_vsock/af_vsock.c +3
-0+static void vsock_update_buffer_size (struct vsock_sock *vsk, +const struct vsock_transport *transport, +u64 val)net/vmw_vsock/af_vsock.c static int vsock_listen(struct socket *sock, int backlog) · line 1385
Quoted 10 lines
net/vmw_vsock/af_vsock.c +10
-0+{ +if (val > vsk->buffer_max_size) + val = vsk->buffer_max_size; + +if (val < vsk->buffer_min_size) + val = vsk->buffer_min_size; + +if (val != vsk->buffer_size && + transport && transport->notify_buffer_size) + transport->notify_buffer_size (vsk, &val);Why does this function return an int if we don't check the return value?
Copy and past :-(
I'll fix it returning void since I don't think it can fail.
Quoted 18 lines
Quoted 18 lines
net/vmw_vsock/virtio_transport_common.c +0
-7@@ -403,17 +403,13 @@ int virtio_transport_do_socket_init(struct vsock_sock *vsk,if (psk) {struct virtio_vsock_sock *ptrans = psk->trans; - vvs->buf_size = ptrans->buf_size; - vvs->buf_size_min = ptrans->buf_size_min; - vvs->buf_size_max = ptrans->buf_size_max; vvs->peer_buf_alloc = ptrans->peer_buf_alloc; - }else { - vvs->buf_size =VIRTIO_VSOCK_DEFAULT_BUF_SIZE ; - vvs->buf_size_min =VIRTIO_VSOCK_DEFAULT_MIN_BUF_SIZE ; - vvs->buf_size_max =VIRTIO_VSOCK_DEFAULT_MAX_BUF_SIZE ; }
Quoted 6 lines
net/vmw_vsock/virtio_transport_common.c int virtio_transport_do_socket_init(struct vsock_sock *vsk, · line 410
Quoted 3 lines
net/vmw_vsock/virtio_transport_common.c +2
-1- vvs->buf_alloc = vvs->buf_size; +if (vsk->buffer_size >VIRTIO_VSOCK_MAX_BUF_SIZE ) + vsk->buffer_size =VIRTIO_VSOCK_MAX_BUF_SIZE ;Hmm...this could be outside the [min, max] range. I'm not sure how much it matters.
The core guarantees that vsk->buffer_size is <= of the max, so since we are lowering it, the max should be respected. For the min you are right, but I think this limit is stricter than the min set by the user.
Quoted 8 lines
Another issue is that this patch drops the
VIRTIO_VSOCK_MAX_BUF_SIZElimit that used to be enforced byvirtio_transport_set_buffer_size(). Now the limit is only applied at socket init time. If the buffer size is changed later thenVIRTIO_VSOCK_MAX_BUF_SIZEcan be exceeded. If that doesn't matter, why even bother withVIRTIO_VSOCK_MAX_BUF_SIZEhere?
The .notify_buffer_size() should avoid this issue, since it allows the transport to limit the buffer size requested after the initialization.
But again the min set by the user can not be respected and in the previous implementation we forced it to VIRTIO_VSOCK_MAX_BUF_SIZE.
Now we don't limit the min, but we guarantee only that vsk->buffer_size is lower than VIRTIO_VSOCK_MAX_BUF_SIZE.
Can that be an acceptable compromise?
Thanks,
Stefano
Stefan Hajnoczi
maintainerRe: [RFC PATCH 07/13] vsock: handle buffer_size sockopts in the core
Quoted 13 lines · Stefano Garzarella
Quoted 8 lines · Stefan Hajnoczi
On Fri, Sep 27, 2019 at 01:26:57PM +0200, Stefano Garzarella wrote:
Another issue is that this patch drops theVIRTIO_VSOCK_MAX_BUF_SIZElimit that used to be enforced byvirtio_transport_set_buffer_size(). Now the limit is only applied at socket init time. If the buffer size is changed later thenVIRTIO_VSOCK_MAX_BUF_SIZEcan be exceeded. If that doesn't matter, why even bother withVIRTIO_VSOCK_MAX_BUF_SIZEhere?The .notify_buffer_size() should avoid this issue, since it allows the transport to limit the buffer size requested after the initialization.
Quoted 7 lines
But again the min set by the user can not be respected and in the previous implementation we forced it to
VIRTIO_VSOCK_MAX_BUF_SIZE.Now we don't limit the min, but we guarantee only that
vsk->buffer_sizeis lower thanVIRTIO_VSOCK_MAX_BUF_SIZE.Can that be an acceptable compromise?
I think so.
Setting buffer sizes was never tested or used much by userspace applications that I'm aware of. We should probably include tests for changing buffer sizes in the test suite.
Stefan
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Stefan Hajnoczi
maintainerRe: [RFC PATCH 07/13] vsock: handle buffer_size sockopts in the core
In reply to Stefano GarzarellaQuoted 13 lines · Stefano Garzarella
Quoted 8 lines · Stefan Hajnoczi
On Fri, Sep 27, 2019 at 01:26:57PM +0200, Stefano Garzarella wrote:
Another issue is that this patch drops theVIRTIO_VSOCK_MAX_BUF_SIZElimit that used to be enforced byvirtio_transport_set_buffer_size(). Now the limit is only applied at socket init time. If the buffer size is changed later thenVIRTIO_VSOCK_MAX_BUF_SIZEcan be exceeded. If that doesn't matter, why even bother withVIRTIO_VSOCK_MAX_BUF_SIZEhere?The .notify_buffer_size() should avoid this issue, since it allows the transport to limit the buffer size requested after the initialization.
Quoted 7 lines
But again the min set by the user can not be respected and in the previous implementation we forced it to
VIRTIO_VSOCK_MAX_BUF_SIZE.Now we don't limit the min, but we guarantee only that
vsk->buffer_sizeis lower thanVIRTIO_VSOCK_MAX_BUF_SIZE.Can that be an acceptable compromise?
I think so.
Setting buffer sizes was never tested or used much by userspace applications that I'm aware of. We should probably include tests for changing buffer sizes in the test suite.
Stefan
Stefano Garzarella
maintainerRe: [RFC PATCH 07/13] vsock: handle buffer_size sockopts in the core
Quoted 20 lines · Stefan Hajnoczi
Quoted 19 lines · Stefano Garzarella
Quoted 8 lines · Stefan Hajnoczi
On Fri, Sep 27, 2019 at 01:26:57PM +0200, Stefano Garzarella wrote:
Another issue is that this patch drops theVIRTIO_VSOCK_MAX_BUF_SIZElimit that used to be enforced byvirtio_transport_set_buffer_size(). Now the limit is only applied at socket init time. If the buffer size is changed later thenVIRTIO_VSOCK_MAX_BUF_SIZEcan be exceeded. If that doesn't matter, why even bother withVIRTIO_VSOCK_MAX_BUF_SIZEhere?The .notify_buffer_size() should avoid this issue, since it allows the transport to limit the buffer size requested after the initialization.
But again the min set by the user can not be respected and in the previous implementation we forced it to
VIRTIO_VSOCK_MAX_BUF_SIZE.Now we don't limit the min, but we guarantee only that
vsk->buffer_sizeis lower thanVIRTIO_VSOCK_MAX_BUF_SIZE.
Quoted 7 lines
Quoted 1 line
Can that be an acceptable compromise?
I think so.
Setting buffer sizes was never tested or used much by userspace applications that I'm aware of. We should probably include tests for changing buffer sizes in the test suite.
Good idea! We should add a test to check if min/max are respected, playing a bit with these sockopt.
I'll do it in the test series!
Thanks,
Stefano
Stefano Garzarella
maintainerRe: [RFC PATCH 07/13] vsock: handle buffer_size sockopts in the core
In reply to Stefan HajnocziQuoted 20 lines · Stefan Hajnoczi
Quoted 19 lines · Stefano Garzarella
Quoted 8 lines · Stefan Hajnoczi
On Fri, Sep 27, 2019 at 01:26:57PM +0200, Stefano Garzarella wrote:
Another issue is that this patch drops theVIRTIO_VSOCK_MAX_BUF_SIZElimit that used to be enforced byvirtio_transport_set_buffer_size(). Now the limit is only applied at socket init time. If the buffer size is changed later thenVIRTIO_VSOCK_MAX_BUF_SIZEcan be exceeded. If that doesn't matter, why even bother withVIRTIO_VSOCK_MAX_BUF_SIZEhere?The .notify_buffer_size() should avoid this issue, since it allows the transport to limit the buffer size requested after the initialization.
But again the min set by the user can not be respected and in the previous implementation we forced it to
VIRTIO_VSOCK_MAX_BUF_SIZE.Now we don't limit the min, but we guarantee only that
vsk->buffer_sizeis lower thanVIRTIO_VSOCK_MAX_BUF_SIZE.
Quoted 7 lines
Quoted 1 line
Can that be an acceptable compromise?
I think so.
Setting buffer sizes was never tested or used much by userspace applications that I'm aware of. We should probably include tests for changing buffer sizes in the test suite.
Good idea! We should add a test to check if min/max are respected, playing a bit with these sockopt.
I'll do it in the test series!
Thanks,
Stefano
Stefano Garzarella
maintainerRFC PATCH 8/13 vsock: move vsock_insert_unbound() in the vsock_create()
In reply to Stefano Garzarellavsock_insert_unbound() was called only when 'sock' parameter of __vsock_create() was not null. This only happened when __vsock_create() was called by vsock_create().
In order to simplify the multi-transports support, this patch moves vsock_insert_unbound() at the end of vsock_create().
--- net/vmw_vsock/af_vsock.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
net/vmw_vsock/af_vsock.c +9 -4
@@ -634,9 +634,6 @@ struct sock *__vsock_create(struct net *net,return NULL ; } -if (sock) -vsock_insert_unbound (vsk); -return sk; }EXPORT_SYMBOL_GPL (__vsock_create);
@@ -1875,6 +1872,8 @@ static const struct proto_ops vsock_stream_ops = {static int vsock_create (struct net *net,struct socket *sock,int protocol,int kern) { +struct sock *sk; +if (!sock)return -EINVAL ;
@@ -1894,7 +1893,13 @@ static int vsock_create(struct net *net, struct socket *sock, sock->state =SS_UNCONNECTED ; -return __vsock_create (net, sock,NULL ,GFP_KERNEL ,0 , kern) ?0 : -ENOMEM ; + sk =__vsock_create (net, sock,NULL ,GFP_KERNEL ,0 , kern); +if (!sk) +return -ENOMEM ; + +vsock_insert_unbound (vsock_sk (sk)); + +return 0 ; }static const struct net_proto_family vsock_family_ops = {
Signature · 1 line
2.21.0
Stefano Garzarella
maintainerRFC PATCH 8/13 vsock: move vsock_insert_unbound() in the vsock_create()
In reply to Stefano Garzarellavsock_insert_unbound() was called only when 'sock' parameter of __vsock_create() was not null. This only happened when __vsock_create() was called by vsock_create().
In order to simplify the multi-transports support, this patch moves vsock_insert_unbound() at the end of vsock_create().
--- net/vmw_vsock/af_vsock.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
net/vmw_vsock/af_vsock.c +9 -4
@@ -634,9 +634,6 @@ struct sock *__vsock_create(struct net *net,return NULL ; } -if (sock) -vsock_insert_unbound (vsk); -return sk; }EXPORT_SYMBOL_GPL (__vsock_create);
@@ -1875,6 +1872,8 @@ static const struct proto_ops vsock_stream_ops = {static int vsock_create (struct net *net,struct socket *sock,int protocol,int kern) { +struct sock *sk; +if (!sock)return -EINVAL ;
@@ -1894,7 +1893,13 @@ static int vsock_create(struct net *net, struct socket *sock, sock->state =SS_UNCONNECTED ; -return __vsock_create (net, sock,NULL ,GFP_KERNEL ,0 , kern) ?0 : -ENOMEM ; + sk =__vsock_create (net, sock,NULL ,GFP_KERNEL ,0 , kern); +if (!sk) +return -ENOMEM ; + +vsock_insert_unbound (vsock_sk (sk)); + +return 0 ; }static const struct net_proto_family vsock_family_ops = {
Signature · 1 line
2.21.0
RE: [RFC PATCH 08/13] vsock: move vsock_insert_unbound() in the vsock_create()
Quoted 7 lines
From: Stefano Garzarella <[email protected]>
Sent: Friday, September 27, 2019 4:27 AM
vsock_insert_unbound()was called only when 'sock' parameter of__vsock_create()was not null. This only happened when__vsock_create()was called byvsock_create().
Quoted 8 lines
In order to simplify the multi-transports support, this patch moves
vsock_insert_unbound()at the end ofvsock_create().Signed-off-by Stefano Garzarella <[email protected]>--- net/vmw_vsock/af_vsock.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
Re: [RFC PATCH 08/13] vsock: move vsock_insert_unbound() in the vsock_create()
In reply to Stefano GarzarellaQuoted 11 lines · Stefano Garzarella
vsock_insert_unbound()was called only when 'sock' parameter of__vsock_create()was not null. This only happened when__vsock_create()was called byvsock_create().In order to simplify the multi-transports support, this patch moves
vsock_insert_unbound()at the end ofvsock_create().Signed-off-by Stefano Garzarella <[email protected]>--- net/vmw_vsock/af_vsock.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
Maybe transports shouldn't call __vsock_create() directly. They always pass NULL as the parent socket, so we could have a more specific function that transports call without a parent sock argument. This would eliminate any concern over moving vsock_insert_unbound() out of this function. In any case, I've checked the code and this patch is correct.
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [RFC PATCH 08/13] vsock: move vsock_insert_unbound() in the vsock_create()
In reply to Stefano GarzarellaQuoted 11 lines · Stefano Garzarella
vsock_insert_unbound()was called only when 'sock' parameter of__vsock_create()was not null. This only happened when__vsock_create()was called byvsock_create().In order to simplify the multi-transports support, this patch moves
vsock_insert_unbound()at the end ofvsock_create().Signed-off-by Stefano Garzarella <[email protected]>--- net/vmw_vsock/af_vsock.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
Maybe transports shouldn't call __vsock_create() directly. They always pass NULL as the parent socket, so we could have a more specific function that transports call without a parent sock argument. This would eliminate any concern over moving vsock_insert_unbound() out of this function. In any case, I've checked the code and this patch is correct.
Stefano Garzarella
maintainerRe: [RFC PATCH 08/13] vsock: move vsock_insert_unbound() in the vsock_create()
Quoted 13 lines · Stefan Hajnoczi
Quoted 11 lines · Stefano Garzarella
vsock_insert_unbound()was called only when 'sock' parameter of__vsock_create()was not null. This only happened when__vsock_create()was called byvsock_create().In order to simplify the multi-transports support, this patch moves
vsock_insert_unbound()at the end ofvsock_create().Signed-off-by Stefano Garzarella <[email protected]>--- net/vmw_vsock/af_vsock.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
Quoted 6 lines
Maybe transports shouldn't call
__vsock_create()directly. They always pass NULL as the parent socket, so we could have a more specific function that transports call without a parent sock argument. This would eliminate any concern over movingvsock_insert_unbound()out of this function. In any case, I've checked the code and this patch is correct.
Yes, I agree with you, I can add a new patch to do this cleaning.
Quoted 2 lines
Reviewed-by Stefan Hajnoczi <[email protected]>
Thanks,
Stefano
Stefano Garzarella
maintainerRe: [RFC PATCH 08/13] vsock: move vsock_insert_unbound() in the vsock_create()
In reply to Stefan HajnocziQuoted 13 lines · Stefan Hajnoczi
Quoted 11 lines · Stefano Garzarella
vsock_insert_unbound()was called only when 'sock' parameter of__vsock_create()was not null. This only happened when__vsock_create()was called byvsock_create().In order to simplify the multi-transports support, this patch moves
vsock_insert_unbound()at the end ofvsock_create().Signed-off-by Stefano Garzarella <[email protected]>--- net/vmw_vsock/af_vsock.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
Quoted 6 lines
Maybe transports shouldn't call
__vsock_create()directly. They always pass NULL as the parent socket, so we could have a more specific function that transports call without a parent sock argument. This would eliminate any concern over movingvsock_insert_unbound()out of this function. In any case, I've checked the code and this patch is correct.
Yes, I agree with you, I can add a new patch to do this cleaning.
Quoted 2 lines
Reviewed-by Stefan Hajnoczi <[email protected]>
Thanks,
Stefano
Stefano Garzarella
maintainerRFC PATCH 9/13 hv_sock: set VMADDR_CID_HOST in the hvs_remote_addr_init()
In reply to Stefano GarzarellaRemote peer is always the host, so we set VMADDR_CID_HOST as remote CID instead of VMADDR_CID_ANY.
--- net/vmw_vsock/hyperv_transport.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/vmw_vsock/hyperv_transport.c +2 -1
@@ -186,7 +186,8 @@ static void hvs_remote_addr_init(struct sockaddr_vm *remote,static u32 host_ephemeral_port =MIN_HOST_EPHEMERAL_PORT ;struct sock *sk; -vsock_addr_init (remote,VMADDR_CID_ANY ,VMADDR_PORT_ANY ); +/* Remote peer is always the host */ +vsock_addr_init (remote,VMADDR_CID_HOST ,VMADDR_PORT_ANY );while (1 ) {/* Wrap around ? */
Signature · 1 line
2.21.0
Stefano Garzarella
maintainerRFC PATCH 9/13 hv_sock: set VMADDR_CID_HOST in the hvs_remote_addr_init()
In reply to Stefano GarzarellaRemote peer is always the host, so we set VMADDR_CID_HOST as remote CID instead of VMADDR_CID_ANY.
--- net/vmw_vsock/hyperv_transport.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/vmw_vsock/hyperv_transport.c +2 -1
@@ -186,7 +186,8 @@ static void hvs_remote_addr_init(struct sockaddr_vm *remote,static u32 host_ephemeral_port =MIN_HOST_EPHEMERAL_PORT ;struct sock *sk; -vsock_addr_init (remote,VMADDR_CID_ANY ,VMADDR_PORT_ANY ); +/* Remote peer is always the host */ +vsock_addr_init (remote,VMADDR_CID_HOST ,VMADDR_PORT_ANY );while (1 ) {/* Wrap around ? */
Signature · 1 line
2.21.0
RE: [RFC PATCH 09/13] hv_sock: set VMADDR_CID_HOST in the hvs_remote_addr_init()
Quoted 37 lines
From: Stefano Garzarella <[email protected]>
Sent: Friday, September 27, 2019 4:27 AM
To: [email protected]
Cc: [email protected]; KY Srinivasan <[email protected]>; Stefan Hajnoczi <[email protected]>; Sasha Levin <[email protected]>; [email protected]; [email protected]; David S. Miller <[email protected]>; [email protected]; Stephen Hemminger <[email protected]>; Jason Wang <[email protected]>; Michael S. Tsirkin <[email protected]>; Haiyang Zhang <[email protected]>; Dexuan Cui <[email protected]>; Jorgen Hansen <[email protected]>
Subject: [RFC PATCH 09/13]hv_sock: setVMADDR_CID_HOSTin thehvs_remote_addr_init()Remote peer is always the host, so we set
VMADDR_CID_HOSTas remote CID instead ofVMADDR_CID_ANY.Signed-off-by Stefano Garzarella <[email protected]>--- net/vmw_vsock/hyperv_transport.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)net/vmw_vsock/hyperv_transport.c +2
-1@@ -186,7 +186,8 @@ static void hvs_remote_addr_init(struct sockaddr_vm *remote, static u32 host_ephemeral_port = MIN_HOST_EPHEMERAL_PORT;struct sock *sk; -vsock_addr_init (remote,VMADDR_CID_ANY ,VMADDR_PORT_ANY ); +/* Remote peer is always the host */ +vsock_addr_init (remote,VMADDR_CID_HOST ,VMADDR_PORT_ANY );while (1 ) {
Quoted 2 lines
/* Wrap around ? */
--
Looks good to me, since hv_sock doesn't really use the CID in the transport layer.
Re: [RFC PATCH 09/13] hv_sock: set VMADDR_CID_HOST in the hvs_remote_addr_init()
In reply to Stefano GarzarellaQuoted 7 lines · Stefano Garzarella
Remote peer is always the host, so we set
VMADDR_CID_HOSTas remote CID instead ofVMADDR_CID_ANY.Signed-off-by Stefano Garzarella <[email protected]>--- net/vmw_vsock/hyperv_transport.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Stefano Garzarella
maintainerRFC PATCH 10/13 vsock: add multi-transports support
In reply to Stefano GarzarellaThis patch adds the support of multiple transports in the VSOCK core.
With the multi-transports support, we can use vsock with nested VMs (using also different hypervisors) loading both guest->host and host->guest transports at the same time.
Major changes:
- vsock core module can be loaded interdependently of the transports
- each 'struct virtio_transport' has a new feature fields (H2G, G2H, DGRAM) to identify which directions the transport can handle and if it's support DGRAM (only vmci)
- vsock_core_init() and vsock_core_exit() are renamed to vsock_core_register() and vsock_core_unregister()
- each stream socket is assigned to a transport when the remote CID is set (during the connect() or when we receive a connection request on a listener socket).
The remote CID is used to decide which transport to use:
- remote CID > VMADDR_CID_HOST will use host->guest transport
- remote CID <= VMADDR_CID_HOST will use guest->host transport
- listener sockets are not bound to any transports since no transport operations are done on it. In this way we can create a listener socket, also if the transports are not loaded or with VMADDR_CID_ANY to listen on all transports.
- DGRAM sockets are handled as before, since only the vmci_transport provides this feature.
---
RFC:
- I'd like to move MODULE_ALIAS_NETPROTO(PF_VSOCK) to af_vsock.c. @Jorgen could this break the VMware products?
- DGRAM sockets are handled as before, I don't know if make sense work on it now, or when another transport will support DGRAM. The big issues here is that we cannot link 1-1 a socket to transport as for stream sockets since DGRAM is not connection-oriented.
--- drivers/vhost/vsock.c | 6 +- include/net/af_vsock.h | 15 +- net/vmw_vsock/af_vsock.c | 240 ++++++++++++++++++------ net/vmw_vsock/hyperv_transport.c | 28 ++- net/vmw_vsock/virtio_transport.c | 8 +- net/vmw_vsock/virtio_transport_common.c | 28 ++- net/vmw_vsock/vmci_transport.c | 31 ++- 7 files changed, 275 insertions(+), 81 deletions(-)
drivers/vhost/vsock.c +4 -2
@@ -386,6 +386,8 @@ static bool vhost_vsock_more_replies(struct vhost_vsock *vsock)static struct virtio_transport vhost_transport = { .transport = { + .features =VSOCK_TRANSPORT_F_H2G , + .get_local_cid = vhost_transport_get_local_cid, .init = virtio_transport_do_socket_init,
@@ -831,7 +833,7 @@ static int __init vhost_vsock_init(void) {int ret; - ret =vsock_core_init (&vhost_transport.transport); + ret =vsock_core_register (&vhost_transport.transport);if (ret <0 )return ret;return misc_register (&vhost_vsock_misc);
@@ -840,7 +842,7 @@ static int __init vhost_vsock_init(void) static void __exit vhost_vsock_exit(void) {misc_deregister (&vhost_vsock_misc); -vsock_core_exit (); +vsock_core_unregister (&vhost_transport.transport); };module_init (vhost_vsock_init);
include/net/af_vsock.h +9 -6
@@ -94,7 +94,13 @@ struct vsock_transport_send_notify_data {u64 data2;/* Transport-defined. */ }; +#define VSOCK_TRANSPORT_F_H2G 0x00000001 +#define VSOCK_TRANSPORT_F_G2H 0x00000002 +#define VSOCK_TRANSPORT_F_DGRAM 0x00000004 +struct vsock_transport { +uint64_t features; +/* Initialize/tear-down socket. */ int (*init)(struct vsock_sock *,struct vsock_sock *);void (*destruct)(struct vsock_sock *);
@@ -156,12 +162,8 @@ struct vsock_transport {/**** CORE ****/ -int __vsock_core_init (const struct vsock_transport *t,struct module *owner); -static inline int vsock_core_init (const struct vsock_transport *t) -{ -return __vsock_core_init (t,THIS_MODULE ); -} -void vsock_core_exit (void ); +int vsock_core_register (const struct vsock_transport *t); +void vsock_core_unregister (const struct vsock_transport *t);/* The transport may downcast this to access transport-specific functions */ const struct vsock_transport *vsock_core_get_transport (struct vsock_sock *vsk);
@@ -192,6 +194,7 @@ struct sock *vsock_find_connected_socket(struct sockaddr_vm *src, struct sockaddr_vm *dst);void vsock_remove_sock (struct vsock_sock *vsk);void vsock_for_each_connected_socket (void (*fn)(struct sock *sk)); +int vsock_assign_transport (struct vsock_sock *vsk,struct vsock_sock *psk);/**** TAP ****/
net/vmw_vsock/af_vsock.c +181 -59
406 lines not on this page · raw message
net/vmw_vsock/hyperv_transport.c +23 -5
@@ -163,6 +163,8 @@ static const guid_t srv_id_template =GUID_INIT (0x00000000 ,0xfacb ,0x11e6 ,0xbd ,0x58 ,0x64 ,0x00 ,0x6a ,0x79 ,0x86 ,0xd3 ); +static bool hvs_check_transport (struct vsock_sock *vsk); +static bool is_valid_srv_id (const guid_t *id) {return !memcmp (&id->b[4 ], &srv_id_template.b[4 ],sizeof (guid_t) -4 );
@@ -366,6 +368,18 @@ static void hvs_open_connection(struct vmbus_channel *chan) new->sk_state =TCP_SYN_SENT ; vnew =vsock_sk (new); + +hvs_addr_init (&vnew->local_addr, if_type); +hvs_remote_addr_init (&vnew->remote_addr, &vnew->local_addr); + + ret =vsock_assign_transport (vnew,vsock_sk (sk)); +/* Transport assigned (looking at remote_addr) must be the +* same where we received the request. +*/ +if (ret || !hvs_check_transport (vnew)) { +sock_put (new); + goto out; + } hvs_new = vnew->trans; hvs_new->chan = chan; }else {
@@ -429,9 +443,6 @@ static void hvs_open_connection(struct vmbus_channel *chan) new->sk_state =TCP_ESTABLISHED ; sk->sk_ack_backlog++; -hvs_addr_init (&vnew->local_addr, if_type); -hvs_remote_addr_init (&vnew->remote_addr, &vnew->local_addr); - hvs_new->vm_srv_id = *if_type; hvs_new->host_srv_id = *if_instance;
@@ -845,6 +856,8 @@ int hvs_notify_send_post_enqueue(struct vsock_sock *vsk, ssize_t written, }static struct vsock_transport hvs_transport = { + .features =VSOCK_TRANSPORT_F_G2H , + .get_local_cid = hvs_get_local_cid, .init = hvs_sock_init,
@@ -879,6 +892,11 @@ static struct vsock_transport hvs_transport = { }; +static bool hvs_check_transport (struct vsock_sock *vsk) +{ +return vsk->transport == &hvs_transport; +} +static int hvs_probe (struct hv_device *hdev,const struct hv_vmbus_device_id *dev_id) {
@@ -927,7 +945,7 @@ static int __init hvs_init(void)if (ret !=0 )return ret; - ret =vsock_core_init (&hvs_transport); + ret =vsock_core_register (&hvs_transport);if (ret) {vmbus_driver_unregister (&hvs_drv);return ret;
@@ -938,7 +956,7 @@ static int __init hvs_init(void) static void __exit hvs_exit(void) { -vsock_core_exit (); +vsock_core_unregister (&hvs_transport);vmbus_driver_unregister (&hvs_drv); }
net/vmw_vsock/virtio_transport.c +5 -3
@@ -462,6 +462,8 @@ static void virtio_vsock_rx_done(struct virtqueue *vq)static struct virtio_transport virtio_transport = { .transport = { + .features =VSOCK_TRANSPORT_F_G2H , + .get_local_cid = virtio_transport_get_local_cid, .init = virtio_transport_do_socket_init,
@@ -770,7 +772,7 @@ static int __init virtio_vsock_init(void)if (!virtio_vsock_workqueue)return -ENOMEM ; - ret =vsock_core_init (&virtio_transport.transport); + ret =vsock_core_register (&virtio_transport.transport);if (ret) goto out_wq;
@@ -781,7 +783,7 @@ static int __init virtio_vsock_init(void)return 0 ; out_vci: -vsock_core_exit (); +vsock_core_unregister (&virtio_transport.transport); out_wq:destroy_workqueue (virtio_vsock_workqueue);return ret;
@@ -790,7 +792,7 @@ static int __init virtio_vsock_init(void) static void __exit virtio_vsock_exit(void) {unregister_virtio_driver (&virtio_vsock_driver); -vsock_core_exit (); +vsock_core_unregister (&virtio_transport.transport);destroy_workqueue (virtio_vsock_workqueue); }
net/vmw_vsock/virtio_transport_common.c +25 -3
@@ -400,7 +400,7 @@ int virtio_transport_do_socket_init(struct vsock_sock *vsk, vsk->trans = vvs; vvs->vsk = vsk; -if (psk) { +if (psk && psk->trans) {struct virtio_vsock_sock *ptrans = psk->trans; vvs->peer_buf_alloc = ptrans->peer_buf_alloc;
@@ -927,11 +927,13 @@ virtio_transport_send_response(struct vsock_sock *vsk,/* Handle server socket */ static int -virtio_transport_recv_listen (struct sock *sk,struct virtio_vsock_pkt *pkt) +virtio_transport_recv_listen (struct sock *sk,struct virtio_vsock_pkt *pkt, +struct virtio_transport *t) {struct vsock_sock *vsk =vsock_sk (sk);struct vsock_sock *vchild;struct sock *child; +int ret;if (le16_to_cpu (pkt->hdr.op) !=VIRTIO_VSOCK_OP_REQUEST ) {virtio_transport_reset (vsk, pkt);
@@ -962,6 +964,17 @@ virtio_transport_recv_listen(struct sock *sk, struct virtio_vsock_pkt *pkt)vsock_addr_init (&vchild->remote_addr,le64_to_cpu (pkt->hdr.src_cid),le32_to_cpu (pkt->hdr.src_port)); + ret =vsock_assign_transport (vchild, vsk); +/* Transport assigned (looking at remote_addr) must be the same +* where we received the request. +*/ +if (ret || vchild->transport != &t->transport) { +release_sock (child); +virtio_transport_reset (vsk, pkt); +sock_put (child); +return ret; + } +vsock_insert_connected (vchild);vsock_enqueue_accept (sk, child);virtio_transport_send_response (vchild, pkt);
@@ -979,6 +992,14 @@ static bool virtio_transport_space_update(struct sock *sk,struct virtio_vsock_sock *vvs = vsk->trans;bool space_available; +/* Listener sockets are not associated with any transport, so we are +* not able to take the state to see if there is space available in the +* remote peer, but since they are only used to receive requests, we +* can assume that there is always space available in the other peer. +*/ +if (!vvs) +return true; +/* buf_alloc and fwd_cnt is always included in the hdr */ spin_lock_bh (&vvs->tx_lock); vvs->peer_buf_alloc =le32_to_cpu (pkt->hdr.buf_alloc);
@@ -1044,7 +1065,7 @@ void virtio_transport_recv_pkt(struct virtio_transport *t,switch (sk->sk_state) {case TCP_LISTEN : -virtio_transport_recv_listen (sk, pkt); +virtio_transport_recv_listen (sk, pkt, t);virtio_transport_free_pkt (pkt);break ;case TCP_SYN_SENT :
@@ -1062,6 +1083,7 @@ void virtio_transport_recv_pkt(struct virtio_transport *t,virtio_transport_free_pkt (pkt);break ; } +release_sock (sk);/* Release refcnt obtained when we fetched this socket out of the
net/vmw_vsock/vmci_transport.c +28 -3
@@ -57,6 +57,7 @@ static bool vmci_transport_old_proto_override(bool *old_pkt_proto);static u16 vmci_transport_new_proto_supported_versions (void );static bool vmci_transport_proto_to_notify_struct (struct sock *sk,u16 *proto,bool old_pkt_proto); +static bool vmci_check_transport (struct vsock_sock *vsk);struct vmci_transport_recv_pkt_info {struct work_struct work;
@@ -1018,6 +1019,15 @@ static int vmci_transport_recv_listen(struct sock *sk,vsock_addr_init (&vpending->remote_addr, pkt->dg.src.context, pkt->src_port); + err =vsock_assign_transport (vpending,vsock_sk (sk)); +/* Transport assigned (looking at remote_addr) must be the same +* where we received the request. +*/ +if (err || !vmci_check_transport (vpending)) { +sock_put (pending); +return err; + } +/* If the proposed size fits within our min/max, accept it. Otherwise * propose our own size. */
@@ -2009,7 +2019,8 @@ static u32 vmci_transport_get_local_cid(void)return vmci_get_context_id (); } -static const struct vsock_transport vmci_transport = { +static struct vsock_transport vmci_transport = { + .features =VSOCK_TRANSPORT_F_DGRAM |VSOCK_TRANSPORT_F_H2G , .init = vmci_transport_socket_init, .destruct = vmci_transport_destruct, .release = vmci_transport_release,
@@ -2039,10 +2050,24 @@ static const struct vsock_transport vmci_transport = { .get_local_cid = vmci_transport_get_local_cid, }; +static bool vmci_check_transport (struct vsock_sock *vsk) +{ +return vsk->transport == &vmci_transport; +} +static int __init vmci_transport_init (void ) { +int cid;int err; + cid =vmci_get_context_id (); + +if (cid ==VMCI_INVALID_ID ) +return -EINVAL ; + +if (cid !=VMCI_HOST_CONTEXT_ID ) + vmci_transport.features |=VSOCK_TRANSPORT_F_G2H ; +/* Create the datagram handle that we will use to send and receive all * VSocket control messages for this context. */
@@ -2066,7 +2091,7 @@ static int __init vmci_transport_init(void) goto err_destroy_stream_handle; } - err =vsock_core_init (&vmci_transport); + err =vsock_core_register (&vmci_transport);if (err <0 ) goto err_unsubscribe;
@@ -2097,7 +2122,7 @@ static void __exit vmci_transport_exit(void) vmci_transport_qp_resumed_sub_id =VMCI_INVALID_ID ; } -vsock_core_exit (); +vsock_core_unregister (&vmci_transport); }module_exit (vmci_transport_exit);
Signature · 1 line
2.21.0
Stefano Garzarella
maintainerRFC PATCH 10/13 vsock: add multi-transports support
In reply to Stefano GarzarellaThis patch adds the support of multiple transports in the VSOCK core.
With the multi-transports support, we can use vsock with nested VMs (using also different hypervisors) loading both guest->host and host->guest transports at the same time.
Major changes:
- vsock core module can be loaded interdependently of the transports
- each 'struct virtio_transport' has a new feature fields (H2G, G2H, DGRAM) to identify which directions the transport can handle and if it's support DGRAM (only vmci)
- vsock_core_init() and vsock_core_exit() are renamed to vsock_core_register() and vsock_core_unregister()
- each stream socket is assigned to a transport when the remote CID is set (during the connect() or when we receive a connection request on a listener socket).
The remote CID is used to decide which transport to use:
- remote CID > VMADDR_CID_HOST will use host->guest transport
- remote CID <= VMADDR_CID_HOST will use guest->host transport
- listener sockets are not bound to any transports since no transport operations are done on it. In this way we can create a listener socket, also if the transports are not loaded or with VMADDR_CID_ANY to listen on all transports.
- DGRAM sockets are handled as before, since only the vmci_transport provides this feature.
---
RFC:
- I'd like to move MODULE_ALIAS_NETPROTO(PF_VSOCK) to af_vsock.c. @Jorgen could this break the VMware products?
- DGRAM sockets are handled as before, I don't know if make sense work on it now, or when another transport will support DGRAM. The big issues here is that we cannot link 1-1 a socket to transport as for stream sockets since DGRAM is not connection-oriented.
--- drivers/vhost/vsock.c | 6 +- include/net/af_vsock.h | 15 +- net/vmw_vsock/af_vsock.c | 240 ++++++++++++++++++------ net/vmw_vsock/hyperv_transport.c | 28 ++- net/vmw_vsock/virtio_transport.c | 8 +- net/vmw_vsock/virtio_transport_common.c | 28 ++- net/vmw_vsock/vmci_transport.c | 31 ++- 7 files changed, 275 insertions(+), 81 deletions(-)
drivers/vhost/vsock.c +4 -2
@@ -386,6 +386,8 @@ static bool vhost_vsock_more_replies(struct vhost_vsock *vsock)static struct virtio_transport vhost_transport = { .transport = { + .features =VSOCK_TRANSPORT_F_H2G , + .get_local_cid = vhost_transport_get_local_cid, .init = virtio_transport_do_socket_init,
@@ -831,7 +833,7 @@ static int __init vhost_vsock_init(void) {int ret; - ret =vsock_core_init (&vhost_transport.transport); + ret =vsock_core_register (&vhost_transport.transport);if (ret <0 )return ret;return misc_register (&vhost_vsock_misc);
@@ -840,7 +842,7 @@ static int __init vhost_vsock_init(void) static void __exit vhost_vsock_exit(void) {misc_deregister (&vhost_vsock_misc); -vsock_core_exit (); +vsock_core_unregister (&vhost_transport.transport); };module_init (vhost_vsock_init);
include/net/af_vsock.h +9 -6
@@ -94,7 +94,13 @@ struct vsock_transport_send_notify_data {u64 data2;/* Transport-defined. */ }; +#define VSOCK_TRANSPORT_F_H2G 0x00000001 +#define VSOCK_TRANSPORT_F_G2H 0x00000002 +#define VSOCK_TRANSPORT_F_DGRAM 0x00000004 +struct vsock_transport { +uint64_t features; +/* Initialize/tear-down socket. */ int (*init)(struct vsock_sock *,struct vsock_sock *);void (*destruct)(struct vsock_sock *);
@@ -156,12 +162,8 @@ struct vsock_transport {/**** CORE ****/ -int __vsock_core_init (const struct vsock_transport *t,struct module *owner); -static inline int vsock_core_init (const struct vsock_transport *t) -{ -return __vsock_core_init (t,THIS_MODULE ); -} -void vsock_core_exit (void ); +int vsock_core_register (const struct vsock_transport *t); +void vsock_core_unregister (const struct vsock_transport *t);/* The transport may downcast this to access transport-specific functions */ const struct vsock_transport *vsock_core_get_transport (struct vsock_sock *vsk);
@@ -192,6 +194,7 @@ struct sock *vsock_find_connected_socket(struct sockaddr_vm *src, struct sockaddr_vm *dst);void vsock_remove_sock (struct vsock_sock *vsk);void vsock_for_each_connected_socket (void (*fn)(struct sock *sk)); +int vsock_assign_transport (struct vsock_sock *vsk,struct vsock_sock *psk);/**** TAP ****/
net/vmw_vsock/af_vsock.c +181 -59
406 lines not on this page · raw message
net/vmw_vsock/hyperv_transport.c +23 -5
@@ -163,6 +163,8 @@ static const guid_t srv_id_template =GUID_INIT (0x00000000 ,0xfacb ,0x11e6 ,0xbd ,0x58 ,0x64 ,0x00 ,0x6a ,0x79 ,0x86 ,0xd3 ); +static bool hvs_check_transport (struct vsock_sock *vsk); +static bool is_valid_srv_id (const guid_t *id) {return !memcmp (&id->b[4 ], &srv_id_template.b[4 ],sizeof (guid_t) -4 );
@@ -366,6 +368,18 @@ static void hvs_open_connection(struct vmbus_channel *chan) new->sk_state =TCP_SYN_SENT ; vnew =vsock_sk (new); + +hvs_addr_init (&vnew->local_addr, if_type); +hvs_remote_addr_init (&vnew->remote_addr, &vnew->local_addr); + + ret =vsock_assign_transport (vnew,vsock_sk (sk)); +/* Transport assigned (looking at remote_addr) must be the +* same where we received the request. +*/ +if (ret || !hvs_check_transport (vnew)) { +sock_put (new); + goto out; + } hvs_new = vnew->trans; hvs_new->chan = chan; }else {
@@ -429,9 +443,6 @@ static void hvs_open_connection(struct vmbus_channel *chan) new->sk_state =TCP_ESTABLISHED ; sk->sk_ack_backlog++; -hvs_addr_init (&vnew->local_addr, if_type); -hvs_remote_addr_init (&vnew->remote_addr, &vnew->local_addr); - hvs_new->vm_srv_id = *if_type; hvs_new->host_srv_id = *if_instance;
@@ -845,6 +856,8 @@ int hvs_notify_send_post_enqueue(struct vsock_sock *vsk, ssize_t written, }static struct vsock_transport hvs_transport = { + .features =VSOCK_TRANSPORT_F_G2H , + .get_local_cid = hvs_get_local_cid, .init = hvs_sock_init,
@@ -879,6 +892,11 @@ static struct vsock_transport hvs_transport = { }; +static bool hvs_check_transport (struct vsock_sock *vsk) +{ +return vsk->transport == &hvs_transport; +} +static int hvs_probe (struct hv_device *hdev,const struct hv_vmbus_device_id *dev_id) {
@@ -927,7 +945,7 @@ static int __init hvs_init(void)if (ret !=0 )return ret; - ret =vsock_core_init (&hvs_transport); + ret =vsock_core_register (&hvs_transport);if (ret) {vmbus_driver_unregister (&hvs_drv);return ret;
@@ -938,7 +956,7 @@ static int __init hvs_init(void) static void __exit hvs_exit(void) { -vsock_core_exit (); +vsock_core_unregister (&hvs_transport);vmbus_driver_unregister (&hvs_drv); }
net/vmw_vsock/virtio_transport.c +5 -3
@@ -462,6 +462,8 @@ static void virtio_vsock_rx_done(struct virtqueue *vq)static struct virtio_transport virtio_transport = { .transport = { + .features =VSOCK_TRANSPORT_F_G2H , + .get_local_cid = virtio_transport_get_local_cid, .init = virtio_transport_do_socket_init,
@@ -770,7 +772,7 @@ static int __init virtio_vsock_init(void)if (!virtio_vsock_workqueue)return -ENOMEM ; - ret =vsock_core_init (&virtio_transport.transport); + ret =vsock_core_register (&virtio_transport.transport);if (ret) goto out_wq;
@@ -781,7 +783,7 @@ static int __init virtio_vsock_init(void)return 0 ; out_vci: -vsock_core_exit (); +vsock_core_unregister (&virtio_transport.transport); out_wq:destroy_workqueue (virtio_vsock_workqueue);return ret;
@@ -790,7 +792,7 @@ static int __init virtio_vsock_init(void) static void __exit virtio_vsock_exit(void) {unregister_virtio_driver (&virtio_vsock_driver); -vsock_core_exit (); +vsock_core_unregister (&virtio_transport.transport);destroy_workqueue (virtio_vsock_workqueue); }
net/vmw_vsock/virtio_transport_common.c +25 -3
@@ -400,7 +400,7 @@ int virtio_transport_do_socket_init(struct vsock_sock *vsk, vsk->trans = vvs; vvs->vsk = vsk; -if (psk) { +if (psk && psk->trans) {struct virtio_vsock_sock *ptrans = psk->trans; vvs->peer_buf_alloc = ptrans->peer_buf_alloc;
@@ -927,11 +927,13 @@ virtio_transport_send_response(struct vsock_sock *vsk,/* Handle server socket */ static int -virtio_transport_recv_listen (struct sock *sk,struct virtio_vsock_pkt *pkt) +virtio_transport_recv_listen (struct sock *sk,struct virtio_vsock_pkt *pkt, +struct virtio_transport *t) {struct vsock_sock *vsk =vsock_sk (sk);struct vsock_sock *vchild;struct sock *child; +int ret;if (le16_to_cpu (pkt->hdr.op) !=VIRTIO_VSOCK_OP_REQUEST ) {virtio_transport_reset (vsk, pkt);
@@ -962,6 +964,17 @@ virtio_transport_recv_listen(struct sock *sk, struct virtio_vsock_pkt *pkt)vsock_addr_init (&vchild->remote_addr,le64_to_cpu (pkt->hdr.src_cid),le32_to_cpu (pkt->hdr.src_port)); + ret =vsock_assign_transport (vchild, vsk); +/* Transport assigned (looking at remote_addr) must be the same +* where we received the request. +*/ +if (ret || vchild->transport != &t->transport) { +release_sock (child); +virtio_transport_reset (vsk, pkt); +sock_put (child); +return ret; + } +vsock_insert_connected (vchild);vsock_enqueue_accept (sk, child);virtio_transport_send_response (vchild, pkt);
@@ -979,6 +992,14 @@ static bool virtio_transport_space_update(struct sock *sk,struct virtio_vsock_sock *vvs = vsk->trans;bool space_available; +/* Listener sockets are not associated with any transport, so we are +* not able to take the state to see if there is space available in the +* remote peer, but since they are only used to receive requests, we +* can assume that there is always space available in the other peer. +*/ +if (!vvs) +return true; +/* buf_alloc and fwd_cnt is always included in the hdr */ spin_lock_bh (&vvs->tx_lock); vvs->peer_buf_alloc =le32_to_cpu (pkt->hdr.buf_alloc);
@@ -1044,7 +1065,7 @@ void virtio_transport_recv_pkt(struct virtio_transport *t,switch (sk->sk_state) {case TCP_LISTEN : -virtio_transport_recv_listen (sk, pkt); +virtio_transport_recv_listen (sk, pkt, t);virtio_transport_free_pkt (pkt);break ;case TCP_SYN_SENT :
@@ -1062,6 +1083,7 @@ void virtio_transport_recv_pkt(struct virtio_transport *t,virtio_transport_free_pkt (pkt);break ; } +release_sock (sk);/* Release refcnt obtained when we fetched this socket out of the
net/vmw_vsock/vmci_transport.c +28 -3
@@ -57,6 +57,7 @@ static bool vmci_transport_old_proto_override(bool *old_pkt_proto);static u16 vmci_transport_new_proto_supported_versions (void );static bool vmci_transport_proto_to_notify_struct (struct sock *sk,u16 *proto,bool old_pkt_proto); +static bool vmci_check_transport (struct vsock_sock *vsk);struct vmci_transport_recv_pkt_info {struct work_struct work;
@@ -1018,6 +1019,15 @@ static int vmci_transport_recv_listen(struct sock *sk,vsock_addr_init (&vpending->remote_addr, pkt->dg.src.context, pkt->src_port); + err =vsock_assign_transport (vpending,vsock_sk (sk)); +/* Transport assigned (looking at remote_addr) must be the same +* where we received the request. +*/ +if (err || !vmci_check_transport (vpending)) { +sock_put (pending); +return err; + } +/* If the proposed size fits within our min/max, accept it. Otherwise * propose our own size. */
@@ -2009,7 +2019,8 @@ static u32 vmci_transport_get_local_cid(void)return vmci_get_context_id (); } -static const struct vsock_transport vmci_transport = { +static struct vsock_transport vmci_transport = { + .features =VSOCK_TRANSPORT_F_DGRAM |VSOCK_TRANSPORT_F_H2G , .init = vmci_transport_socket_init, .destruct = vmci_transport_destruct, .release = vmci_transport_release,
@@ -2039,10 +2050,24 @@ static const struct vsock_transport vmci_transport = { .get_local_cid = vmci_transport_get_local_cid, }; +static bool vmci_check_transport (struct vsock_sock *vsk) +{ +return vsk->transport == &vmci_transport; +} +static int __init vmci_transport_init (void ) { +int cid;int err; + cid =vmci_get_context_id (); + +if (cid ==VMCI_INVALID_ID ) +return -EINVAL ; + +if (cid !=VMCI_HOST_CONTEXT_ID ) + vmci_transport.features |=VSOCK_TRANSPORT_F_G2H ; +/* Create the datagram handle that we will use to send and receive all * VSocket control messages for this context. */
@@ -2066,7 +2091,7 @@ static int __init vmci_transport_init(void) goto err_destroy_stream_handle; } - err =vsock_core_init (&vmci_transport); + err =vsock_core_register (&vmci_transport);if (err <0 ) goto err_unsubscribe;
@@ -2097,7 +2122,7 @@ static void __exit vmci_transport_exit(void) vmci_transport_qp_resumed_sub_id =VMCI_INVALID_ID ; } -vsock_core_exit (); +vsock_core_unregister (&vmci_transport); }module_exit (vmci_transport_exit);
Signature · 1 line
2.21.0
Quoted 3 lines · Stefano Garzarella
RFC:
- I'd like to moveMODULE_ALIAS_NETPROTO(PF_VSOCK)toaf_vsock.c. @Jorgen could this break the VMware products?
What will cause the vmw_vsock_vmci_transport.ko module to be loaded after you remove MODULE_ALIAS_NETPROTO(PF_VSOCK)? Perhaps drivers/misc/vmw_vmci/vmci_guest.c:vmci_guest_probe_device() could do something when the guest driver loads. There would need to be something equivalent for the host side too.
This will solve another issue too. Today the VMCI transport can be loaded if an application creates an AF_VSOCK socket during early boot before the virtio transport has been probed. This happens because the VMCI transport uses MODULE_ALIAS_NETPROTO(PF_VSOCK) *and* it does not probe whether this system is actually a VMware guest.
If we instead load the core af_vsock.ko module and transports are only loaded based on hardware feature probing (e.g. the presence of VMware guest mode, a virtio PCI adapter, etc) then transports will be well-behaved.
Quoted 4 lines
- DGRAM sockets are handled as before, I don't know if make sense work on it now, or when another transport will support DGRAM. The big issues here is that we cannot link 1-1 a socket to transport as for stream sockets since DGRAM is not connection-oriented.
Let's ignore DGRAM for now since only VMCI supports it and we therefore do not require multi-transport support.
include/net/af_vsock.h struct vsock_transport_send_notify_data { · line 99
Quoted 11 lines
include/net/af_vsock.h +3
-0@@ -94,7 +94,13 @@ struct vsock_transport_send_notify_data {u64 data2;/* Transport-defined. */ }; +#define VSOCK_TRANSPORT_F_H2G 0x00000001 +#define VSOCK_TRANSPORT_F_G2H 0x00000002 +#define VSOCK_TRANSPORT_F_DGRAM 0x00000004
Documentation comments, please.
include/net/af_vsock.h struct vsock_transport_send_notify_data { · line 106
Quoted 7 lines
include/net/af_vsock.h +7
-0+void vsock_core_unregister (const struct vsock_transport *t) +{ +mutex_lock (&vsock_register_mutex); + +/* RFC-TODO: maybe we should check if there are open sockets +* assigned to that transport and avoid the unregistration +*/
If unregister() is only called from module_exit() functions then holding a reference to the transport module would be enough to prevent this case. The transport could only be removed once all sockets have been destroyed (and dropped their transport module reference).
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 3 lines · Stefano Garzarella
RFC:
- I'd like to moveMODULE_ALIAS_NETPROTO(PF_VSOCK)toaf_vsock.c. @Jorgen could this break the VMware products?
What will cause the vmw_vsock_vmci_transport.ko module to be loaded after you remove MODULE_ALIAS_NETPROTO(PF_VSOCK)? Perhaps drivers/misc/vmw_vmci/vmci_guest.c:vmci_guest_probe_device() could do something when the guest driver loads. There would need to be something equivalent for the host side too.
This will solve another issue too. Today the VMCI transport can be loaded if an application creates an AF_VSOCK socket during early boot before the virtio transport has been probed. This happens because the VMCI transport uses MODULE_ALIAS_NETPROTO(PF_VSOCK) *and* it does not probe whether this system is actually a VMware guest.
If we instead load the core af_vsock.ko module and transports are only loaded based on hardware feature probing (e.g. the presence of VMware guest mode, a virtio PCI adapter, etc) then transports will be well-behaved.
Quoted 4 lines
- DGRAM sockets are handled as before, I don't know if make sense work on it now, or when another transport will support DGRAM. The big issues here is that we cannot link 1-1 a socket to transport as for stream sockets since DGRAM is not connection-oriented.
Let's ignore DGRAM for now since only VMCI supports it and we therefore do not require multi-transport support.
include/net/af_vsock.h struct vsock_transport_send_notify_data { · line 99
Quoted 11 lines
include/net/af_vsock.h +3
-0@@ -94,7 +94,13 @@ struct vsock_transport_send_notify_data {u64 data2;/* Transport-defined. */ }; +#define VSOCK_TRANSPORT_F_H2G 0x00000001 +#define VSOCK_TRANSPORT_F_G2H 0x00000002 +#define VSOCK_TRANSPORT_F_DGRAM 0x00000004
Documentation comments, please.
include/net/af_vsock.h struct vsock_transport_send_notify_data { · line 106
Quoted 7 lines
include/net/af_vsock.h +7
-0+void vsock_core_unregister (const struct vsock_transport *t) +{ +mutex_lock (&vsock_register_mutex); + +/* RFC-TODO: maybe we should check if there are open sockets +* assigned to that transport and avoid the unregistration +*/
If unregister() is only called from module_exit() functions then holding a reference to the transport module would be enough to prevent this case. The transport could only be removed once all sockets have been destroyed (and dropped their transport module reference).
Stefano Garzarella
maintainerQuoted 9 lines · Stefan Hajnoczi
Quoted 3 lines · Stefano Garzarella
RFC:
- I'd like to moveMODULE_ALIAS_NETPROTO(PF_VSOCK)toaf_vsock.c. @Jorgen could this break the VMware products?What will cause the vmw_vsock_vmci_transport.ko module to be loaded after you remove
MODULE_ALIAS_NETPROTO(PF_VSOCK)? Perhaps drivers/misc/vmw_vmci/vmci_guest.c:vmci_guest_probe_device() could do something when the guest driver loads.
Good idea, maybe we can call some function provided by vmci_transport to register it as a guest (I'll remove the type from the transport and I add it as a parameter of vsock_core_register())
Quoted 2 lines
There would need to be something
equivalent for the host side too.
Maybe in the vmci_host_do_init_context().
Quoted 11 lines
This will solve another issue too. Today the VMCI transport can be loaded if an application creates an
AF_VSOCKsocket during early boot before the virtio transport has been probed. This happens because the VMCI transport usesMODULE_ALIAS_NETPROTO(PF_VSOCK)*and* it does not probe whether this system is actually a VMware guest.If we instead load the core af_vsock.ko module and transports are only loaded based on hardware feature probing (e.g. the presence of VMware guest mode, a virtio PCI adapter, etc) then transports will be well-behaved.
Yes, I completely agree with you. I'll try to follow your suggestion,
Quoted 8 lines
Quoted 5 lines
- DGRAM sockets are handled as before, I don't know if make sense work on it now, or when another transport will support DGRAM. The big issues here is that we cannot link 1-1 a socket to transport as for stream sockets since DGRAM is not connection-oriented.
Let's ignore DGRAM for now since only VMCI supports it and we therefore do not require multi-transpor) support.
Okay :)
Quoted 9 lines
Quoted 9 lines
include/net/af_vsock.h +0
-0@@ -94,7 +94,13 @@ struct vsock_transport_send_notify_data {u64 data2;/* Transport-defined. */ };
Quoted 5 lines
include/net/af_vsock.h struct vsock_transport_send_notify_data { · line 99
Quoted 3 lines
include/net/af_vsock.h +3
-0+#define VSOCK_TRANSPORT_F_H2G 0x00000001 +#define VSOCK_TRANSPORT_F_G2H 0x00000002 +#define VSOCK_TRANSPORT_F_DGRAM 0x00000004Documentation comments, please.
I'll fix!
Quoted 13 lines
include/net/af_vsock.h struct vsock_transport_send_notify_data { · line 106
Quoted 8 lines
include/net/af_vsock.h +7
-0+void vsock_core_unregister (const struct vsock_transport *t) +{ +mutex_lock (&vsock_register_mutex); + +/* RFC-TODO: maybe we should check if there are open sockets +* assigned to that transport and avoid the unregistration +*/ If
unregister()is only called frommodule_exit()functions then holding a reference to the transport module would be enough to prevent this case. The transport could only be removed once all sockets have been destroyed (and dropped their transport module reference).
Yes. I did this in
"[RFC PATCH 12/13] vsock: prevent transport modules unloading".
Maybe I can merge it in this patch...
Thanks,
Stefano
Stefano Garzarella
maintainerQuoted 9 lines · Stefan Hajnoczi
Quoted 3 lines · Stefano Garzarella
RFC:
- I'd like to moveMODULE_ALIAS_NETPROTO(PF_VSOCK)toaf_vsock.c. @Jorgen could this break the VMware products?What will cause the vmw_vsock_vmci_transport.ko module to be loaded after you remove
MODULE_ALIAS_NETPROTO(PF_VSOCK)? Perhaps drivers/misc/vmw_vmci/vmci_guest.c:vmci_guest_probe_device() could do something when the guest driver loads.
Good idea, maybe we can call some function provided by vmci_transport to register it as a guest (I'll remove the type from the transport and I add it as a parameter of vsock_core_register())
Quoted 2 lines
There would need to be something
equivalent for the host side too.
Maybe in the vmci_host_do_init_context().
Quoted 11 lines
This will solve another issue too. Today the VMCI transport can be loaded if an application creates an
AF_VSOCKsocket during early boot before the virtio transport has been probed. This happens because the VMCI transport usesMODULE_ALIAS_NETPROTO(PF_VSOCK)*and* it does not probe whether this system is actually a VMware guest.If we instead load the core af_vsock.ko module and transports are only loaded based on hardware feature probing (e.g. the presence of VMware guest mode, a virtio PCI adapter, etc) then transports will be well-behaved.
Yes, I completely agree with you. I'll try to follow your suggestion,
Quoted 8 lines
Quoted 5 lines
- DGRAM sockets are handled as before, I don't know if make sense work on it now, or when another transport will support DGRAM. The big issues here is that we cannot link 1-1 a socket to transport as for stream sockets since DGRAM is not connection-oriented.
Let's ignore DGRAM for now since only VMCI supports it and we therefore do not require multi-transpor) support.
Okay :)
Quoted 9 lines
Quoted 9 lines
include/net/af_vsock.h +0
-0@@ -94,7 +94,13 @@ struct vsock_transport_send_notify_data {u64 data2;/* Transport-defined. */ };
Quoted 5 lines
include/net/af_vsock.h struct vsock_transport_send_notify_data { · line 99
Quoted 3 lines
include/net/af_vsock.h +3
-0+#define VSOCK_TRANSPORT_F_H2G 0x00000001 +#define VSOCK_TRANSPORT_F_G2H 0x00000002 +#define VSOCK_TRANSPORT_F_DGRAM 0x00000004Documentation comments, please.
I'll fix!
Quoted 13 lines
include/net/af_vsock.h struct vsock_transport_send_notify_data { · line 106
Quoted 8 lines
include/net/af_vsock.h +7
-0+void vsock_core_unregister (const struct vsock_transport *t) +{ +mutex_lock (&vsock_register_mutex); + +/* RFC-TODO: maybe we should check if there are open sockets +* assigned to that transport and avoid the unregistration +*/ If
unregister()is only called frommodule_exit()functions then holding a reference to the transport module would be enough to prevent this case. The transport could only be removed once all sockets have been destroyed (and dropped their transport module reference).
Yes. I did this in
"[RFC PATCH 12/13] vsock: prevent transport modules unloading".
Maybe I can merge it in this patch...
Thanks,
Stefano
Stefano Garzarella
maintainerRFC PATCH 11/13 vsock: add 'transport_hg' to handle g2h\h2g transports
In reply to Stefano GarzarellaVMCI transport provides both g2h and h2g behaviors in a single transport.
We are able to set (or not) the g2h behavior, detecting if we are in a VMware guest (or not), but the h2g feature is always set. This prevents to load other h2g transports while we are in a VMware guest.
This patch adds a new 'transport_hg' to handle this case, reducing the priority of transports that provide both g2h and h2g behaviors. A transport that has g2h and h2g features, can be bypassed by a transport that has only the h2g feature.
--- net/vmw_vsock/af_vsock.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-)
net/vmw_vsock/af_vsock.c +24 -5
@@ -134,6 +134,8 @@ static struct proto vsock_proto = {static const struct vsock_transport *transport_h2g;/* Transport used for guest->host communication */ static const struct vsock_transport *transport_g2h; +/* Transport used for both host->guest and guest->host communication */ +static const struct vsock_transport *transport_hg;/* Transport used for DGRAM communication */ static const struct vsock_transport *transport_dgram;static DEFINE_MUTEX (vsock_register_mutex);
@@ -402,10 +404,13 @@ int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk) vsk->transport = transport_dgram;break ;case SOCK_STREAM : -if (vsk->remote_addr.svm_cid >VMADDR_CID_HOST ) +if (vsk->remote_addr.svm_cid >VMADDR_CID_HOST ) { vsk->transport = transport_h2g; -else +if (!vsk->transport) + vsk->transport = transport_hg; + }else { vsk->transport = transport_g2h; + }break ;default :return -ESOCKTNOSUPPORT ;
@@ -423,7 +428,7 @@ static bool vsock_find_cid(unsigned int cid)if (transport_g2h && cid == transport_g2h->get_local_cid ())return true; -if (transport_h2g && cid ==VMADDR_CID_HOST ) +if ((transport_h2g || transport_hg) && cid ==VMADDR_CID_HOST )return true;return false;
@@ -1997,6 +2002,8 @@ static long vsock_dev_do_ioctl(struct file *filp, cid = transport_g2h->get_local_cid (); else if (transport_h2g) cid = transport_h2g->get_local_cid (); + else if (transport_hg) + cid = transport_hg->get_local_cid ();if (put_user (cid, p) !=0 ) retval = -EFAULT ;
@@ -2093,13 +2100,14 @@ EXPORT_SYMBOL_GPL(vsock_core_get_transport);int vsock_core_register (const struct vsock_transport *t) { -const struct vsock_transport *t_h2g, *t_g2h, *t_dgram; +const struct vsock_transport *t_h2g, *t_hg, *t_g2h, *t_dgram;int err =mutex_lock_interruptible (&vsock_register_mutex);if (err)return err; t_h2g = transport_h2g; + t_hg = transport_hg; t_g2h = transport_g2h; t_dgram = transport_dgram;
@@ -2107,7 +2115,14 @@ int vsock_core_register(const struct vsock_transport *t)* same transport. We are able to set the G2H feature only if we are * in a VMware guest, but we are not able to do the same for the host. */ -if (t->features &VSOCK_TRANSPORT_F_H2G ) { +if ((t->features &VSOCK_TRANSPORT_F_H2G ) && + (t->features &VSOCK_TRANSPORT_F_G2H )) { +if (t_hg) { + err = -EBUSY ; + goto err_busy; + } + t_hg = t; + }else if (t->features &VSOCK_TRANSPORT_F_H2G ) {if (t_h2g) { err = -EBUSY ; goto err_busy;
@@ -2132,6 +2147,7 @@ int vsock_core_register(const struct vsock_transport *t) } transport_h2g = t_h2g; + transport_hg = t_hg; transport_g2h = t_g2h; transport_dgram = t_dgram;
@@ -2151,6 +2167,9 @@ void vsock_core_unregister(const struct vsock_transport *t)if (transport_h2g == t) transport_h2g =NULL ; +if (transport_hg == t) + transport_hg =NULL ; +if (transport_g2h == t) transport_g2h =NULL ;
Signature · 1 line
2.21.0
Stefano Garzarella
maintainerRFC PATCH 11/13 vsock: add 'transport_hg' to handle g2h\h2g transports
In reply to Stefano GarzarellaVMCI transport provides both g2h and h2g behaviors in a single transport.
We are able to set (or not) the g2h behavior, detecting if we are in a VMware guest (or not), but the h2g feature is always set. This prevents to load other h2g transports while we are in a VMware guest.
This patch adds a new 'transport_hg' to handle this case, reducing the priority of transports that provide both g2h and h2g behaviors. A transport that has g2h and h2g features, can be bypassed by a transport that has only the h2g feature.
--- net/vmw_vsock/af_vsock.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-)
net/vmw_vsock/af_vsock.c +24 -5
@@ -134,6 +134,8 @@ static struct proto vsock_proto = {static const struct vsock_transport *transport_h2g;/* Transport used for guest->host communication */ static const struct vsock_transport *transport_g2h; +/* Transport used for both host->guest and guest->host communication */ +static const struct vsock_transport *transport_hg;/* Transport used for DGRAM communication */ static const struct vsock_transport *transport_dgram;static DEFINE_MUTEX (vsock_register_mutex);
@@ -402,10 +404,13 @@ int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk) vsk->transport = transport_dgram;break ;case SOCK_STREAM : -if (vsk->remote_addr.svm_cid >VMADDR_CID_HOST ) +if (vsk->remote_addr.svm_cid >VMADDR_CID_HOST ) { vsk->transport = transport_h2g; -else +if (!vsk->transport) + vsk->transport = transport_hg; + }else { vsk->transport = transport_g2h; + }break ;default :return -ESOCKTNOSUPPORT ;
@@ -423,7 +428,7 @@ static bool vsock_find_cid(unsigned int cid)if (transport_g2h && cid == transport_g2h->get_local_cid ())return true; -if (transport_h2g && cid ==VMADDR_CID_HOST ) +if ((transport_h2g || transport_hg) && cid ==VMADDR_CID_HOST )return true;return false;
@@ -1997,6 +2002,8 @@ static long vsock_dev_do_ioctl(struct file *filp, cid = transport_g2h->get_local_cid (); else if (transport_h2g) cid = transport_h2g->get_local_cid (); + else if (transport_hg) + cid = transport_hg->get_local_cid ();if (put_user (cid, p) !=0 ) retval = -EFAULT ;
@@ -2093,13 +2100,14 @@ EXPORT_SYMBOL_GPL(vsock_core_get_transport);int vsock_core_register (const struct vsock_transport *t) { -const struct vsock_transport *t_h2g, *t_g2h, *t_dgram; +const struct vsock_transport *t_h2g, *t_hg, *t_g2h, *t_dgram;int err =mutex_lock_interruptible (&vsock_register_mutex);if (err)return err; t_h2g = transport_h2g; + t_hg = transport_hg; t_g2h = transport_g2h; t_dgram = transport_dgram;
@@ -2107,7 +2115,14 @@ int vsock_core_register(const struct vsock_transport *t)* same transport. We are able to set the G2H feature only if we are * in a VMware guest, but we are not able to do the same for the host. */ -if (t->features &VSOCK_TRANSPORT_F_H2G ) { +if ((t->features &VSOCK_TRANSPORT_F_H2G ) && + (t->features &VSOCK_TRANSPORT_F_G2H )) { +if (t_hg) { + err = -EBUSY ; + goto err_busy; + } + t_hg = t; + }else if (t->features &VSOCK_TRANSPORT_F_H2G ) {if (t_h2g) { err = -EBUSY ; goto err_busy;
@@ -2132,6 +2147,7 @@ int vsock_core_register(const struct vsock_transport *t) } transport_h2g = t_h2g; + transport_hg = t_hg; transport_g2h = t_g2h; transport_dgram = t_dgram;
@@ -2151,6 +2167,9 @@ void vsock_core_unregister(const struct vsock_transport *t)if (transport_h2g == t) transport_h2g =NULL ; +if (transport_hg == t) + transport_hg =NULL ; +if (transport_g2h == t) transport_g2h =NULL ;
Signature · 1 line
2.21.0
Stefano Garzarella
maintainerRe: [RFC PATCH 11/13] vsock: add 'transport_hg' to handle g2h\h2g transports
Quoted 7 lines · Stefano Garzarella
VMCI transport provides both g2h and h2g behaviors in a single transport.
We are able to set (or not) the g2h behavior, detecting if we are in a VMware guest (or not), but the h2g feature is always set. This prevents to load other h2g transports while we are in a VMware guest.
Quoted 5 lines
This patch adds a new '
transport_hg' to handle this case, reducing the priority of transports that provide both g2h and h2g behaviors. A transport that has g2h and h2g features, can be bypassed by a transport that has only the h2g feature.
Since I'm enabling the VSOCK_TRANSPORT_F_G2H in the vmci_transport only when we run in a VMware guest, this patch doesn't work well if a KVM (or HyperV) guest application create an AF_VSOCK socket and no transports are loaded, because in this case the vmci_transport is loaded (MODULE_ALIAS_NETPROTO(PF_VSOCK)) and it is registered as transport_h2g.
At this point, if we want to run a nested VM using vhost_transport, we can't load it.
So, I can leave VSOCK_TRANSPORT_F_G2H always set in the vmci_transport and this should fix this issue.
Or maybe I need to change how the registering works, e.g. handling a list of transport registered, setting priority or using the last registered transport.
Any suggestion?
Thanks,
Stefano
Stefano Garzarella
maintainerRe: [RFC PATCH 11/13] vsock: add 'transport_hg' to handle g2h\h2g transports
In reply to Stefano GarzarellaQuoted 7 lines · Stefano Garzarella
VMCI transport provides both g2h and h2g behaviors in a single transport.
We are able to set (or not) the g2h behavior, detecting if we are in a VMware guest (or not), but the h2g feature is always set. This prevents to load other h2g transports while we are in a VMware guest.
Quoted 5 lines
This patch adds a new '
transport_hg' to handle this case, reducing the priority of transports that provide both g2h and h2g behaviors. A transport that has g2h and h2g features, can be bypassed by a transport that has only the h2g feature.
Since I'm enabling the VSOCK_TRANSPORT_F_G2H in the vmci_transport only when we run in a VMware guest, this patch doesn't work well if a KVM (or HyperV) guest application create an AF_VSOCK socket and no transports are loaded, because in this case the vmci_transport is loaded (MODULE_ALIAS_NETPROTO(PF_VSOCK)) and it is registered as transport_h2g.
At this point, if we want to run a nested VM using vhost_transport, we can't load it.
So, I can leave VSOCK_TRANSPORT_F_G2H always set in the vmci_transport and this should fix this issue.
Or maybe I need to change how the registering works, e.g. handling a list of transport registered, setting priority or using the last registered transport.
Any suggestion?
Thanks,
Stefano
Re: [RFC PATCH 11/13] vsock: add 'transport_hg' to handle g2h\h2g transports
In reply to Stefano GarzarellaQuoted 6 lines · Stefano Garzarella
VMCI transport provides both g2h and h2g behaviors in a single transport.
We are able to set (or not) the g2h behavior, detecting if we are in a VMware guest (or not), but the h2g feature is always set. This prevents to load other h2g transports while we are in a VMware guest.
In the vhost_vsock.ko case we only register the h2g transport when userspace has loaded the module (by opening /dev/vhost-vsock).
VMCI has something kind of similar: /dev/vmci and the vmci_host_active_users counter. Maybe we can use this instead of introducing the transport_hg concept?
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [RFC PATCH 11/13] vsock: add 'transport_hg' to handle g2h\h2g transports
In reply to Stefano GarzarellaQuoted 6 lines · Stefano Garzarella
VMCI transport provides both g2h and h2g behaviors in a single transport.
We are able to set (or not) the g2h behavior, detecting if we are in a VMware guest (or not), but the h2g feature is always set. This prevents to load other h2g transports while we are in a VMware guest.
In the vhost_vsock.ko case we only register the h2g transport when userspace has loaded the module (by opening /dev/vhost-vsock).
VMCI has something kind of similar: /dev/vmci and the vmci_host_active_users counter. Maybe we can use this instead of introducing the transport_hg concept?
Stefano Garzarella
maintainerRe: [RFC PATCH 11/13] vsock: add 'transport_hg' to handle g2h\h2g transports
Quoted 8 lines · Stefan Hajnoczi
Quoted 6 lines · Stefano Garzarella
VMCI transport provides both g2h and h2g behaviors in a single transport.
We are able to set (or not) the g2h behavior, detecting if we are in a VMware guest (or not), but the h2g feature is always set. This prevents to load other h2g transports while we are in a VMware guest.
Quoted 6 lines
In the vhost_vsock.ko case we only register the h2g transport when userspace has loaded the module (by opening
/dev/vhost-vsock).VMCI has something kind of similar:
/dev/vmciand thevmci_host_active_userscounter. Maybe we can use this instead of introducing thetransport_hgconcept?
Yes, maybe we can register the host in the vmci_host_do_init_context().
I also don't like a lot the transport_hg concept, so I'll try to found an alternative.
Thanks,
Stefano
Stefano Garzarella
maintainerRe: [RFC PATCH 11/13] vsock: add 'transport_hg' to handle g2h\h2g transports
In reply to Stefan HajnocziQuoted 8 lines · Stefan Hajnoczi
Quoted 6 lines · Stefano Garzarella
VMCI transport provides both g2h and h2g behaviors in a single transport.
We are able to set (or not) the g2h behavior, detecting if we are in a VMware guest (or not), but the h2g feature is always set. This prevents to load other h2g transports while we are in a VMware guest.
Quoted 6 lines
In the vhost_vsock.ko case we only register the h2g transport when userspace has loaded the module (by opening
/dev/vhost-vsock).VMCI has something kind of similar:
/dev/vmciand thevmci_host_active_userscounter. Maybe we can use this instead of introducing thetransport_hgconcept?
Yes, maybe we can register the host in the vmci_host_do_init_context().
I also don't like a lot the transport_hg concept, so I'll try to found an alternative.
Thanks,
Stefano
Stefano Garzarella
maintainerRFC PATCH 12/13 vsock: prevent transport modules unloading
In reply to Stefano GarzarellaThis patch adds 'module' member in the 'struct vsock_transport' in order to get/put the transport module. This prevents the module unloading while sockets are assigned to it.
We increase the module refcnt when a socket is assigned to a transport, and we decrease the module refcnt when the socket is destructed.
--- drivers/vhost/vsock.c | 1 + include/net/af_vsock.h | 1 + net/vmw_vsock/af_vsock.c | 23 +++++++++++++++++------ net/vmw_vsock/hyperv_transport.c | 1 + net/vmw_vsock/virtio_transport.c | 1 + net/vmw_vsock/vmci_transport.c | 1 + 6 files changed, 22 insertions(+), 6 deletions(-)
drivers/vhost/vsock.c +1 -0
@@ -387,6 +387,7 @@ static bool vhost_vsock_more_replies(struct vhost_vsock *vsock)static struct virtio_transport vhost_transport = { .transport = { .features =VSOCK_TRANSPORT_F_H2G , + .module =THIS_MODULE , .get_local_cid = vhost_transport_get_local_cid,
include/net/af_vsock.h +1 -0
@@ -100,6 +100,7 @@ struct vsock_transport_send_notify_data {struct vsock_transport {uint64_t features; +struct module *module;/* Initialize/tear-down socket. */ int (*init)(struct vsock_sock *,struct vsock_sock *);
net/vmw_vsock/af_vsock.c +17 -6
@@ -416,13 +416,28 @@ int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk)return -ESOCKTNOSUPPORT ; } -if (!vsk->transport) +/* We increase the module refcnt to prevent the tranport unloading +* while there are open sockets assigned to it. +*/ +if (!vsk->transport || !try_module_get (vsk->transport->module)) { + vsk->transport =NULL ;return -ENODEV ; + }return vsk->transport->init (vsk, psk); }EXPORT_SYMBOL_GPL (vsock_assign_transport); +static void vsock_deassign_transport (struct vsock_sock *vsk) +{ +if (!vsk->transport) +return ; + + vsk->transport->destruct (vsk); +module_put (vsk->transport->module); + vsk->transport =NULL ; +} +static bool vsock_find_cid (unsigned int cid) {if (transport_g2h && cid == transport_g2h->get_local_cid ())
@@ -728,8 +743,7 @@ static void vsock_sk_destruct(struct sock *sk) {struct vsock_sock *vsk =vsock_sk (sk); -if (vsk->transport) - vsk->transport->destruct (vsk); +vsock_deassign_transport (vsk);/* When clearing these addresses, there's no need to set the family and * possibly register the address family with the kernel.
@@ -2161,9 +2175,6 @@ void vsock_core_unregister(const struct vsock_transport *t) {mutex_lock (&vsock_register_mutex); -/* RFC-TODO: maybe we should check if there are open sockets -* assigned to that transport and avoid the unregistration -*/ if (transport_h2g == t) transport_h2g =NULL ;
net/vmw_vsock/hyperv_transport.c +1 -0
@@ -857,6 +857,7 @@ int hvs_notify_send_post_enqueue(struct vsock_sock *vsk, ssize_t written,static struct vsock_transport hvs_transport = { .features =VSOCK_TRANSPORT_F_G2H , + .module =THIS_MODULE , .get_local_cid = hvs_get_local_cid,
net/vmw_vsock/virtio_transport.c +1 -0
@@ -463,6 +463,7 @@ static void virtio_vsock_rx_done(struct virtqueue *vq)static struct virtio_transport virtio_transport = { .transport = { .features =VSOCK_TRANSPORT_F_G2H , + .module =THIS_MODULE , .get_local_cid = virtio_transport_get_local_cid,
net/vmw_vsock/vmci_transport.c +1 -0
@@ -2021,6 +2021,7 @@ static u32 vmci_transport_get_local_cid(void)static struct vsock_transport vmci_transport = { .features =VSOCK_TRANSPORT_F_DGRAM |VSOCK_TRANSPORT_F_H2G , + .module =THIS_MODULE , .init = vmci_transport_socket_init, .destruct = vmci_transport_destruct, .release = vmci_transport_release,
Signature · 1 line
2.21.0
Stefano Garzarella
maintainerRFC PATCH 12/13 vsock: prevent transport modules unloading
In reply to Stefano GarzarellaThis patch adds 'module' member in the 'struct vsock_transport' in order to get/put the transport module. This prevents the module unloading while sockets are assigned to it.
We increase the module refcnt when a socket is assigned to a transport, and we decrease the module refcnt when the socket is destructed.
--- drivers/vhost/vsock.c | 1 + include/net/af_vsock.h | 1 + net/vmw_vsock/af_vsock.c | 23 +++++++++++++++++------ net/vmw_vsock/hyperv_transport.c | 1 + net/vmw_vsock/virtio_transport.c | 1 + net/vmw_vsock/vmci_transport.c | 1 + 6 files changed, 22 insertions(+), 6 deletions(-)
drivers/vhost/vsock.c +1 -0
@@ -387,6 +387,7 @@ static bool vhost_vsock_more_replies(struct vhost_vsock *vsock)static struct virtio_transport vhost_transport = { .transport = { .features =VSOCK_TRANSPORT_F_H2G , + .module =THIS_MODULE , .get_local_cid = vhost_transport_get_local_cid,
include/net/af_vsock.h +1 -0
@@ -100,6 +100,7 @@ struct vsock_transport_send_notify_data {struct vsock_transport {uint64_t features; +struct module *module;/* Initialize/tear-down socket. */ int (*init)(struct vsock_sock *,struct vsock_sock *);
net/vmw_vsock/af_vsock.c +17 -6
@@ -416,13 +416,28 @@ int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk)return -ESOCKTNOSUPPORT ; } -if (!vsk->transport) +/* We increase the module refcnt to prevent the tranport unloading +* while there are open sockets assigned to it. +*/ +if (!vsk->transport || !try_module_get (vsk->transport->module)) { + vsk->transport =NULL ;return -ENODEV ; + }return vsk->transport->init (vsk, psk); }EXPORT_SYMBOL_GPL (vsock_assign_transport); +static void vsock_deassign_transport (struct vsock_sock *vsk) +{ +if (!vsk->transport) +return ; + + vsk->transport->destruct (vsk); +module_put (vsk->transport->module); + vsk->transport =NULL ; +} +static bool vsock_find_cid (unsigned int cid) {if (transport_g2h && cid == transport_g2h->get_local_cid ())
@@ -728,8 +743,7 @@ static void vsock_sk_destruct(struct sock *sk) {struct vsock_sock *vsk =vsock_sk (sk); -if (vsk->transport) - vsk->transport->destruct (vsk); +vsock_deassign_transport (vsk);/* When clearing these addresses, there's no need to set the family and * possibly register the address family with the kernel.
@@ -2161,9 +2175,6 @@ void vsock_core_unregister(const struct vsock_transport *t) {mutex_lock (&vsock_register_mutex); -/* RFC-TODO: maybe we should check if there are open sockets -* assigned to that transport and avoid the unregistration -*/ if (transport_h2g == t) transport_h2g =NULL ;
net/vmw_vsock/hyperv_transport.c +1 -0
@@ -857,6 +857,7 @@ int hvs_notify_send_post_enqueue(struct vsock_sock *vsk, ssize_t written,static struct vsock_transport hvs_transport = { .features =VSOCK_TRANSPORT_F_G2H , + .module =THIS_MODULE , .get_local_cid = hvs_get_local_cid,
net/vmw_vsock/virtio_transport.c +1 -0
@@ -463,6 +463,7 @@ static void virtio_vsock_rx_done(struct virtqueue *vq)static struct virtio_transport virtio_transport = { .transport = { .features =VSOCK_TRANSPORT_F_G2H , + .module =THIS_MODULE , .get_local_cid = virtio_transport_get_local_cid,
net/vmw_vsock/vmci_transport.c +1 -0
@@ -2021,6 +2021,7 @@ static u32 vmci_transport_get_local_cid(void)static struct vsock_transport vmci_transport = { .features =VSOCK_TRANSPORT_F_DGRAM |VSOCK_TRANSPORT_F_H2G , + .module =THIS_MODULE , .init = vmci_transport_socket_init, .destruct = vmci_transport_destruct, .release = vmci_transport_release,
Signature · 1 line
2.21.0
Re: [RFC PATCH 12/13] vsock: prevent transport modules unloading
net/vmw_vsock/af_vsock.c int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk) · line 419
Quoted 10 lines · Stefano Garzarella
net/vmw_vsock/af_vsock.c +1
-1@@ -416,13 +416,28 @@ int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk)return -ESOCKTNOSUPPORT ; } -if (!vsk->transport) +/* We increase the module refcnt to prevent the tranport unloading
s/tranport/transport/
Otherwise:
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [RFC PATCH 12/13] vsock: prevent transport modules unloading
In reply to Stefano Garzarellanet/vmw_vsock/af_vsock.c int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk) · line 419
Quoted 10 lines · Stefano Garzarella
net/vmw_vsock/af_vsock.c +1
-1@@ -416,13 +416,28 @@ int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk)return -ESOCKTNOSUPPORT ; } -if (!vsk->transport) +/* We increase the module refcnt to prevent the tranport unloading
s/tranport/transport/
Otherwise:
Stefano Garzarella
maintainerRFC PATCH 13/13 vsock: fix bind() behaviour taking care of CID
In reply to Stefano GarzarellaWhen we are looking for a socket bound to a specific address, we also have to take into account the CID.
This patch is useful with multi-transports support because it allows the binding of the same port with different CID, and it prevents a connection to a wrong socket bound to the same port, but with different CID.
--- net/vmw_vsock/af_vsock.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
net/vmw_vsock/af_vsock.c +8 -2
@@ -230,10 +230,16 @@ static struct sock *__vsock_find_bound_socket(struct sockaddr_vm *addr) {struct vsock_sock *vsk; -list_for_each_entry (vsk,vsock_bound_sockets (addr), bound_table) -if (addr->svm_port == vsk->local_addr.svm_port) +list_for_each_entry (vsk,vsock_bound_sockets (addr), bound_table) { +if (vsock_addr_equals_addr (addr, &vsk->local_addr))return sk_vsock (vsk); +if (addr->svm_port == vsk->local_addr.svm_port && + (vsk->local_addr.svm_cid ==VMADDR_CID_ANY || + addr->svm_cid ==VMADDR_CID_ANY )) +return sk_vsock (vsk); + } +return NULL ; }
Signature · 1 line
2.21.0
Stefano Garzarella
maintainerRFC PATCH 13/13 vsock: fix bind() behaviour taking care of CID
In reply to Stefano GarzarellaWhen we are looking for a socket bound to a specific address, we also have to take into account the CID.
This patch is useful with multi-transports support because it allows the binding of the same port with different CID, and it prevents a connection to a wrong socket bound to the same port, but with different CID.
--- net/vmw_vsock/af_vsock.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
net/vmw_vsock/af_vsock.c +8 -2
@@ -230,10 +230,16 @@ static struct sock *__vsock_find_bound_socket(struct sockaddr_vm *addr) {struct vsock_sock *vsk; -list_for_each_entry (vsk,vsock_bound_sockets (addr), bound_table) -if (addr->svm_port == vsk->local_addr.svm_port) +list_for_each_entry (vsk,vsock_bound_sockets (addr), bound_table) { +if (vsock_addr_equals_addr (addr, &vsk->local_addr))return sk_vsock (vsk); +if (addr->svm_port == vsk->local_addr.svm_port && + (vsk->local_addr.svm_cid ==VMADDR_CID_ANY || + addr->svm_cid ==VMADDR_CID_ANY )) +return sk_vsock (vsk); + } +return NULL ; }
Signature · 1 line
2.21.0
Re: [RFC PATCH 13/13] vsock: fix bind() behaviour taking care of CID
Quoted 8 lines · Stefano Garzarella
When we are looking for a socket bound to a specific address, we also have to take into account the CID.
This patch is useful with multi-transports support because it allows the binding of the same port with different CID, and it prevents a connection to a wrong socket bound to the same port, but with different CID.
Quoted 4 lines
Signed-off-by Stefano Garzarella <[email protected]>--- net/vmw_vsock/af_vsock.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [RFC PATCH 13/13] vsock: fix bind() behaviour taking care of CID
In reply to Stefano GarzarellaQuoted 8 lines · Stefano Garzarella
When we are looking for a socket bound to a specific address, we also have to take into account the CID.
This patch is useful with multi-transports support because it allows the binding of the same port with different CID, and it prevents a connection to a wrong socket bound to the same port, but with different CID.
Quoted 4 lines
Signed-off-by Stefano Garzarella <[email protected]>--- net/vmw_vsock/af_vsock.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
Dexuan Cui
maintainerQuoted 7 lines
From: Stefano Garzarella <[email protected]>
Sent: Friday, September 27, 2019 4:27 AM
...
Patch 9 changes thehvs_remote_addr_init(). setting theVMADDR_CID_HOSTas remote CID instead ofVMADDR_CID_ANYto make the choice of transport to be used work properly. @Dexuan Could this change break anything?
This patch looks good to me.
Quoted 2 lines
@Dexuan please can you test on HyperV that I didn't break anything even without nested VMs?
I did some quick tests with the 13 patches in a Linux VM (this is not a nested VM) on Hyper-V and it looks nothing is broken. :-)
Quoted 1 line
I'll try to setup a Windows host where to test the nested VMs
I suppose you're going to run a Linux VM on a Hyper-V host,
and the Linux VM itself runs KVM/VmWare so it can create its own child VMs. IMO this is similar to the test "nested KVM ( ..., virtio-transport[L1,L2]" you have done.
.
Thanks!
Dexuan
Stefano Garzarella
maintainerQuoted 10 lines · Dexuan Cui
Quoted 7 lines
From: Stefano Garzarella <[email protected]>
Sent: Friday, September 27, 2019 4:27 AM
...
Patch 9 changes thehvs_remote_addr_init(). setting theVMADDR_CID_HOSTas remote CID instead ofVMADDR_CID_ANYto make the choice of transport to be used work properly. @Dexuan Could this change break anything?This patch looks good to me.
Thank you very much for your reviews!
Quoted 6 lines
Quoted 2 lines
@Dexuan please can you test on HyperV that I didn't break anything even without nested VMs?
I did some quick tests with the 13 patches in a Linux VM (this is not a nested VM) on Hyper-V and it looks nothing is broken. :-)
Great :-)
Quoted 6 lines
Quoted 1 line
I'll try to setup a Windows host where to test the nested VMs
I suppose you're going to run a Linux VM on a Hyper-V host,
and the Linux VM itself runs KVM/VmWare so it can create its own child VMs. IMO this is similar to the test "nested KVM ( ..., virtio-transport[L1,L2]" you have done.
Yes, I think so. If the Hyper-V transport works well without nested VM, it should work the same with a nested KVM/VMware.
Thanks,
Stefano
Stefano Garzarella
maintainerQuoted 10 lines · Dexuan Cui
Quoted 7 lines
From: Stefano Garzarella <[email protected]>
Sent: Friday, September 27, 2019 4:27 AM
...
Patch 9 changes thehvs_remote_addr_init(). setting theVMADDR_CID_HOSTas remote CID instead ofVMADDR_CID_ANYto make the choice of transport to be used work properly. @Dexuan Could this change break anything?This patch looks good to me.
Thank you very much for your reviews!
Quoted 6 lines
Quoted 2 lines
@Dexuan please can you test on HyperV that I didn't break anything even without nested VMs?
I did some quick tests with the 13 patches in a Linux VM (this is not a nested VM) on Hyper-V and it looks nothing is broken. :-)
Great :-)
Quoted 6 lines
Quoted 1 line
I'll try to setup a Windows host where to test the nested VMs
I suppose you're going to run a Linux VM on a Hyper-V host,
and the Linux VM itself runs KVM/VmWare so it can create its own child VMs. IMO this is similar to the test "nested KVM ( ..., virtio-transport[L1,L2]" you have done.
Yes, I think so. If the Hyper-V transport works well without nested VM, it should work the same with a nested KVM/VMware.
Thanks,
Stefano
Quoted 4 lines · Stefano Garzarella
Hi all,
this series adds the multi-transports support to vsock, following this proposal:
https://www.spinics.net/lists/netdev/msg575792.html
Nice series! I have left a few comments but overall it looks promising.
Stefan
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 4 lines · Stefano Garzarella
Hi all,
this series adds the multi-transports support to vsock, following this proposal:
https://www.spinics.net/lists/netdev/msg575792.html
Nice series! I have left a few comments but overall it looks promising.
Stefan
Stefano Garzarella
maintainerQuoted 7 lines · Stefan Hajnoczi
Quoted 4 lines · Stefano Garzarella
Hi all,
this series adds the multi-transports support to vsock, following this proposal:
https://www.spinics.net/lists/netdev/msg575792.htmlNice series! I have left a few comments but overall it looks promising.
Thank you very much for the comments!
I'll follow them and respin.
Cheers,
Stefano
Stefano Garzarella
maintainerQuoted 7 lines · Stefan Hajnoczi
Quoted 4 lines · Stefano Garzarella
Hi all,
this series adds the multi-transports support to vsock, following this proposal:
https://www.spinics.net/lists/netdev/msg575792.htmlNice series! I have left a few comments but overall it looks promising.
Thank you very much for the comments!
I'll follow them and respin.
Cheers,
Stefano