* Re: [RFC PATCH v5 01/19] af_vsock: update functions for connectible socket
[not found] ` <20210218053607.1066783-1-arseny.krasnov@kaspersky.com>
@ 2021-02-22 10:50 ` Stefano Garzarella
[not found] ` <279059b2-4c08-16d4-3bca-03640c7932d9@kaspersky.com>
0 siblings, 1 reply; 21+ messages in thread
From: Stefano Garzarella @ 2021-02-22 10:50 UTC (permalink / raw)
To: Arseny Krasnov
Cc: Andra Paraschiv, kvm, Michael S. Tsirkin, netdev, stsp2,
linux-kernel, virtualization, oxffffaa, Norbert Slusarek,
Stefan Hajnoczi, Colin Ian King, Jakub Kicinski, David S. Miller,
Jorgen Hansen
On Thu, Feb 18, 2021 at 08:36:03AM +0300, Arseny Krasnov wrote:
>This prepares af_vsock.c for SEQPACKET support: some functions such
>as setsockopt(), getsockopt(), connect(), recvmsg(), sendmsg() are
>shared between both types of sockets, so rename them in general
>manner.
>
>Signed-off-by: Arseny Krasnov <arseny.krasnov@kaspersky.com>
>---
> net/vmw_vsock/af_vsock.c | 64 +++++++++++++++++++++-------------------
> 1 file changed, 34 insertions(+), 30 deletions(-)
IIRC I had already given my R-b to this patch. Please carry it over when
you post a new version.
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Thanks,
Stefano
>
>diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
>index 5546710d8ac1..656370e11707 100644
>--- a/net/vmw_vsock/af_vsock.c
>+++ b/net/vmw_vsock/af_vsock.c
>@@ -604,8 +604,8 @@ static void vsock_pending_work(struct work_struct *work)
>
> /**** SOCKET OPERATIONS ****/
>
>-static int __vsock_bind_stream(struct vsock_sock *vsk,
>- struct sockaddr_vm *addr)
>+static int __vsock_bind_connectible(struct vsock_sock *vsk,
>+ struct sockaddr_vm *addr)
> {
> static u32 port;
> struct sockaddr_vm new_addr;
>@@ -685,7 +685,7 @@ static int __vsock_bind(struct sock *sk, struct sockaddr_vm *addr)
> switch (sk->sk_socket->type) {
> case SOCK_STREAM:
> spin_lock_bh(&vsock_table_lock);
>- retval = __vsock_bind_stream(vsk, addr);
>+ retval = __vsock_bind_connectible(vsk, addr);
> spin_unlock_bh(&vsock_table_lock);
> break;
>
>@@ -767,6 +767,11 @@ static struct sock *__vsock_create(struct net *net,
> return sk;
> }
>
>+static bool sock_type_connectible(u16 type)
>+{
>+ return type == SOCK_STREAM;
>+}
>+
> static void __vsock_release(struct sock *sk, int level)
> {
> if (sk) {
>@@ -785,7 +790,7 @@ static void __vsock_release(struct sock *sk, int level)
>
> if (vsk->transport)
> vsk->transport->release(vsk);
>- else if (sk->sk_type == SOCK_STREAM)
>+ else if (sock_type_connectible(sk->sk_type))
> vsock_remove_sock(vsk);
>
> sock_orphan(sk);
>@@ -947,7 +952,7 @@ static int vsock_shutdown(struct socket *sock, int mode)
> lock_sock(sk);
> if (sock->state == SS_UNCONNECTED) {
> err = -ENOTCONN;
>- if (sk->sk_type == SOCK_STREAM)
>+ if (sock_type_connectible(sk->sk_type))
> goto out;
> } else {
> sock->state = SS_DISCONNECTING;
>@@ -960,7 +965,7 @@ static int vsock_shutdown(struct socket *sock, int mode)
> sk->sk_shutdown |= mode;
> sk->sk_state_change(sk);
>
>- if (sk->sk_type == SOCK_STREAM) {
>+ if (sock_type_connectible(sk->sk_type)) {
> sock_reset_flag(sk, SOCK_DONE);
> vsock_send_shutdown(sk, mode);
> }
>@@ -1015,7 +1020,7 @@ static __poll_t vsock_poll(struct file *file, struct socket *sock,
> if (!(sk->sk_shutdown & SEND_SHUTDOWN))
> mask |= EPOLLOUT | EPOLLWRNORM | EPOLLWRBAND;
>
>- } else if (sock->type == SOCK_STREAM) {
>+ } else if (sock_type_connectible(sk->sk_type)) {
> const struct vsock_transport *transport;
>
> lock_sock(sk);
>@@ -1262,8 +1267,8 @@ static void vsock_connect_timeout(struct work_struct *work)
> sock_put(sk);
> }
>
>-static int vsock_stream_connect(struct socket *sock, struct sockaddr *addr,
>- int addr_len, int flags)
>+static int vsock_connect(struct socket *sock, struct sockaddr *addr,
>+ int addr_len, int flags)
> {
> int err;
> struct sock *sk;
>@@ -1413,7 +1418,7 @@ static int vsock_accept(struct socket *sock, struct socket *newsock, int flags,
>
> lock_sock(listener);
>
>- if (sock->type != SOCK_STREAM) {
>+ if (!sock_type_connectible(sock->type)) {
> err = -EOPNOTSUPP;
> goto out;
> }
>@@ -1490,7 +1495,7 @@ static int vsock_listen(struct socket *sock, int backlog)
>
> lock_sock(sk);
>
>- if (sock->type != SOCK_STREAM) {
>+ if (!sock_type_connectible(sk->sk_type)) {
> err = -EOPNOTSUPP;
> goto out;
> }
>@@ -1534,11 +1539,11 @@ static void vsock_update_buffer_size(struct vsock_sock *vsk,
> vsk->buffer_size = val;
> }
>
>-static int vsock_stream_setsockopt(struct socket *sock,
>- int level,
>- int optname,
>- sockptr_t optval,
>- unsigned int optlen)
>+static int vsock_connectible_setsockopt(struct socket *sock,
>+ int level,
>+ int optname,
>+ sockptr_t optval,
>+ unsigned int optlen)
> {
> int err;
> struct sock *sk;
>@@ -1616,10 +1621,10 @@ static int vsock_stream_setsockopt(struct socket *sock,
> return err;
> }
>
>-static int vsock_stream_getsockopt(struct socket *sock,
>- int level, int optname,
>- char __user *optval,
>- int __user *optlen)
>+static int vsock_connectible_getsockopt(struct socket *sock,
>+ int level, int optname,
>+ char __user *optval,
>+ int __user *optlen)
> {
> int err;
> int len;
>@@ -1687,8 +1692,8 @@ static int vsock_stream_getsockopt(struct socket *sock,
> return 0;
> }
>
>-static int vsock_stream_sendmsg(struct socket *sock, struct msghdr *msg,
>- size_t len)
>+static int vsock_connectible_sendmsg(struct socket *sock, struct msghdr *msg,
>+ size_t len)
> {
> struct sock *sk;
> struct vsock_sock *vsk;
>@@ -1827,10 +1832,9 @@ static int vsock_stream_sendmsg(struct socket *sock, struct msghdr *msg,
> return err;
> }
>
>-
> static int
>-vsock_stream_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
>- int flags)
>+vsock_connectible_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
>+ int flags)
> {
> struct sock *sk;
> struct vsock_sock *vsk;
>@@ -2006,7 +2010,7 @@ static const struct proto_ops vsock_stream_ops = {
> .owner = THIS_MODULE,
> .release = vsock_release,
> .bind = vsock_bind,
>- .connect = vsock_stream_connect,
>+ .connect = vsock_connect,
> .socketpair = sock_no_socketpair,
> .accept = vsock_accept,
> .getname = vsock_getname,
>@@ -2014,10 +2018,10 @@ static const struct proto_ops vsock_stream_ops = {
> .ioctl = sock_no_ioctl,
> .listen = vsock_listen,
> .shutdown = vsock_shutdown,
>- .setsockopt = vsock_stream_setsockopt,
>- .getsockopt = vsock_stream_getsockopt,
>- .sendmsg = vsock_stream_sendmsg,
>- .recvmsg = vsock_stream_recvmsg,
>+ .setsockopt = vsock_connectible_setsockopt,
>+ .getsockopt = vsock_connectible_getsockopt,
>+ .sendmsg = vsock_connectible_sendmsg,
>+ .recvmsg = vsock_connectible_recvmsg,
> .mmap = sock_no_mmap,
> .sendpage = sock_no_sendpage,
> };
>--
>2.25.1
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC PATCH v5 01/19] af_vsock: update functions for connectible socket
[not found] ` <279059b2-4c08-16d4-3bca-03640c7932d9@kaspersky.com>
@ 2021-02-22 11:09 ` Stefano Garzarella
0 siblings, 0 replies; 21+ messages in thread
From: Stefano Garzarella @ 2021-02-22 11:09 UTC (permalink / raw)
To: Arseny Krasnov
Cc: Andra Paraschiv, kvm@vger.kernel.org, Michael S. Tsirkin,
netdev@vger.kernel.org, stsp2@yandex.ru,
linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org, oxffffaa@gmail.com,
Norbert Slusarek, Stefan Hajnoczi, Colin Ian King, Jakub Kicinski,
David S. Miller, Jorgen Hansen
On Mon, Feb 22, 2021 at 01:58:11PM +0300, Arseny Krasnov wrote:
>
>On 22.02.2021 13:50, Stefano Garzarella wrote:
>> On Thu, Feb 18, 2021 at 08:36:03AM +0300, Arseny Krasnov wrote:
>>> This prepares af_vsock.c for SEQPACKET support: some functions such
>>> as setsockopt(), getsockopt(), connect(), recvmsg(), sendmsg() are
>>> shared between both types of sockets, so rename them in general
>>> manner.
>>>
>>> Signed-off-by: Arseny Krasnov <arseny.krasnov@kaspersky.com>
>>> ---
>>> net/vmw_vsock/af_vsock.c | 64 +++++++++++++++++++++-------------------
>>> 1 file changed, 34 insertions(+), 30 deletions(-)
>> IIRC I had already given my R-b to this patch. Please carry it over when
>> you post a new version.
>>
>> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
>>
>> Thanks,
>> Stefano
>Ack, sorry, didn't know that
Don't worry :-)
It is documented here: Documentation/process/submitting-patches.rst
Both Tested-by and Reviewed-by tags, once received on mailing list from tester
or reviewer, should be added by author to the applicable patches when sending
next versions. However if the patch has changed substantially in following
version, these tags might not be applicable anymore and thus should be removed.
Usually removal of someone's Tested-by or Reviewed-by tags should be mentioned
in the patch changelog (after the '---' separator).
Thanks,
Stefano
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC PATCH v5 02/19] af_vsock: separate wait data loop
[not found] ` <20210218053637.1066959-1-arseny.krasnov@kaspersky.com>
@ 2021-02-22 11:29 ` Stefano Garzarella
2021-02-25 14:24 ` Jorgen Hansen
1 sibling, 0 replies; 21+ messages in thread
From: Stefano Garzarella @ 2021-02-22 11:29 UTC (permalink / raw)
To: Arseny Krasnov
Cc: Andra Paraschiv, kvm, Michael S. Tsirkin, netdev, stsp2,
linux-kernel, virtualization, oxffffaa, Norbert Slusarek,
Stefan Hajnoczi, Colin Ian King, Jakub Kicinski, David S. Miller,
Jorgen Hansen
On Thu, Feb 18, 2021 at 08:36:33AM +0300, Arseny Krasnov wrote:
>This moves wait loop for data to dedicated function, because later
>it will be used by SEQPACKET data receive loop.
The patch LGTM, maybe just add a line in the commit message with
something like this:
While moving the code around, let's update an old comment.
Whit that fixed:
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
>
>Signed-off-by: Arseny Krasnov <arseny.krasnov@kaspersky.com>
>---
> net/vmw_vsock/af_vsock.c | 155 +++++++++++++++++++++------------------
> 1 file changed, 83 insertions(+), 72 deletions(-)
>
>diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
>index 656370e11707..6cf7bb977aa1 100644
>--- a/net/vmw_vsock/af_vsock.c
>+++ b/net/vmw_vsock/af_vsock.c
>@@ -1832,6 +1832,68 @@ static int vsock_connectible_sendmsg(struct socket *sock, struct msghdr *msg,
> return err;
> }
>
>+static int vsock_wait_data(struct sock *sk, struct wait_queue_entry *wait,
>+ long timeout,
>+ struct vsock_transport_recv_notify_data *recv_data,
>+ size_t target)
>+{
>+ const struct vsock_transport *transport;
>+ struct vsock_sock *vsk;
>+ s64 data;
>+ int err;
>+
>+ vsk = vsock_sk(sk);
>+ err = 0;
>+ transport = vsk->transport;
>+ prepare_to_wait(sk_sleep(sk), wait, TASK_INTERRUPTIBLE);
>+
>+ while ((data = vsock_stream_has_data(vsk)) == 0) {
>+ if (sk->sk_err != 0 ||
>+ (sk->sk_shutdown & RCV_SHUTDOWN) ||
>+ (vsk->peer_shutdown & SEND_SHUTDOWN)) {
>+ break;
>+ }
>+
>+ /* Don't wait for non-blocking sockets. */
>+ if (timeout == 0) {
>+ err = -EAGAIN;
>+ break;
>+ }
>+
>+ if (recv_data) {
>+ err = transport->notify_recv_pre_block(vsk, target, recv_data);
>+ if (err < 0)
>+ break;
>+ }
>+
>+ release_sock(sk);
>+ timeout = schedule_timeout(timeout);
>+ lock_sock(sk);
>+
>+ if (signal_pending(current)) {
>+ err = sock_intr_errno(timeout);
>+ break;
>+ } else if (timeout == 0) {
>+ err = -EAGAIN;
>+ break;
>+ }
>+ }
>+
>+ finish_wait(sk_sleep(sk), wait);
>+
>+ if (err)
>+ return err;
>+
>+ /* Internal transport error when checking for available
>+ * data. XXX This should be changed to a connection
>+ * reset in a later change.
>+ */
>+ if (data < 0)
>+ return -ENOMEM;
>+
>+ return data;
>+}
>+
> static int
> vsock_connectible_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
> int flags)
>@@ -1911,85 +1973,34 @@ vsock_connectible_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
>
>
> while (1) {
>- s64 ready;
>-
>- prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
>- ready = vsock_stream_has_data(vsk);
>-
>- if (ready == 0) {
>- if (sk->sk_err != 0 ||
>- (sk->sk_shutdown & RCV_SHUTDOWN) ||
>- (vsk->peer_shutdown & SEND_SHUTDOWN)) {
>- finish_wait(sk_sleep(sk), &wait);
>- break;
>- }
>- /* Don't wait for non-blocking sockets. */
>- if (timeout == 0) {
>- err = -EAGAIN;
>- finish_wait(sk_sleep(sk), &wait);
>- break;
>- }
>+ ssize_t read;
>
>- err = transport->notify_recv_pre_block(
>- vsk, target, &recv_data);
>- if (err < 0) {
>- finish_wait(sk_sleep(sk), &wait);
>- break;
>- }
>- release_sock(sk);
>- timeout = schedule_timeout(timeout);
>- lock_sock(sk);
>+ err = vsock_wait_data(sk, &wait, timeout, &recv_data, target);
>+ if (err <= 0)
>+ break;
>
>- if (signal_pending(current)) {
>- err = sock_intr_errno(timeout);
>- finish_wait(sk_sleep(sk), &wait);
>- break;
>- } else if (timeout == 0) {
>- err = -EAGAIN;
>- finish_wait(sk_sleep(sk), &wait);
>- break;
>- }
>- } else {
>- ssize_t read;
>-
>- finish_wait(sk_sleep(sk), &wait);
>-
>- if (ready < 0) {
>- /* Invalid queue pair content. XXX This should
>- * be changed to a connection reset in a later
>- * change.
>- */
>-
>- err = -ENOMEM;
>- goto out;
>- }
>-
>- err = transport->notify_recv_pre_dequeue(
>- vsk, target, &recv_data);
>- if (err < 0)
>- break;
>+ err = transport->notify_recv_pre_dequeue(vsk, target,
>+ &recv_data);
>+ if (err < 0)
>+ break;
>
>- read = transport->stream_dequeue(
>- vsk, msg,
>- len - copied, flags);
>- if (read < 0) {
>- err = -ENOMEM;
>- break;
>- }
>+ read = transport->stream_dequeue(vsk, msg, len - copied, flags);
>+ if (read < 0) {
>+ err = -ENOMEM;
>+ break;
>+ }
>
>- copied += read;
>+ copied += read;
>
>- err = transport->notify_recv_post_dequeue(
>- vsk, target, read,
>- !(flags & MSG_PEEK), &recv_data);
>- if (err < 0)
>- goto out;
>+ err = transport->notify_recv_post_dequeue(vsk, target, read,
>+ !(flags & MSG_PEEK), &recv_data);
>+ if (err < 0)
>+ goto out;
>
>- if (read >= target || flags & MSG_PEEK)
>- break;
>+ if (read >= target || flags & MSG_PEEK)
>+ break;
>
>- target -= read;
>- }
>+ target -= read;
> }
>
> if (sk->sk_err)
>--
>2.25.1
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC PATCH v5 03/19] af_vsock: separate receive data loop
[not found] ` <20210218053653.1067086-1-arseny.krasnov@kaspersky.com>
@ 2021-02-22 11:43 ` Stefano Garzarella
0 siblings, 0 replies; 21+ messages in thread
From: Stefano Garzarella @ 2021-02-22 11:43 UTC (permalink / raw)
To: Arseny Krasnov
Cc: Andra Paraschiv, kvm, Michael S. Tsirkin, netdev, stsp2,
linux-kernel, virtualization, oxffffaa, Norbert Slusarek,
Stefan Hajnoczi, Colin Ian King, Jakub Kicinski, David S. Miller,
Jorgen Hansen
On Thu, Feb 18, 2021 at 08:36:50AM +0300, Arseny Krasnov wrote:
>This moves STREAM specific data receive logic to dedicated function:
>'__vsock_stream_recvmsg()', while checks that will be same for both
>types of socket are in shared function: 'vsock_connectible_recvmsg()'.
I'm not a native speaker, but I would rewrite this message like this:
Move STREAM specific data receive logic to '__vsock_stream_recvmsg()'
dedicated function, while checks, that will be same for both STREAM
and SEQPACKET sockets, stays in 'vsock_connectible_recvmsg()' shared
functions.
Anyway the patch LGTM:
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
>
>Signed-off-by: Arseny Krasnov <arseny.krasnov@kaspersky.com>
>---
> net/vmw_vsock/af_vsock.c | 116 ++++++++++++++++++++++-----------------
> 1 file changed, 67 insertions(+), 49 deletions(-)
>
>diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
>index 6cf7bb977aa1..d277dc1cdbdf 100644
>--- a/net/vmw_vsock/af_vsock.c
>+++ b/net/vmw_vsock/af_vsock.c
>@@ -1894,65 +1894,22 @@ static int vsock_wait_data(struct sock *sk, struct wait_queue_entry *wait,
> return data;
> }
>
>-static int
>-vsock_connectible_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
>- int flags)
>+static int __vsock_stream_recvmsg(struct sock *sk, struct msghdr *msg,
>+ size_t len, int flags)
> {
>- struct sock *sk;
>- struct vsock_sock *vsk;
>+ struct vsock_transport_recv_notify_data recv_data;
> const struct vsock_transport *transport;
>- int err;
>- size_t target;
>+ struct vsock_sock *vsk;
> ssize_t copied;
>+ size_t target;
> long timeout;
>- struct vsock_transport_recv_notify_data recv_data;
>+ int err;
>
> DEFINE_WAIT(wait);
>
>- sk = sock->sk;
> vsk = vsock_sk(sk);
>- err = 0;
>-
>- lock_sock(sk);
>-
> transport = vsk->transport;
>
>- if (!transport || sk->sk_state != TCP_ESTABLISHED) {
>- /* Recvmsg is supposed to return 0 if a peer performs an
>- * orderly shutdown. Differentiate between that case and when a
>- * peer has not connected or a local shutdown occured
>with the
>- * SOCK_DONE flag.
>- */
>- if (sock_flag(sk, SOCK_DONE))
>- err = 0;
>- else
>- err = -ENOTCONN;
>-
>- goto out;
>- }
>-
>- if (flags & MSG_OOB) {
>- err = -EOPNOTSUPP;
>- goto out;
>- }
>-
>- /* We don't check peer_shutdown flag here since peer may actually shut
>- * down, but there can be data in the queue that a local socket can
>- * receive.
>- */
>- if (sk->sk_shutdown & RCV_SHUTDOWN) {
>- err = 0;
>- goto out;
>- }
>-
>- /* It is valid on Linux to pass in a zero-length receive buffer. This
>- * is not an error. We may as well bail out now.
>- */
>- if (!len) {
>- err = 0;
>- goto out;
>- }
>-
> /* We must not copy less than target bytes into the user's buffer
> * before returning successfully, so we wait for the consume queue to
> * have that much data to consume before dequeueing. Note that this
>@@ -2011,6 +1968,67 @@ vsock_connectible_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
> if (copied > 0)
> err = copied;
>
>+out:
>+ return err;
>+}
>+
>+static int
>+vsock_connectible_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
>+ int flags)
>+{
>+ struct sock *sk;
>+ struct vsock_sock *vsk;
>+ const struct vsock_transport *transport;
>+ int err;
>+
>+ DEFINE_WAIT(wait);
>+
>+ sk = sock->sk;
>+ vsk = vsock_sk(sk);
>+ err = 0;
>+
>+ lock_sock(sk);
>+
>+ transport = vsk->transport;
>+
>+ if (!transport || sk->sk_state != TCP_ESTABLISHED) {
>+ /* Recvmsg is supposed to return 0 if a peer performs an
>+ * orderly shutdown. Differentiate between that case and
>when a
>+ * peer has not connected or a local shutdown occurred with the
>+ * SOCK_DONE flag.
>+ */
>+ if (sock_flag(sk, SOCK_DONE))
>+ err = 0;
>+ else
>+ err = -ENOTCONN;
>+
>+ goto out;
>+ }
>+
>+ if (flags & MSG_OOB) {
>+ err = -EOPNOTSUPP;
>+ goto out;
>+ }
>+
>+ /* We don't check peer_shutdown flag here since peer may actually shut
>+ * down, but there can be data in the queue that a local socket can
>+ * receive.
>+ */
>+ if (sk->sk_shutdown & RCV_SHUTDOWN) {
>+ err = 0;
>+ goto out;
>+ }
>+
>+ /* It is valid on Linux to pass in a zero-length receive buffer. This
>+ * is not an error. We may as well bail out now.
>+ */
>+ if (!len) {
>+ err = 0;
>+ goto out;
>+ }
>+
>+ err = __vsock_stream_recvmsg(sk, msg, len, flags);
>+
> out:
> release_sock(sk);
> return err;
>--
>2.25.1
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC PATCH v5 04/19] af_vsock: implement SEQPACKET receive loop
[not found] ` <20210218053719.1067237-1-arseny.krasnov@kaspersky.com>
@ 2021-02-22 11:53 ` Stefano Garzarella
2021-02-25 16:27 ` Jorgen Hansen
1 sibling, 0 replies; 21+ messages in thread
From: Stefano Garzarella @ 2021-02-22 11:53 UTC (permalink / raw)
To: Arseny Krasnov
Cc: Andra Paraschiv, kvm, Michael S. Tsirkin, netdev, stsp2,
linux-kernel, virtualization, oxffffaa, Norbert Slusarek,
Stefan Hajnoczi, Colin Ian King, Jakub Kicinski, David S. Miller,
Jorgen Hansen
On Thu, Feb 18, 2021 at 08:37:15AM +0300, Arseny Krasnov wrote:
>This adds receive loop for SEQPACKET. It looks like receive loop for
>STREAM, but there is a little bit difference:
>1) It doesn't call notify callbacks.
>2) It doesn't care about 'SO_SNDLOWAT' and 'SO_RCVLOWAT' values, because
> there is no sense for these values in SEQPACKET case.
>3) It waits until whole record is received or error is found during
> receiving.
>4) It processes and sets 'MSG_TRUNC' flag.
>
>So to avoid extra conditions for two types of socket inside one loop, two
>independent functions were created.
>
>Signed-off-by: Arseny Krasnov <arseny.krasnov@kaspersky.com>
>---
> include/net/af_vsock.h | 5 +++
> net/vmw_vsock/af_vsock.c | 97 +++++++++++++++++++++++++++++++++++++++-
> 2 files changed, 101 insertions(+), 1 deletion(-)
>
>diff --git a/include/net/af_vsock.h b/include/net/af_vsock.h
>index b1c717286993..01563338cc03 100644
>--- a/include/net/af_vsock.h
>+++ b/include/net/af_vsock.h
>@@ -135,6 +135,11 @@ struct vsock_transport {
> bool (*stream_is_active)(struct vsock_sock *);
> bool (*stream_allow)(u32 cid, u32 port);
>
>+ /* SEQ_PACKET. */
>+ size_t (*seqpacket_seq_get_len)(struct vsock_sock *vsk);
>+ int (*seqpacket_dequeue)(struct vsock_sock *vsk, struct msghdr *msg,
>+ int flags, bool *msg_ready);
I think this should be:
int (*seqpacket_dequeue)(struct vsock_sock *vsk, struct msghdr *msg,
int flags, bool *msg_ready);
To avoid:
$ ./scripts/checkpatch.pl --strict -g HEAD
CHECK: Alignment should match open parenthesis
#35: FILE: include/net/af_vsock.h:141:
+ int (*seqpacket_dequeue)(struct vsock_sock *vsk, struct msghdr *msg,
+ int flags, bool *msg_ready);
>+
> /* Notification. */
> int (*notify_poll_in)(struct vsock_sock *, size_t, bool *);
> int (*notify_poll_out)(struct vsock_sock *, size_t, bool *);
>diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
>index d277dc1cdbdf..b754927a556a 100644
>--- a/net/vmw_vsock/af_vsock.c
>+++ b/net/vmw_vsock/af_vsock.c
>@@ -1972,6 +1972,98 @@ static int __vsock_stream_recvmsg(struct sock *sk, struct msghdr *msg,
> return err;
> }
>
>+static int __vsock_seqpacket_recvmsg(struct sock *sk, struct msghdr *msg,
>+ size_t len, int flags)
>+{
>+ const struct vsock_transport *transport;
>+ const struct iovec *orig_iov;
>+ unsigned long orig_nr_segs;
>+ bool msg_ready;
>+ struct vsock_sock *vsk;
>+ size_t record_len;
>+ long timeout;
>+ int err = 0;
>+ DEFINE_WAIT(wait);
>+
>+ vsk = vsock_sk(sk);
>+ transport = vsk->transport;
>+
>+ timeout = sock_rcvtimeo(sk, flags & MSG_DONTWAIT);
>+ orig_nr_segs = msg->msg_iter.nr_segs;
>+ orig_iov = msg->msg_iter.iov;
>+ msg_ready = false;
>+ record_len = 0;
>+
>+ while (1) {
>+ err = vsock_wait_data(sk, &wait, timeout, NULL, 0);
>+
>+ if (err <= 0) {
>+ /* In case of any loop break(timeout, signal
>+ * interrupt or shutdown), we report user that
>+ * nothing was copied.
>+ */
>+ err = 0;
>+ break;
>+ }
>+
>+ if (record_len == 0) {
>+ record_len =
>+ transport->seqpacket_seq_get_len(vsk);
>+
>+ if (record_len == 0)
>+ continue;
>+ }
>+
>+ err = transport->seqpacket_dequeue(vsk, msg,
>+ flags, &msg_ready);
>+
Sorry, I expressed myself wrong.
Here it's fine to avoid the blank line as in the previous version, by
single line I meant the seqpacket_dequeue() call, something like this:
err = transport->seqpacket_dequeue(vsk, msg, flags, &msg_ready);
if (err < 0) {
>+ if (err < 0) {
>+ if (err == -EAGAIN) {
>+ iov_iter_init(&msg->msg_iter, READ,
>+ orig_iov, orig_nr_segs,
>+ len);
>+ /* Clear 'MSG_EOR' here, because dequeue
>+ * callback above set it again if it was
>+ * set by sender. This 'MSG_EOR' is from
>+ * dropped record.
>+ */
>+ msg->msg_flags &= ~MSG_EOR;
>+ record_len = 0;
>+ continue;
>+ }
>+
>+ err = -ENOMEM;
>+ break;
>+ }
>+
>+ if (msg_ready)
>+ break;
>+ }
>+
>+ if (sk->sk_err)
>+ err = -sk->sk_err;
>+ else if (sk->sk_shutdown & RCV_SHUTDOWN)
>+ err = 0;
>+
>+ if (msg_ready) {
>+ /* User sets MSG_TRUNC, so return real length of
>+ * packet.
>+ */
>+ if (flags & MSG_TRUNC)
>+ err = record_len;
>+ else
>+ err = len - msg->msg_iter.count;
>+
>+ /* Always set MSG_TRUNC if real length of packet is
>+ * bigger than user's buffer.
>+ */
>+ if (record_len > len)
>+ msg->msg_flags |= MSG_TRUNC;
>+ }
>+
>+ return err;
>+}
>+
> static int
> vsock_connectible_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
> int flags)
>@@ -2027,7 +2119,10 @@ vsock_connectible_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
> goto out;
> }
>
>- err = __vsock_stream_recvmsg(sk, msg, len, flags);
>+ if (sk->sk_type == SOCK_STREAM)
>+ err = __vsock_stream_recvmsg(sk, msg, len, flags);
>+ else
>+ err = __vsock_seqpacket_recvmsg(sk, msg, len, flags);
>
> out:
> release_sock(sk);
>--
>2.25.1
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC PATCH v5 05/19] af_vsock: separate wait space loop
[not found] ` <20210218053758.1067436-1-arseny.krasnov@kaspersky.com>
@ 2021-02-22 12:06 ` Stefano Garzarella
0 siblings, 0 replies; 21+ messages in thread
From: Stefano Garzarella @ 2021-02-22 12:06 UTC (permalink / raw)
To: Arseny Krasnov
Cc: Andra Paraschiv, kvm, Michael S. Tsirkin, netdev, stsp2,
linux-kernel, virtualization, oxffffaa, Norbert Slusarek,
Stefan Hajnoczi, Colin Ian King, Jakub Kicinski, David S. Miller,
Jorgen Hansen
On Thu, Feb 18, 2021 at 08:37:54AM +0300, Arseny Krasnov wrote:
>This moves loop that waits for space on send to separate function,
>because it will be used for SEQ_BEGIN/SEQ_END sending before and
>after data transmission. Waiting for SEQ_BEGIN/SEQ_END is needed
>because such packets carries SEQPACKET header that couldn't be
>fragmented by credit mechanism, so to avoid it, sender waits until
>enough space will be ready.
>
>Signed-off-by: Arseny Krasnov <arseny.krasnov@kaspersky.com>
>---
> include/net/af_vsock.h | 2 +
> net/vmw_vsock/af_vsock.c | 99 +++++++++++++++++++++++++---------------
> 2 files changed, 63 insertions(+), 38 deletions(-)
>
>diff --git a/include/net/af_vsock.h b/include/net/af_vsock.h
>index 01563338cc03..6fbe88306403 100644
>--- a/include/net/af_vsock.h
>+++ b/include/net/af_vsock.h
>@@ -205,6 +205,8 @@ 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);
> bool vsock_find_cid(unsigned int cid);
>+int vsock_wait_space(struct sock *sk, size_t space, int flags,
>+ struct vsock_transport_send_notify_data *send_data);
>
> /**** TAP ****/
>
>diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
>index b754927a556a..09b377422b1e 100644
>--- a/net/vmw_vsock/af_vsock.c
>+++ b/net/vmw_vsock/af_vsock.c
>@@ -1692,6 +1692,65 @@ static int vsock_connectible_getsockopt(struct socket *sock,
> return 0;
> }
>
>+int vsock_wait_space(struct sock *sk, size_t space, int flags,
>+ struct vsock_transport_send_notify_data *send_data)
>+{
>+ const struct vsock_transport *transport;
>+ struct vsock_sock *vsk;
>+ long timeout;
>+ int err;
>+
>+ DEFINE_WAIT_FUNC(wait, woken_wake_function);
>+
>+ vsk = vsock_sk(sk);
>+ transport = vsk->transport;
>+ timeout = sock_sndtimeo(sk, flags & MSG_DONTWAIT);
>+ err = 0;
>+
>+ add_wait_queue(sk_sleep(sk), &wait);
>+
>+ while (vsock_stream_has_space(vsk) < space &&
>+ sk->sk_err == 0 &&
>+ !(sk->sk_shutdown & SEND_SHUTDOWN) &&
>+ !(vsk->peer_shutdown & RCV_SHUTDOWN)) {
>+
>+ /* Don't wait for non-blocking sockets. */
>+ if (timeout == 0) {
>+ err = -EAGAIN;
>+ goto out_err;
>+ }
>+
>+ if (send_data) {
>+ err = transport->notify_send_pre_block(vsk, send_data);
>+ if (err < 0)
>+ goto out_err;
>+ }
>+
>+ release_sock(sk);
>+ timeout = wait_woken(&wait, TASK_INTERRUPTIBLE, timeout);
>+ lock_sock(sk);
>+ if (signal_pending(current)) {
>+ err = sock_intr_errno(timeout);
>+ goto out_err;
>+ } else if (timeout == 0) {
>+ err = -EAGAIN;
>+ goto out_err;
>+ }
>+ }
>+
>+ if (sk->sk_err) {
>+ err = -sk->sk_err;
>+ } else if ((sk->sk_shutdown & SEND_SHUTDOWN) ||
>+ (vsk->peer_shutdown & RCV_SHUTDOWN)) {
>+ err = -EPIPE;
>+ }
>+
>+out_err:
>+ remove_wait_queue(sk_sleep(sk), &wait);
>+ return err;
>+}
>+EXPORT_SYMBOL_GPL(vsock_wait_space);
>+
> static int vsock_connectible_sendmsg(struct socket *sock, struct msghdr *msg,
> size_t len)
> {
>@@ -1699,10 +1758,8 @@ static int vsock_connectible_sendmsg(struct socket *sock, struct msghdr *msg,
> struct vsock_sock *vsk;
> const struct vsock_transport *transport;
> ssize_t total_written;
>- long timeout;
> int err;
> struct vsock_transport_send_notify_data send_data;
>- DEFINE_WAIT_FUNC(wait, woken_wake_function);
>
> sk = sock->sk;
> vsk = vsock_sk(sk);
>@@ -1740,9 +1797,6 @@ static int vsock_connectible_sendmsg(struct socket *sock, struct msghdr *msg,
> goto out;
> }
>
>- /* Wait for room in the produce queue to enqueue our user's data. */
>- timeout = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT);
>-
> err = transport->notify_send_init(vsk, &send_data);
> if (err < 0)
> goto out;
>@@ -1750,39 +1804,8 @@ static int vsock_connectible_sendmsg(struct socket *sock, struct msghdr *msg,
> while (total_written < len) {
> ssize_t written;
>
>- add_wait_queue(sk_sleep(sk), &wait);
>- while (vsock_stream_has_space(vsk) == 0 &&
>- sk->sk_err == 0 &&
>- !(sk->sk_shutdown & SEND_SHUTDOWN) &&
>- !(vsk->peer_shutdown & RCV_SHUTDOWN)) {
>-
>- /* Don't wait for non-blocking sockets. */
>- if (timeout == 0) {
>- err = -EAGAIN;
>- remove_wait_queue(sk_sleep(sk), &wait);
>- goto out_err;
>- }
>-
>- err = transport->notify_send_pre_block(vsk, &send_data);
>- if (err < 0) {
>- remove_wait_queue(sk_sleep(sk), &wait);
>- goto out_err;
>- }
>-
>- release_sock(sk);
>- timeout = wait_woken(&wait, TASK_INTERRUPTIBLE, timeout);
>- lock_sock(sk);
>- if (signal_pending(current)) {
>- err = sock_intr_errno(timeout);
>- remove_wait_queue(sk_sleep(sk), &wait);
>- goto out_err;
>- } else if (timeout == 0) {
>- err = -EAGAIN;
>- remove_wait_queue(sk_sleep(sk), &wait);
>- goto out_err;
>- }
>- }
>- remove_wait_queue(sk_sleep(sk), &wait);
>+ if (vsock_wait_space(sk, 1, msg->msg_flags, &send_data))
>+ goto out_err;
>
> /* These checks occur both as part of and after the loop
> * conditional since we need to check before and after
>--
>2.25.1
>
The patch LGTM:
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC PATCH v5 07/19] af_vsock: rest of SEQPACKET support
[not found] ` <20210218053831.1067678-1-arseny.krasnov@kaspersky.com>
@ 2021-02-22 14:12 ` Stefano Garzarella
0 siblings, 0 replies; 21+ messages in thread
From: Stefano Garzarella @ 2021-02-22 14:12 UTC (permalink / raw)
To: Arseny Krasnov
Cc: Andra Paraschiv, kvm, Michael S. Tsirkin, netdev, stsp2,
linux-kernel, virtualization, oxffffaa, Norbert Slusarek,
Stefan Hajnoczi, Colin Ian King, Jakub Kicinski, David S. Miller,
Jorgen Hansen
On Thu, Feb 18, 2021 at 08:38:28AM +0300, Arseny Krasnov wrote:
>This does rest of SOCK_SEQPACKET support:
>1) Adds socket ops for SEQPACKET type.
>2) Allows to create socket with SEQPACKET type.
>
>Signed-off-by: Arseny Krasnov <arseny.krasnov@kaspersky.com>
>---
> net/vmw_vsock/af_vsock.c | 36 +++++++++++++++++++++++++++++++++++-
> 1 file changed, 35 insertions(+), 1 deletion(-)
>
>diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
>index f352cd9d91ce..f4b02c6d35d1 100644
>--- a/net/vmw_vsock/af_vsock.c
>+++ b/net/vmw_vsock/af_vsock.c
>@@ -452,6 +452,7 @@ int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk)
> new_transport = transport_dgram;
> break;
> case SOCK_STREAM:
>+ case SOCK_SEQPACKET:
> if (vsock_use_local_transport(remote_cid))
> new_transport = transport_local;
> else if (remote_cid <= VMADDR_CID_HOST || !transport_h2g ||
>@@ -484,6 +485,14 @@ int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk)
> if (!new_transport || !try_module_get(new_transport->module))
> return -ENODEV;
>
>+ if (sk->sk_type == SOCK_SEQPACKET) {
>+ if (!new_transport->seqpacket_seq_send_len ||
>+ !new_transport->seqpacket_seq_send_eor ||
>+ !new_transport->seqpacket_seq_get_len ||
>+ !new_transport->seqpacket_dequeue)
We must release the module reference acquired above:
module_put(new_transport->module);
>+ return -ESOCKTNOSUPPORT;
>+ }
>+
> ret = new_transport->init(vsk, psk);
> if (ret) {
> module_put(new_transport->module);
>@@ -684,6 +693,7 @@ static int __vsock_bind(struct sock *sk, struct sockaddr_vm *addr)
>
> switch (sk->sk_socket->type) {
> case SOCK_STREAM:
>+ case SOCK_SEQPACKET:
> spin_lock_bh(&vsock_table_lock);
> retval = __vsock_bind_connectible(vsk, addr);
> spin_unlock_bh(&vsock_table_lock);
>@@ -769,7 +779,7 @@ static struct sock *__vsock_create(struct net *net,
>
> static bool sock_type_connectible(u16 type)
> {
>- return type == SOCK_STREAM;
>+ return (type == SOCK_STREAM) || (type == SOCK_SEQPACKET);
> }
>
> static void __vsock_release(struct sock *sk, int level)
>@@ -2191,6 +2201,27 @@ static const struct proto_ops vsock_stream_ops = {
> .sendpage = sock_no_sendpage,
> };
>
>+static const struct proto_ops vsock_seqpacket_ops = {
>+ .family = PF_VSOCK,
>+ .owner = THIS_MODULE,
>+ .release = vsock_release,
>+ .bind = vsock_bind,
>+ .connect = vsock_connect,
>+ .socketpair = sock_no_socketpair,
>+ .accept = vsock_accept,
>+ .getname = vsock_getname,
>+ .poll = vsock_poll,
>+ .ioctl = sock_no_ioctl,
>+ .listen = vsock_listen,
>+ .shutdown = vsock_shutdown,
>+ .setsockopt = vsock_connectible_setsockopt,
>+ .getsockopt = vsock_connectible_getsockopt,
>+ .sendmsg = vsock_connectible_sendmsg,
>+ .recvmsg = vsock_connectible_recvmsg,
>+ .mmap = sock_no_mmap,
>+ .sendpage = sock_no_sendpage,
>+};
>+
> static int vsock_create(struct net *net, struct socket *sock,
> int protocol, int kern)
> {
>@@ -2211,6 +2242,9 @@ static int vsock_create(struct net *net, struct socket *sock,
> case SOCK_STREAM:
> sock->ops = &vsock_stream_ops;
> break;
>+ case SOCK_SEQPACKET:
>+ sock->ops = &vsock_seqpacket_ops;
>+ break;
> default:
> return -ESOCKTNOSUPPORT;
> }
>--
>2.25.1
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC PATCH v5 08/19] af_vsock: update comments for stream sockets
[not found] ` <20210218053852.1067811-1-arseny.krasnov@kaspersky.com>
@ 2021-02-22 14:18 ` Stefano Garzarella
0 siblings, 0 replies; 21+ messages in thread
From: Stefano Garzarella @ 2021-02-22 14:18 UTC (permalink / raw)
To: Arseny Krasnov
Cc: Andra Paraschiv, kvm, Michael S. Tsirkin, netdev, stsp2,
linux-kernel, virtualization, oxffffaa, Norbert Slusarek,
Stefan Hajnoczi, Colin Ian King, Jakub Kicinski, David S. Miller,
Jorgen Hansen
On Thu, Feb 18, 2021 at 08:38:48AM +0300, Arseny Krasnov wrote:
>This replaces 'stream' to 'connect oriented' in comments as SEQPACKET is
^ connection
You forgot to update the commit message :-)
With that fixed:
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
>also connect oriented.
>
>Signed-off-by: Arseny Krasnov <arseny.krasnov@kaspersky.com>
>---
> net/vmw_vsock/af_vsock.c | 31 +++++++++++++++++--------------
> 1 file changed, 17 insertions(+), 14 deletions(-)
>
>diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
>index f4b02c6d35d1..f1bf6a5ad15e 100644
>--- a/net/vmw_vsock/af_vsock.c
>+++ b/net/vmw_vsock/af_vsock.c
>@@ -415,8 +415,8 @@ static void vsock_deassign_transport(struct vsock_sock *vsk)
>
> /* Assign a transport to a socket and call the .init transport callback.
> *
>- * Note: for stream socket this must be called when vsk->remote_addr is set
>- * (e.g. during the connect() or when a connection request on a listener
>+ * Note: for connection oriented socket this must be called when vsk->remote_addr
>+ * is set (e.g. during the connect() or when a connection request on a listener
> * socket is received).
> * The vsk->remote_addr is used to decide which transport to use:
> * - remote CID == VMADDR_CID_LOCAL or g2h->local_cid or VMADDR_CID_HOST if
>@@ -470,10 +470,10 @@ int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk)
> return 0;
>
> /* transport->release() must be called with sock lock acquired.
>- * This path can only be taken during vsock_stream_connect(),
>- * where we have already held the sock lock.
>- * In the other cases, this function is called on a new socket
>- * which is not assigned to any transport.
>+ * This path can only be taken during vsock_connect(), where we
>+ * have already held the sock lock. In the other cases, this
>+ * function is called on a new socket which is not assigned to
>+ * any transport.
> */
> vsk->transport->release(vsk);
> vsock_deassign_transport(vsk);
>@@ -658,9 +658,10 @@ static int __vsock_bind_connectible(struct vsock_sock *vsk,
>
> vsock_addr_init(&vsk->local_addr, new_addr.svm_cid, new_addr.svm_port);
>
>- /* Remove stream sockets from the unbound list and add them to the hash
>- * table for easy lookup by its address. The unbound list is simply an
>- * extra entry at the end of the hash table, a trick used by AF_UNIX.
>+ /* Remove connection oriented sockets from the unbound list and add them
>+ * to the hash table for easy lookup by its address. The unbound list
>+ * is simply an extra entry at the end of the hash table, a trick used
>+ * by AF_UNIX.
> */
> __vsock_remove_bound(vsk);
> __vsock_insert_bound(vsock_bound_sockets(&vsk->local_addr), vsk);
>@@ -951,10 +952,10 @@ static int vsock_shutdown(struct socket *sock, int mode)
> if ((mode & ~SHUTDOWN_MASK) || !mode)
> return -EINVAL;
>
>- /* If this is a STREAM socket and it is not connected then bail out
>- * immediately. If it is a DGRAM socket then we must first kick the
>- * socket so that it wakes up from any sleeping calls, for example
>- * recv(), and then afterwards return the error.
>+ /* If this is a connection oriented socket and it is not connected then
>+ * bail out immediately. If it is a DGRAM socket then we must first
>+ * kick the socket so that it wakes up from any sleeping calls, for
>+ * example recv(), and then afterwards return the error.
> */
>
> sk = sock->sk;
>@@ -1783,7 +1784,9 @@ static int vsock_connectible_sendmsg(struct socket *sock, struct msghdr *msg,
>
> transport = vsk->transport;
>
>- /* Callers should not provide a destination with stream sockets. */
>+ /* Callers should not provide a destination with connection oriented
>+ * sockets.
>+ */
> if (msg->msg_namelen) {
> err = sk->sk_state == TCP_ESTABLISHED ? -EISCONN : -EOPNOTSUPP;
> goto out;
>--
>2.25.1
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC PATCH v5 00/19] virtio/vsock: introduce SOCK_SEQPACKET support
[not found] <20210218053347.1066159-1-arseny.krasnov@kaspersky.com>
` (6 preceding siblings ...)
[not found] ` <20210218053852.1067811-1-arseny.krasnov@kaspersky.com>
@ 2021-02-22 14:23 ` Stefano Garzarella
2021-02-23 14:50 ` Stefano Garzarella
[not found] ` <20210218053906.1067920-1-arseny.krasnov@kaspersky.com>
` (3 subsequent siblings)
11 siblings, 1 reply; 21+ messages in thread
From: Stefano Garzarella @ 2021-02-22 14:23 UTC (permalink / raw)
To: Arseny Krasnov
Cc: Andra Paraschiv, kvm, Michael S. Tsirkin, netdev, stsp2,
linux-kernel, virtualization, oxffffaa, Norbert Slusarek,
Stefan Hajnoczi, Colin Ian King, Jakub Kicinski, David S. Miller,
Jorgen Hansen
Hi Arseny,
On Thu, Feb 18, 2021 at 08:33:44AM +0300, Arseny Krasnov wrote:
> This patchset impelements support of SOCK_SEQPACKET for virtio
>transport.
> As SOCK_SEQPACKET guarantees to save record boundaries, so to
>do it, two new packet operations were added: first for start of record
> and second to mark end of record(SEQ_BEGIN and SEQ_END later). Also,
>both operations carries metadata - to maintain boundaries and payload
>integrity. Metadata is introduced by adding special header with two
>fields - message count and message length:
>
> struct virtio_vsock_seq_hdr {
> __le32 msg_cnt;
> __le32 msg_len;
> } __attribute__((packed));
>
> This header is transmitted as payload of SEQ_BEGIN and SEQ_END
>packets(buffer of second virtio descriptor in chain) in the same way as
>data transmitted in RW packets. Payload was chosen as buffer for this
>header to avoid touching first virtio buffer which carries header of
>packet, because someone could check that size of this buffer is equal
>to size of packet header. To send record, packet with start marker is
>sent first(it's header contains length of record and counter), then
>counter is incremented and all data is sent as usual 'RW' packets and
>finally SEQ_END is sent(it also carries counter of message, which is
>counter of SEQ_BEGIN + 1), also after sedning SEQ_END counter is
>incremented again. On receiver's side, length of record is known from
>packet with start record marker. To check that no packets were dropped
>by transport, counters of two sequential SEQ_BEGIN and SEQ_END are
>checked(counter of SEQ_END must be bigger that counter of SEQ_BEGIN by
>1) and length of data between two markers is compared to length in
>SEQ_BEGIN header.
> Now as packets of one socket are not reordered neither on
>vsock nor on vhost transport layers, such markers allows to restore
>original record on receiver's side. If user's buffer is smaller that
>record length, when all out of size data is dropped.
> Maximum length of datagram is not limited as in stream socket,
>because same credit logic is used. Difference with stream socket is
>that user is not woken up until whole record is received or error
>occurred. Implementation also supports 'MSG_EOR' and 'MSG_TRUNC' flags.
> Tests also implemented.
I reviewed the first part (af_vsock.c changes), tomorrow I'll review the
rest. That part looks great to me, only found a few minor issues.
In the meantime, however, I'm getting a doubt, especially with regard to
other transports besides virtio.
Should we hide the begin/end marker sending in the transport?
I mean, should the transport just provide a seqpacket_enqueue()
callbacl?
Inside it then the transport will send the markers. This is because some
transports might not need to send markers.
But thinking about it more, they could actually implement stubs for that
calls, if they don't need to send markers.
So I think for now it's fine since it allows us to reuse a lot of code,
unless someone has some objection.
Thanks,
Stefano
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC PATCH v5 09/19] virtio/vsock: set packet's type in send
[not found] ` <20210218053906.1067920-1-arseny.krasnov@kaspersky.com>
@ 2021-02-23 13:42 ` Stefano Garzarella
0 siblings, 0 replies; 21+ messages in thread
From: Stefano Garzarella @ 2021-02-23 13:42 UTC (permalink / raw)
To: Arseny Krasnov
Cc: Andra Paraschiv, kvm, Michael S. Tsirkin, netdev, stsp2,
linux-kernel, virtualization, oxffffaa, Norbert Slusarek,
Stefan Hajnoczi, Colin Ian King, Jakub Kicinski, David S. Miller,
Jorgen Hansen
The title is a little cryptic, maybe a something like:
virtio/vsock: set packet's type in virtio_transport_send_pkt_info()
On Thu, Feb 18, 2021 at 08:39:02AM +0300, Arseny Krasnov wrote:
>This moves passing type of packet from 'info' srtucture to send
Also here replace send with the function name.
>function. There is no sense to set type of packet which differs
>from type of socket, and since at current time only stream type
>is supported, so force to use this type.
I'm not a native speaker, but I would rephrase a bit the commit message:
There is no need to set type of packet which differs from type of
socket. Since at current time only stream type is supported, set
it directly in virtio_transport_send_pkt_info(), so callers don't
need to set it.
>
>Signed-off-by: Arseny Krasnov <arseny.krasnov@kaspersky.com>
>---
> net/vmw_vsock/virtio_transport_common.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
If I haven't missed something, we can remove 'type' parameter also from
virtio_transport_send_credit_update(), right?
>diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
>index e4370b1b7494..1c9d71ca5e8e 100644
>--- a/net/vmw_vsock/virtio_transport_common.c
>+++ b/net/vmw_vsock/virtio_transport_common.c
>@@ -179,6 +179,8 @@ static int virtio_transport_send_pkt_info(struct vsock_sock *vsk,
> struct virtio_vsock_pkt *pkt;
> u32 pkt_len = info->pkt_len;
>
>+ info->type = VIRTIO_VSOCK_TYPE_STREAM;
>+
> t_ops = virtio_transport_get_ops(vsk);
> if (unlikely(!t_ops))
> return -EFAULT;
>@@ -624,7 +626,6 @@ int virtio_transport_connect(struct vsock_sock *vsk)
> {
> struct virtio_vsock_pkt_info info = {
> .op = VIRTIO_VSOCK_OP_REQUEST,
>- .type = VIRTIO_VSOCK_TYPE_STREAM,
> .vsk = vsk,
> };
>
>@@ -636,7 +637,6 @@ int virtio_transport_shutdown(struct vsock_sock *vsk, int mode)
> {
> struct virtio_vsock_pkt_info info = {
> .op = VIRTIO_VSOCK_OP_SHUTDOWN,
>- .type = VIRTIO_VSOCK_TYPE_STREAM,
> .flags = (mode & RCV_SHUTDOWN ?
> VIRTIO_VSOCK_SHUTDOWN_RCV : 0) |
> (mode & SEND_SHUTDOWN ?
>@@ -665,7 +665,6 @@ virtio_transport_stream_enqueue(struct vsock_sock *vsk,
> {
> struct virtio_vsock_pkt_info info = {
> .op = VIRTIO_VSOCK_OP_RW,
>- .type = VIRTIO_VSOCK_TYPE_STREAM,
> .msg = msg,
> .pkt_len = len,
> .vsk = vsk,
>@@ -688,7 +687,6 @@ static int virtio_transport_reset(struct vsock_sock *vsk,
> {
> struct virtio_vsock_pkt_info info = {
> .op = VIRTIO_VSOCK_OP_RST,
>- .type = VIRTIO_VSOCK_TYPE_STREAM,
> .reply = !!pkt,
> .vsk = vsk,
> };
>@@ -990,7 +988,6 @@ virtio_transport_send_response(struct vsock_sock *vsk,
> {
> struct virtio_vsock_pkt_info info = {
> .op = VIRTIO_VSOCK_OP_RESPONSE,
>- .type = VIRTIO_VSOCK_TYPE_STREAM,
> .remote_cid = le64_to_cpu(pkt->hdr.src_cid),
> .remote_port = le32_to_cpu(pkt->hdr.src_port),
> .reply = true,
>--
>2.25.1
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC PATCH v5 10/19] virtio/vsock: simplify credit update function API
[not found] ` <20210218053926.1068053-1-arseny.krasnov@kaspersky.com>
@ 2021-02-23 13:49 ` Stefano Garzarella
0 siblings, 0 replies; 21+ messages in thread
From: Stefano Garzarella @ 2021-02-23 13:49 UTC (permalink / raw)
To: Arseny Krasnov
Cc: Andra Paraschiv, kvm, Michael S. Tsirkin, netdev, stsp2,
linux-kernel, virtualization, oxffffaa, Norbert Slusarek,
Stefan Hajnoczi, Colin Ian King, Jakub Kicinski, David S. Miller,
Jorgen Hansen
On Thu, Feb 18, 2021 at 08:39:23AM +0300, Arseny Krasnov wrote:
>'virtio_transport_send_credit_update()' has some extra args:
>1) 'type' may be set in 'virtio_transport_send_pkt_info()' using type
> of socket.
>2) This function is static and 'hdr' arg was always NULL.
>
>Signed-off-by: Arseny Krasnov <arseny.krasnov@kaspersky.com>
>---
> net/vmw_vsock/virtio_transport_common.c | 15 ++++-----------
> 1 file changed, 4 insertions(+), 11 deletions(-)
>
>diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
>index 1c9d71ca5e8e..833104b71a1c 100644
>--- a/net/vmw_vsock/virtio_transport_common.c
>+++ b/net/vmw_vsock/virtio_transport_common.c
>@@ -271,13 +271,10 @@ void virtio_transport_put_credit(struct virtio_vsock_sock *vvs, u32 credit)
> }
> EXPORT_SYMBOL_GPL(virtio_transport_put_credit);
>
>-static int virtio_transport_send_credit_update(struct vsock_sock *vsk,
>- int type,
>- struct virtio_vsock_hdr *hdr)
>+static int virtio_transport_send_credit_update(struct vsock_sock *vsk)
> {
> struct virtio_vsock_pkt_info info = {
> .op = VIRTIO_VSOCK_OP_CREDIT_UPDATE,
>- .type = type,
> .vsk = vsk,
> };
I don't know if it's better to remove type with the others changes in
the previous patch, maybe it's more consistent.
I mean only the removal of 'type' parameter, the 'hdr' parameter should
be removed with this patch.
>
>@@ -385,11 +382,8 @@ virtio_transport_stream_do_dequeue(struct vsock_sock *vsk,
> * messages, we set the limit to a high value. TODO: experiment
> * with different values.
> */
>- if (free_space < VIRTIO_VSOCK_MAX_PKT_BUF_SIZE) {
>- virtio_transport_send_credit_update(vsk,
>-
>VIRTIO_VSOCK_TYPE_STREAM,
>- NULL);
>- }
>+ if (free_space < VIRTIO_VSOCK_MAX_PKT_BUF_SIZE)
>+ virtio_transport_send_credit_update(vsk);
>
> return total;
>
>@@ -498,8 +492,7 @@ void virtio_transport_notify_buffer_size(struct vsock_sock *vsk, u64 *val)
>
> vvs->buf_alloc = *val;
>
>- virtio_transport_send_credit_update(vsk, VIRTIO_VSOCK_TYPE_STREAM,
>- NULL);
>+ virtio_transport_send_credit_update(vsk);
> }
> EXPORT_SYMBOL_GPL(virtio_transport_notify_buffer_size);
>
>--
>2.25.1
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC PATCH v5 11/19] virtio/vsock: dequeue callback for SOCK_SEQPACKET
[not found] ` <20210218053940.1068164-1-arseny.krasnov@kaspersky.com>
@ 2021-02-23 14:15 ` Stefano Garzarella
2021-02-23 14:17 ` Michael S. Tsirkin
1 sibling, 0 replies; 21+ messages in thread
From: Stefano Garzarella @ 2021-02-23 14:15 UTC (permalink / raw)
To: Arseny Krasnov
Cc: Andra Paraschiv, kvm, Michael S. Tsirkin, netdev, stsp2,
linux-kernel, virtualization, oxffffaa, Norbert Slusarek,
Stefan Hajnoczi, Colin Ian King, Jakub Kicinski, David S. Miller,
Jorgen Hansen
On Thu, Feb 18, 2021 at 08:39:37AM +0300, Arseny Krasnov wrote:
>This adds transport callback and it's logic for SEQPACKET dequeue.
>Callback fetches RW packets from rx queue of socket until whole record
>is copied(if user's buffer is full, user is not woken up). This is done
>to not stall sender, because if we wake up user and it leaves syscall,
>nobody will send credit update for rest of record, and sender will wait
>for next enter of read syscall at receiver's side. So if user buffer is
>full, we just send credit update and drop data. If during copy SEQ_BEGIN
>was found(and not all data was copied), copying is restarted by reset
>user's iov iterator(previous unfinished data is dropped).
>
>Signed-off-by: Arseny Krasnov <arseny.krasnov@kaspersky.com>
>---
> include/linux/virtio_vsock.h | 10 +++
> include/uapi/linux/virtio_vsock.h | 16 ++++
> net/vmw_vsock/virtio_transport_common.c | 114 ++++++++++++++++++++++++
> 3 files changed, 140 insertions(+)
This patch LGTM, maybe we only need to change 'msg_cnt' as we discussed
on virtio-comment, but let's see if there are any other comments.
>
>diff --git a/include/linux/virtio_vsock.h
>b/include/linux/virtio_vsock.h
>index dc636b727179..003d06ae4a85 100644
>--- a/include/linux/virtio_vsock.h
>+++ b/include/linux/virtio_vsock.h
>@@ -36,6 +36,11 @@ struct virtio_vsock_sock {
> u32 rx_bytes;
> u32 buf_alloc;
> struct list_head rx_queue;
>+
>+ /* For SOCK_SEQPACKET */
>+ u32 user_read_seq_len;
>+ u32 user_read_copied;
>+ u32 curr_rx_msg_cnt;
> };
>
> struct virtio_vsock_pkt {
>@@ -80,6 +85,11 @@ virtio_transport_dgram_dequeue(struct vsock_sock *vsk,
> struct msghdr *msg,
> size_t len, int flags);
>
>+int
>+virtio_transport_seqpacket_dequeue(struct vsock_sock *vsk,
>+ struct msghdr *msg,
>+ int flags,
>+ bool *msg_ready);
> s64 virtio_transport_stream_has_data(struct vsock_sock *vsk);
> s64 virtio_transport_stream_has_space(struct vsock_sock *vsk);
>
>diff --git a/include/uapi/linux/virtio_vsock.h b/include/uapi/linux/virtio_vsock.h
>index 1d57ed3d84d2..cf9c165e5cca 100644
>--- a/include/uapi/linux/virtio_vsock.h
>+++ b/include/uapi/linux/virtio_vsock.h
>@@ -63,8 +63,14 @@ struct virtio_vsock_hdr {
> __le32 fwd_cnt;
> } __attribute__((packed));
>
>+struct virtio_vsock_seq_hdr {
>+ __le32 msg_cnt;
>+ __le32 msg_len;
>+} __attribute__((packed));
>+
> enum virtio_vsock_type {
> VIRTIO_VSOCK_TYPE_STREAM = 1,
>+ VIRTIO_VSOCK_TYPE_SEQPACKET = 2,
> };
>
> enum virtio_vsock_op {
>@@ -83,6 +89,11 @@ enum virtio_vsock_op {
> VIRTIO_VSOCK_OP_CREDIT_UPDATE = 6,
> /* Request the peer to send the credit info to us */
> VIRTIO_VSOCK_OP_CREDIT_REQUEST = 7,
>+
>+ /* Record begin for SOCK_SEQPACKET */
>+ VIRTIO_VSOCK_OP_SEQ_BEGIN = 8,
>+ /* Record end for SOCK_SEQPACKET */
>+ VIRTIO_VSOCK_OP_SEQ_END = 9,
> };
>
> /* VIRTIO_VSOCK_OP_SHUTDOWN flags values */
>@@ -91,4 +102,9 @@ enum virtio_vsock_shutdown {
> VIRTIO_VSOCK_SHUTDOWN_SEND = 2,
> };
>
>+/* VIRTIO_VSOCK_OP_RW flags values */
>+enum virtio_vsock_rw {
>+ VIRTIO_VSOCK_RW_EOR = 1,
>+};
>+
> #endif /* _UAPI_LINUX_VIRTIO_VSOCK_H */
>diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
>index 833104b71a1c..d8ec2dfa2315 100644
>--- a/net/vmw_vsock/virtio_transport_common.c
>+++ b/net/vmw_vsock/virtio_transport_common.c
>@@ -393,6 +393,108 @@ virtio_transport_stream_do_dequeue(struct vsock_sock *vsk,
> return err;
> }
>
>+static inline void virtio_transport_remove_pkt(struct virtio_vsock_pkt *pkt)
>+{
>+ list_del(&pkt->list);
>+ virtio_transport_free_pkt(pkt);
>+}
>+
>+static int virtio_transport_seqpacket_do_dequeue(struct vsock_sock *vsk,
>+ struct msghdr *msg,
>+ bool *msg_ready)
>+{
>+ struct virtio_vsock_sock *vvs = vsk->trans;
>+ struct virtio_vsock_pkt *pkt;
>+ int err = 0;
>+ size_t user_buf_len = msg->msg_iter.count;
>+
>+ *msg_ready = false;
>+ spin_lock_bh(&vvs->rx_lock);
>+
>+ while (!*msg_ready && !list_empty(&vvs->rx_queue) && !err) {
>+ pkt = list_first_entry(&vvs->rx_queue, struct virtio_vsock_pkt, list);
>+
>+ switch (le16_to_cpu(pkt->hdr.op)) {
>+ case VIRTIO_VSOCK_OP_SEQ_BEGIN: {
>+ /* Unexpected 'SEQ_BEGIN' during record copy:
>+ * Leave receive loop, 'EAGAIN' will restart it from
>+ * outer receive loop, packet is still in queue and
>+ * counters are cleared. So in next loop enter,
>+ * 'SEQ_BEGIN' will be dequeued first. User's iov
>+ * iterator will be reset in outer loop. Also
>+ * send credit update, because some bytes could be
>+ * copied. User will never see unfinished record.
>+ */
>+ err = -EAGAIN;
>+ break;
>+ }
>+ case VIRTIO_VSOCK_OP_SEQ_END: {
>+ struct virtio_vsock_seq_hdr *seq_hdr;
>+
>+ seq_hdr = (struct virtio_vsock_seq_hdr *)pkt->buf;
>+ /* First check that whole record is received. */
>+
>+ if (vvs->user_read_copied != vvs->user_read_seq_len ||
>+ (le32_to_cpu(seq_hdr->msg_cnt) - vvs->curr_rx_msg_cnt) != 1) {
>+ /* Tail of current record and head of next missed,
>+ * so this EOR is from next record. Restart receive.
>+ * Current record will be dropped, next headless will
>+ * be dropped on next attempt to get record length.
>+ */
>+ err = -EAGAIN;
>+ } else {
>+ /* Success. */
>+ *msg_ready = true;
>+ }
>+
>+ break;
>+ }
>+ case VIRTIO_VSOCK_OP_RW: {
>+ size_t bytes_to_copy;
>+ size_t pkt_len;
>+
>+ pkt_len = (size_t)le32_to_cpu(pkt->hdr.len);
>+ bytes_to_copy = min(user_buf_len, pkt_len);
>+
>+ /* sk_lock is held by caller so no one else can dequeue.
>+ * Unlock rx_lock since memcpy_to_msg() may sleep.
>+ */
>+ spin_unlock_bh(&vvs->rx_lock);
>+
>+ if (memcpy_to_msg(msg, pkt->buf, bytes_to_copy)) {
>+ spin_lock_bh(&vvs->rx_lock);
>+ err = -EINVAL;
>+ break;
>+ }
>+
>+ spin_lock_bh(&vvs->rx_lock);
>+ user_buf_len -= bytes_to_copy;
>+ vvs->user_read_copied += pkt_len;
>+
>+ if (le32_to_cpu(pkt->hdr.flags) & VIRTIO_VSOCK_RW_EOR)
>+ msg->msg_flags |= MSG_EOR;
>+ break;
>+ }
>+ default:
>+ ;
>+ }
>+
>+ /* For unexpected 'SEQ_BEGIN', keep such packet in queue,
>+ * but drop any other type of packet.
>+ */
>+ if (le16_to_cpu(pkt->hdr.op) != VIRTIO_VSOCK_OP_SEQ_BEGIN) {
>+ virtio_transport_dec_rx_pkt(vvs, pkt);
>+ virtio_transport_remove_pkt(pkt);
>+ }
>+ }
>+
>+ spin_unlock_bh(&vvs->rx_lock);
>+
>+ virtio_transport_send_credit_update(vsk);
>+
>+ return err;
>+}
>+
> ssize_t
> virtio_transport_stream_dequeue(struct vsock_sock *vsk,
> struct msghdr *msg,
>@@ -405,6 +507,18 @@ virtio_transport_stream_dequeue(struct vsock_sock *vsk,
> }
> EXPORT_SYMBOL_GPL(virtio_transport_stream_dequeue);
>
>+int
>+virtio_transport_seqpacket_dequeue(struct vsock_sock *vsk,
>+ struct msghdr *msg,
>+ int flags, bool *msg_ready)
>+{
>+ if (flags & MSG_PEEK)
>+ return -EOPNOTSUPP;
>+
>+ return virtio_transport_seqpacket_do_dequeue(vsk, msg, msg_ready);
>+}
>+EXPORT_SYMBOL_GPL(virtio_transport_seqpacket_dequeue);
>+
> int
> virtio_transport_dgram_dequeue(struct vsock_sock *vsk,
> struct msghdr *msg,
>--
>2.25.1
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC PATCH v5 11/19] virtio/vsock: dequeue callback for SOCK_SEQPACKET
[not found] ` <20210218053940.1068164-1-arseny.krasnov@kaspersky.com>
2021-02-23 14:15 ` [RFC PATCH v5 11/19] virtio/vsock: dequeue callback for SOCK_SEQPACKET Stefano Garzarella
@ 2021-02-23 14:17 ` Michael S. Tsirkin
[not found] ` <661fd81f-daf5-a3eb-6946-8f4e83d1ee54@kaspersky.com>
1 sibling, 1 reply; 21+ messages in thread
From: Michael S. Tsirkin @ 2021-02-23 14:17 UTC (permalink / raw)
To: Arseny Krasnov
Cc: Andra Paraschiv, kvm, netdev, stsp2, linux-kernel, virtualization,
oxffffaa, Norbert Slusarek, Stefan Hajnoczi, Colin Ian King,
Jakub Kicinski, David S. Miller, Jorgen Hansen
On Thu, Feb 18, 2021 at 08:39:37AM +0300, Arseny Krasnov wrote:
> This adds transport callback and it's logic for SEQPACKET dequeue.
> Callback fetches RW packets from rx queue of socket until whole record
> is copied(if user's buffer is full, user is not woken up). This is done
> to not stall sender, because if we wake up user and it leaves syscall,
> nobody will send credit update for rest of record, and sender will wait
> for next enter of read syscall at receiver's side. So if user buffer is
> full, we just send credit update and drop data. If during copy SEQ_BEGIN
> was found(and not all data was copied), copying is restarted by reset
> user's iov iterator(previous unfinished data is dropped).
>
> Signed-off-by: Arseny Krasnov <arseny.krasnov@kaspersky.com>
> ---
> include/linux/virtio_vsock.h | 10 +++
> include/uapi/linux/virtio_vsock.h | 16 ++++
> net/vmw_vsock/virtio_transport_common.c | 114 ++++++++++++++++++++++++
> 3 files changed, 140 insertions(+)
>
> diff --git a/include/linux/virtio_vsock.h b/include/linux/virtio_vsock.h
> index dc636b727179..003d06ae4a85 100644
> --- a/include/linux/virtio_vsock.h
> +++ b/include/linux/virtio_vsock.h
> @@ -36,6 +36,11 @@ struct virtio_vsock_sock {
> u32 rx_bytes;
> u32 buf_alloc;
> struct list_head rx_queue;
> +
> + /* For SOCK_SEQPACKET */
> + u32 user_read_seq_len;
> + u32 user_read_copied;
> + u32 curr_rx_msg_cnt;
wrap these in a struct to make it's clearer they
are related?
> };
>
> struct virtio_vsock_pkt {
> @@ -80,6 +85,11 @@ virtio_transport_dgram_dequeue(struct vsock_sock *vsk,
> struct msghdr *msg,
> size_t len, int flags);
>
> +int
> +virtio_transport_seqpacket_dequeue(struct vsock_sock *vsk,
> + struct msghdr *msg,
> + int flags,
> + bool *msg_ready);
> s64 virtio_transport_stream_has_data(struct vsock_sock *vsk);
> s64 virtio_transport_stream_has_space(struct vsock_sock *vsk);
>
> diff --git a/include/uapi/linux/virtio_vsock.h b/include/uapi/linux/virtio_vsock.h
> index 1d57ed3d84d2..cf9c165e5cca 100644
> --- a/include/uapi/linux/virtio_vsock.h
> +++ b/include/uapi/linux/virtio_vsock.h
> @@ -63,8 +63,14 @@ struct virtio_vsock_hdr {
> __le32 fwd_cnt;
> } __attribute__((packed));
>
> +struct virtio_vsock_seq_hdr {
> + __le32 msg_cnt;
> + __le32 msg_len;
> +} __attribute__((packed));
> +
> enum virtio_vsock_type {
> VIRTIO_VSOCK_TYPE_STREAM = 1,
> + VIRTIO_VSOCK_TYPE_SEQPACKET = 2,
> };
>
> enum virtio_vsock_op {
> @@ -83,6 +89,11 @@ enum virtio_vsock_op {
> VIRTIO_VSOCK_OP_CREDIT_UPDATE = 6,
> /* Request the peer to send the credit info to us */
> VIRTIO_VSOCK_OP_CREDIT_REQUEST = 7,
> +
> + /* Record begin for SOCK_SEQPACKET */
> + VIRTIO_VSOCK_OP_SEQ_BEGIN = 8,
> + /* Record end for SOCK_SEQPACKET */
> + VIRTIO_VSOCK_OP_SEQ_END = 9,
> };
>
> /* VIRTIO_VSOCK_OP_SHUTDOWN flags values */
> @@ -91,4 +102,9 @@ enum virtio_vsock_shutdown {
> VIRTIO_VSOCK_SHUTDOWN_SEND = 2,
> };
>
> +/* VIRTIO_VSOCK_OP_RW flags values */
> +enum virtio_vsock_rw {
> + VIRTIO_VSOCK_RW_EOR = 1,
> +};
> +
> #endif /* _UAPI_LINUX_VIRTIO_VSOCK_H */
Probably a good idea to also have a feature bit gating
this functionality.
--
MST
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC PATCH v5 00/19] virtio/vsock: introduce SOCK_SEQPACKET support
2021-02-22 14:23 ` [RFC PATCH v5 00/19] virtio/vsock: introduce SOCK_SEQPACKET support Stefano Garzarella
@ 2021-02-23 14:50 ` Stefano Garzarella
[not found] ` <7a280168-cb54-ae26-4697-c797f6b04708@kaspersky.com>
0 siblings, 1 reply; 21+ messages in thread
From: Stefano Garzarella @ 2021-02-23 14:50 UTC (permalink / raw)
To: Arseny Krasnov
Cc: Andra Paraschiv, kvm, Michael S. Tsirkin, netdev, stsp2,
linux-kernel, virtualization, oxffffaa, Norbert Slusarek,
Stefan Hajnoczi, Colin Ian King, Jakub Kicinski, David S. Miller,
Jorgen Hansen
On Mon, Feb 22, 2021 at 03:23:11PM +0100, Stefano Garzarella wrote:
>Hi Arseny,
>
>On Thu, Feb 18, 2021 at 08:33:44AM +0300, Arseny Krasnov wrote:
>> This patchset impelements support of SOCK_SEQPACKET for virtio
>>transport.
>> As SOCK_SEQPACKET guarantees to save record boundaries, so to
>>do it, two new packet operations were added: first for start of record
>>and second to mark end of record(SEQ_BEGIN and SEQ_END later). Also,
>>both operations carries metadata - to maintain boundaries and payload
>>integrity. Metadata is introduced by adding special header with two
>>fields - message count and message length:
>>
>> struct virtio_vsock_seq_hdr {
>> __le32 msg_cnt;
>> __le32 msg_len;
>> } __attribute__((packed));
>>
>> This header is transmitted as payload of SEQ_BEGIN and SEQ_END
>>packets(buffer of second virtio descriptor in chain) in the same way as
>>data transmitted in RW packets. Payload was chosen as buffer for this
>>header to avoid touching first virtio buffer which carries header of
>>packet, because someone could check that size of this buffer is equal
>>to size of packet header. To send record, packet with start marker is
>>sent first(it's header contains length of record and counter), then
>>counter is incremented and all data is sent as usual 'RW' packets and
>>finally SEQ_END is sent(it also carries counter of message, which is
>>counter of SEQ_BEGIN + 1), also after sedning SEQ_END counter is
>>incremented again. On receiver's side, length of record is known from
>>packet with start record marker. To check that no packets were dropped
>>by transport, counters of two sequential SEQ_BEGIN and SEQ_END are
>>checked(counter of SEQ_END must be bigger that counter of SEQ_BEGIN by
>>1) and length of data between two markers is compared to length in
>>SEQ_BEGIN header.
>> Now as packets of one socket are not reordered neither on
>>vsock nor on vhost transport layers, such markers allows to restore
>>original record on receiver's side. If user's buffer is smaller that
>>record length, when all out of size data is dropped.
>> Maximum length of datagram is not limited as in stream socket,
>>because same credit logic is used. Difference with stream socket is
>>that user is not woken up until whole record is received or error
>>occurred. Implementation also supports 'MSG_EOR' and 'MSG_TRUNC' flags.
>> Tests also implemented.
>
>I reviewed the first part (af_vsock.c changes), tomorrow I'll review
>the rest. That part looks great to me, only found a few minor issues.
I revieiwed the rest of it as well, left a few minor comments, but I
think we're well on track.
I'll take a better look at the specification patch tomorrow.
Thanks,
Stefano
>
>In the meantime, however, I'm getting a doubt, especially with regard
>to other transports besides virtio.
>
>Should we hide the begin/end marker sending in the transport?
>
>I mean, should the transport just provide a seqpacket_enqueue()
>callbacl?
>Inside it then the transport will send the markers. This is because
>some transports might not need to send markers.
>
>But thinking about it more, they could actually implement stubs for
>that calls, if they don't need to send markers.
>
>So I think for now it's fine since it allows us to reuse a lot of
>code, unless someone has some objection.
>
>Thanks,
>Stefano
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC PATCH v5 11/19] virtio/vsock: dequeue callback for SOCK_SEQPACKET
[not found] ` <661fd81f-daf5-a3eb-6946-8f4e83d1ee54@kaspersky.com>
@ 2021-02-24 6:41 ` Michael S. Tsirkin
2021-02-24 8:31 ` Stefano Garzarella
0 siblings, 1 reply; 21+ messages in thread
From: Michael S. Tsirkin @ 2021-02-24 6:41 UTC (permalink / raw)
To: Arseny Krasnov
Cc: Andra Paraschiv, kvm@vger.kernel.org, netdev@vger.kernel.org,
stsp2@yandex.ru, linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org, oxffffaa@gmail.com,
Norbert Slusarek, Stefan Hajnoczi, Colin Ian King, Jakub Kicinski,
David S. Miller, Jorgen Hansen
On Wed, Feb 24, 2021 at 08:07:48AM +0300, Arseny Krasnov wrote:
>
> On 23.02.2021 17:17, Michael S. Tsirkin wrote:
> > On Thu, Feb 18, 2021 at 08:39:37AM +0300, Arseny Krasnov wrote:
> >> This adds transport callback and it's logic for SEQPACKET dequeue.
> >> Callback fetches RW packets from rx queue of socket until whole record
> >> is copied(if user's buffer is full, user is not woken up). This is done
> >> to not stall sender, because if we wake up user and it leaves syscall,
> >> nobody will send credit update for rest of record, and sender will wait
> >> for next enter of read syscall at receiver's side. So if user buffer is
> >> full, we just send credit update and drop data. If during copy SEQ_BEGIN
> >> was found(and not all data was copied), copying is restarted by reset
> >> user's iov iterator(previous unfinished data is dropped).
> >>
> >> Signed-off-by: Arseny Krasnov <arseny.krasnov@kaspersky.com>
> >> ---
> >> include/linux/virtio_vsock.h | 10 +++
> >> include/uapi/linux/virtio_vsock.h | 16 ++++
> >> net/vmw_vsock/virtio_transport_common.c | 114 ++++++++++++++++++++++++
> >> 3 files changed, 140 insertions(+)
> >>
> >> diff --git a/include/linux/virtio_vsock.h b/include/linux/virtio_vsock.h
> >> index dc636b727179..003d06ae4a85 100644
> >> --- a/include/linux/virtio_vsock.h
> >> +++ b/include/linux/virtio_vsock.h
> >> @@ -36,6 +36,11 @@ struct virtio_vsock_sock {
> >> u32 rx_bytes;
> >> u32 buf_alloc;
> >> struct list_head rx_queue;
> >> +
> >> + /* For SOCK_SEQPACKET */
> >> + u32 user_read_seq_len;
> >> + u32 user_read_copied;
> >> + u32 curr_rx_msg_cnt;
> >
> > wrap these in a struct to make it's clearer they
> > are related?
> Ack
> >
> >> };
> >>
> >> struct virtio_vsock_pkt {
> >> @@ -80,6 +85,11 @@ virtio_transport_dgram_dequeue(struct vsock_sock *vsk,
> >> struct msghdr *msg,
> >> size_t len, int flags);
> >>
> >> +int
> >> +virtio_transport_seqpacket_dequeue(struct vsock_sock *vsk,
> >> + struct msghdr *msg,
> >> + int flags,
> >> + bool *msg_ready);
> >> s64 virtio_transport_stream_has_data(struct vsock_sock *vsk);
> >> s64 virtio_transport_stream_has_space(struct vsock_sock *vsk);
> >>
> >> diff --git a/include/uapi/linux/virtio_vsock.h b/include/uapi/linux/virtio_vsock.h
> >> index 1d57ed3d84d2..cf9c165e5cca 100644
> >> --- a/include/uapi/linux/virtio_vsock.h
> >> +++ b/include/uapi/linux/virtio_vsock.h
> >> @@ -63,8 +63,14 @@ struct virtio_vsock_hdr {
> >> __le32 fwd_cnt;
> >> } __attribute__((packed));
> >>
> >> +struct virtio_vsock_seq_hdr {
> >> + __le32 msg_cnt;
> >> + __le32 msg_len;
> >> +} __attribute__((packed));
> >> +
> >> enum virtio_vsock_type {
> >> VIRTIO_VSOCK_TYPE_STREAM = 1,
> >> + VIRTIO_VSOCK_TYPE_SEQPACKET = 2,
> >> };
> >>
> >> enum virtio_vsock_op {
> >> @@ -83,6 +89,11 @@ enum virtio_vsock_op {
> >> VIRTIO_VSOCK_OP_CREDIT_UPDATE = 6,
> >> /* Request the peer to send the credit info to us */
> >> VIRTIO_VSOCK_OP_CREDIT_REQUEST = 7,
> >> +
> >> + /* Record begin for SOCK_SEQPACKET */
> >> + VIRTIO_VSOCK_OP_SEQ_BEGIN = 8,
> >> + /* Record end for SOCK_SEQPACKET */
> >> + VIRTIO_VSOCK_OP_SEQ_END = 9,
> >> };
> >>
> >> /* VIRTIO_VSOCK_OP_SHUTDOWN flags values */
> >> @@ -91,4 +102,9 @@ enum virtio_vsock_shutdown {
> >> VIRTIO_VSOCK_SHUTDOWN_SEND = 2,
> >> };
> >>
> >> +/* VIRTIO_VSOCK_OP_RW flags values */
> >> +enum virtio_vsock_rw {
> >> + VIRTIO_VSOCK_RW_EOR = 1,
> >> +};
> >> +
> >> #endif /* _UAPI_LINUX_VIRTIO_VSOCK_H */
> > Probably a good idea to also have a feature bit gating
> > this functionality.
>
> IIUC this also requires some qemu patch, because in current
>
> implementation of vsock device in qemu, there is no 'set_features'
>
> callback for such device. This callback will handle guest's write
>
> to feature register, by calling vhost kernel backend, where this
>
> bit will be processed by host.
Well patching userspace to make use of a kernel feature
is par for the course, isn't it?
>
> IMHO I'm not sure that SEQPACKET support needs feature
>
> bit - it is just two new ops for virtio vsock protocol, and from point
>
> of view of virtio device it is same as STREAM. May be it is needed
>
> for cases when client tries to connect to server which doesn't support
>
> SEQPACKET, so without bit result will be "Connection reset by peer",
>
> and with such bit client will know that server doesn't support it and
>
> 'socket(SOCK_SEQPACKET)' will return error?
Yes, a better error handling would be one reason to do it like this.
--
MST
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC PATCH v5 00/19] virtio/vsock: introduce SOCK_SEQPACKET support
[not found] ` <7a280168-cb54-ae26-4697-c797f6b04708@kaspersky.com>
@ 2021-02-24 8:23 ` Stefano Garzarella
[not found] ` <710d9dc2-3a0c-ea0b-fb02-68b460e6282e@kaspersky.com>
0 siblings, 1 reply; 21+ messages in thread
From: Stefano Garzarella @ 2021-02-24 8:23 UTC (permalink / raw)
To: Arseny Krasnov
Cc: Andra Paraschiv, kvm@vger.kernel.org, Michael S. Tsirkin,
netdev@vger.kernel.org, stsp2@yandex.ru,
linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org, oxffffaa@gmail.com,
Norbert Slusarek, Stefan Hajnoczi, Colin Ian King, Jakub Kicinski,
David S. Miller, Jorgen Hansen
On Wed, Feb 24, 2021 at 07:29:25AM +0300, Arseny Krasnov wrote:
>
>On 23.02.2021 17:50, Stefano Garzarella wrote:
>> On Mon, Feb 22, 2021 at 03:23:11PM +0100, Stefano Garzarella wrote:
>>> Hi Arseny,
>>>
>>> On Thu, Feb 18, 2021 at 08:33:44AM +0300, Arseny Krasnov wrote:
>>>> This patchset impelements support of SOCK_SEQPACKET for virtio
>>>> transport.
>>>> As SOCK_SEQPACKET guarantees to save record boundaries, so to
>>>> do it, two new packet operations were added: first for start of record
>>>> and second to mark end of record(SEQ_BEGIN and SEQ_END later). Also,
>>>> both operations carries metadata - to maintain boundaries and payload
>>>> integrity. Metadata is introduced by adding special header with two
>>>> fields - message count and message length:
>>>>
>>>> struct virtio_vsock_seq_hdr {
>>>> __le32 msg_cnt;
>>>> __le32 msg_len;
>>>> } __attribute__((packed));
>>>>
>>>> This header is transmitted as payload of SEQ_BEGIN and SEQ_END
>>>> packets(buffer of second virtio descriptor in chain) in the same way as
>>>> data transmitted in RW packets. Payload was chosen as buffer for this
>>>> header to avoid touching first virtio buffer which carries header of
>>>> packet, because someone could check that size of this buffer is equal
>>>> to size of packet header. To send record, packet with start marker is
>>>> sent first(it's header contains length of record and counter), then
>>>> counter is incremented and all data is sent as usual 'RW' packets and
>>>> finally SEQ_END is sent(it also carries counter of message, which is
>>>> counter of SEQ_BEGIN + 1), also after sedning SEQ_END counter is
>>>> incremented again. On receiver's side, length of record is known from
>>>> packet with start record marker. To check that no packets were dropped
>>>> by transport, counters of two sequential SEQ_BEGIN and SEQ_END are
>>>> checked(counter of SEQ_END must be bigger that counter of SEQ_BEGIN by
>>>> 1) and length of data between two markers is compared to length in
>>>> SEQ_BEGIN header.
>>>> Now as packets of one socket are not reordered neither on
>>>> vsock nor on vhost transport layers, such markers allows to restore
>>>> original record on receiver's side. If user's buffer is smaller that
>>>> record length, when all out of size data is dropped.
>>>> Maximum length of datagram is not limited as in stream socket,
>>>> because same credit logic is used. Difference with stream socket is
>>>> that user is not woken up until whole record is received or error
>>>> occurred. Implementation also supports 'MSG_EOR' and 'MSG_TRUNC' flags.
>>>> Tests also implemented.
>>> I reviewed the first part (af_vsock.c changes), tomorrow I'll review
>>> the rest. That part looks great to me, only found a few minor issues.
>> I revieiwed the rest of it as well, left a few minor comments, but I
>> think we're well on track.
>>
>> I'll take a better look at the specification patch tomorrow.
>Great, Thank You
>>
>> Thanks,
>> Stefano
>>
>>> In the meantime, however, I'm getting a doubt, especially with regard
>>> to other transports besides virtio.
>>>
>>> Should we hide the begin/end marker sending in the transport?
>>>
>>> I mean, should the transport just provide a seqpacket_enqueue()
>>> callbacl?
>>> Inside it then the transport will send the markers. This is because
>>> some transports might not need to send markers.
>>>
>>> But thinking about it more, they could actually implement stubs for
>>> that calls, if they don't need to send markers.
>>>
>>> So I think for now it's fine since it allows us to reuse a lot of
>>> code, unless someone has some objection.
>
>I thought about that, I'll try to implement it in next version. Let's see...
If you want to discuss it first, write down the idea you want to
implement, I wouldn't want to make you do unnecessary work. :-)
Cheers,
Stefano
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC PATCH v5 11/19] virtio/vsock: dequeue callback for SOCK_SEQPACKET
2021-02-24 6:41 ` Michael S. Tsirkin
@ 2021-02-24 8:31 ` Stefano Garzarella
0 siblings, 0 replies; 21+ messages in thread
From: Stefano Garzarella @ 2021-02-24 8:31 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: Andra Paraschiv, kvm@vger.kernel.org, netdev@vger.kernel.org,
stsp2@yandex.ru, linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org, oxffffaa@gmail.com,
Norbert Slusarek, Stefan Hajnoczi, Colin Ian King, Jakub Kicinski,
Arseny Krasnov, David S. Miller, Jorgen Hansen
On Wed, Feb 24, 2021 at 01:41:56AM -0500, Michael S. Tsirkin wrote:
>On Wed, Feb 24, 2021 at 08:07:48AM +0300, Arseny Krasnov wrote:
>>
>> On 23.02.2021 17:17, Michael S. Tsirkin wrote:
>> > On Thu, Feb 18, 2021 at 08:39:37AM +0300, Arseny Krasnov wrote:
>> >> This adds transport callback and it's logic for SEQPACKET dequeue.
>> >> Callback fetches RW packets from rx queue of socket until whole record
>> >> is copied(if user's buffer is full, user is not woken up). This is done
>> >> to not stall sender, because if we wake up user and it leaves syscall,
>> >> nobody will send credit update for rest of record, and sender will wait
>> >> for next enter of read syscall at receiver's side. So if user buffer is
>> >> full, we just send credit update and drop data. If during copy SEQ_BEGIN
>> >> was found(and not all data was copied), copying is restarted by reset
>> >> user's iov iterator(previous unfinished data is dropped).
>> >>
>> >> Signed-off-by: Arseny Krasnov <arseny.krasnov@kaspersky.com>
>> >> ---
>> >> include/linux/virtio_vsock.h | 10 +++
>> >> include/uapi/linux/virtio_vsock.h | 16 ++++
>> >> net/vmw_vsock/virtio_transport_common.c | 114 ++++++++++++++++++++++++
>> >> 3 files changed, 140 insertions(+)
>> >>
>> >> diff --git a/include/linux/virtio_vsock.h b/include/linux/virtio_vsock.h
>> >> index dc636b727179..003d06ae4a85 100644
>> >> --- a/include/linux/virtio_vsock.h
>> >> +++ b/include/linux/virtio_vsock.h
>> >> @@ -36,6 +36,11 @@ struct virtio_vsock_sock {
>> >> u32 rx_bytes;
>> >> u32 buf_alloc;
>> >> struct list_head rx_queue;
>> >> +
>> >> + /* For SOCK_SEQPACKET */
>> >> + u32 user_read_seq_len;
>> >> + u32 user_read_copied;
>> >> + u32 curr_rx_msg_cnt;
>> >
>> > wrap these in a struct to make it's clearer they
>> > are related?
>> Ack
>> >
>> >> };
>> >>
>> >> struct virtio_vsock_pkt {
>> >> @@ -80,6 +85,11 @@ virtio_transport_dgram_dequeue(struct vsock_sock *vsk,
>> >> struct msghdr *msg,
>> >> size_t len, int flags);
>> >>
>> >> +int
>> >> +virtio_transport_seqpacket_dequeue(struct vsock_sock *vsk,
>> >> + struct msghdr *msg,
>> >> + int flags,
>> >> + bool *msg_ready);
>> >> s64 virtio_transport_stream_has_data(struct vsock_sock *vsk);
>> >> s64 virtio_transport_stream_has_space(struct vsock_sock *vsk);
>> >>
>> >> diff --git a/include/uapi/linux/virtio_vsock.h b/include/uapi/linux/virtio_vsock.h
>> >> index 1d57ed3d84d2..cf9c165e5cca 100644
>> >> --- a/include/uapi/linux/virtio_vsock.h
>> >> +++ b/include/uapi/linux/virtio_vsock.h
>> >> @@ -63,8 +63,14 @@ struct virtio_vsock_hdr {
>> >> __le32 fwd_cnt;
>> >> } __attribute__((packed));
>> >>
>> >> +struct virtio_vsock_seq_hdr {
>> >> + __le32 msg_cnt;
>> >> + __le32 msg_len;
>> >> +} __attribute__((packed));
>> >> +
>> >> enum virtio_vsock_type {
>> >> VIRTIO_VSOCK_TYPE_STREAM = 1,
>> >> + VIRTIO_VSOCK_TYPE_SEQPACKET = 2,
>> >> };
>> >>
>> >> enum virtio_vsock_op {
>> >> @@ -83,6 +89,11 @@ enum virtio_vsock_op {
>> >> VIRTIO_VSOCK_OP_CREDIT_UPDATE = 6,
>> >> /* Request the peer to send the credit info to us */
>> >> VIRTIO_VSOCK_OP_CREDIT_REQUEST = 7,
>> >> +
>> >> + /* Record begin for SOCK_SEQPACKET */
>> >> + VIRTIO_VSOCK_OP_SEQ_BEGIN = 8,
>> >> + /* Record end for SOCK_SEQPACKET */
>> >> + VIRTIO_VSOCK_OP_SEQ_END = 9,
>> >> };
>> >>
>> >> /* VIRTIO_VSOCK_OP_SHUTDOWN flags values */
>> >> @@ -91,4 +102,9 @@ enum virtio_vsock_shutdown {
>> >> VIRTIO_VSOCK_SHUTDOWN_SEND = 2,
>> >> };
>> >>
>> >> +/* VIRTIO_VSOCK_OP_RW flags values */
>> >> +enum virtio_vsock_rw {
>> >> + VIRTIO_VSOCK_RW_EOR = 1,
>> >> +};
>> >> +
>> >> #endif /* _UAPI_LINUX_VIRTIO_VSOCK_H */
>> > Probably a good idea to also have a feature bit gating
>> > this functionality.
>>
>> IIUC this also requires some qemu patch, because in current
>>
>> implementation of vsock device in qemu, there is no 'set_features'
>>
>> callback for such device. This callback will handle guest's write
>>
>> to feature register, by calling vhost kernel backend, where this
>>
>> bit will be processed by host.
>
>Well patching userspace to make use of a kernel feature
>is par for the course, isn't it?
>
>>
>> IMHO I'm not sure that SEQPACKET support needs feature
>>
>> bit - it is just two new ops for virtio vsock protocol, and from point
>>
>> of view of virtio device it is same as STREAM. May be it is needed
>>
>> for cases when client tries to connect to server which doesn't support
>>
>> SEQPACKET, so without bit result will be "Connection reset by peer",
>>
>> and with such bit client will know that server doesn't support it and
>>
>> 'socket(SOCK_SEQPACKET)' will return error?
>
>Yes, a better error handling would be one reason to do it like this.
Agree, in this way we could implement a 'seqpacket_allow' callback
(similar to 'stream_allow'), and we can return 'true' if the feature is
negotiated.
So instead of checking all the seqpacket callbacks, we can use only this
callback to understand if the transport support it.
We can implement it also for other transports (vmci, hyperv) and return
always false for now.
Thanks,
Stefano
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC PATCH v5 00/19] virtio/vsock: introduce SOCK_SEQPACKET support
[not found] ` <710d9dc2-3a0c-ea0b-fb02-68b460e6282e@kaspersky.com>
@ 2021-02-24 8:35 ` Stefano Garzarella
0 siblings, 0 replies; 21+ messages in thread
From: Stefano Garzarella @ 2021-02-24 8:35 UTC (permalink / raw)
To: Arseny Krasnov
Cc: Andra Paraschiv, kvm@vger.kernel.org, Michael S. Tsirkin,
netdev@vger.kernel.org, stsp2@yandex.ru,
linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org, oxffffaa@gmail.com,
Norbert Slusarek, Stefan Hajnoczi, Colin Ian King, Jakub Kicinski,
David S. Miller, Jorgen Hansen
On Wed, Feb 24, 2021 at 11:28:50AM +0300, Arseny Krasnov wrote:
>
>On 24.02.2021 11:23, Stefano Garzarella wrote:
>> On Wed, Feb 24, 2021 at 07:29:25AM +0300, Arseny Krasnov wrote:
>>> On 23.02.2021 17:50, Stefano Garzarella wrote:
>>>> On Mon, Feb 22, 2021 at 03:23:11PM +0100, Stefano Garzarella wrote:
>>>>> Hi Arseny,
>>>>>
>>>>> On Thu, Feb 18, 2021 at 08:33:44AM +0300, Arseny Krasnov wrote:
>>>>>> This patchset impelements support of SOCK_SEQPACKET for virtio
>>>>>> transport.
>>>>>> As SOCK_SEQPACKET guarantees to save record boundaries, so to
>>>>>> do it, two new packet operations were added: first for start of record
>>>>>> and second to mark end of record(SEQ_BEGIN and SEQ_END later). Also,
>>>>>> both operations carries metadata - to maintain boundaries and payload
>>>>>> integrity. Metadata is introduced by adding special header with two
>>>>>> fields - message count and message length:
>>>>>>
>>>>>> struct virtio_vsock_seq_hdr {
>>>>>> __le32 msg_cnt;
>>>>>> __le32 msg_len;
>>>>>> } __attribute__((packed));
>>>>>>
>>>>>> This header is transmitted as payload of SEQ_BEGIN and SEQ_END
>>>>>> packets(buffer of second virtio descriptor in chain) in the same way as
>>>>>> data transmitted in RW packets. Payload was chosen as buffer for this
>>>>>> header to avoid touching first virtio buffer which carries header of
>>>>>> packet, because someone could check that size of this buffer is equal
>>>>>> to size of packet header. To send record, packet with start marker is
>>>>>> sent first(it's header contains length of record and counter), then
>>>>>> counter is incremented and all data is sent as usual 'RW' packets and
>>>>>> finally SEQ_END is sent(it also carries counter of message, which is
>>>>>> counter of SEQ_BEGIN + 1), also after sedning SEQ_END counter is
>>>>>> incremented again. On receiver's side, length of record is known from
>>>>>> packet with start record marker. To check that no packets were dropped
>>>>>> by transport, counters of two sequential SEQ_BEGIN and SEQ_END are
>>>>>> checked(counter of SEQ_END must be bigger that counter of SEQ_BEGIN by
>>>>>> 1) and length of data between two markers is compared to length in
>>>>>> SEQ_BEGIN header.
>>>>>> Now as packets of one socket are not reordered neither on
>>>>>> vsock nor on vhost transport layers, such markers allows to restore
>>>>>> original record on receiver's side. If user's buffer is smaller that
>>>>>> record length, when all out of size data is dropped.
>>>>>> Maximum length of datagram is not limited as in stream socket,
>>>>>> because same credit logic is used. Difference with stream socket is
>>>>>> that user is not woken up until whole record is received or error
>>>>>> occurred. Implementation also supports 'MSG_EOR' and 'MSG_TRUNC' flags.
>>>>>> Tests also implemented.
>>>>> I reviewed the first part (af_vsock.c changes), tomorrow I'll review
>>>>> the rest. That part looks great to me, only found a few minor issues.
>>>> I revieiwed the rest of it as well, left a few minor comments, but I
>>>> think we're well on track.
>>>>
>>>> I'll take a better look at the specification patch tomorrow.
>>> Great, Thank You
>>>> Thanks,
>>>> Stefano
>>>>
>>>>> In the meantime, however, I'm getting a doubt, especially with regard
>>>>> to other transports besides virtio.
>>>>>
>>>>> Should we hide the begin/end marker sending in the transport?
>>>>>
>>>>> I mean, should the transport just provide a seqpacket_enqueue()
>>>>> callbacl?
>>>>> Inside it then the transport will send the markers. This is because
>>>>> some transports might not need to send markers.
>>>>>
>>>>> But thinking about it more, they could actually implement stubs for
>>>>> that calls, if they don't need to send markers.
>>>>>
>>>>> So I think for now it's fine since it allows us to reuse a lot of
>>>>> code, unless someone has some objection.
>>> I thought about that, I'll try to implement it in next version. Let's see...
>> If you want to discuss it first, write down the idea you want to
>> implement, I wouldn't want to make you do unnecessary work. :-)
>
>Idea is simple, in iov iterator of 'struct msghdr' which is passed to
>
>enqueue callback we have two fields: 'iov_offset' which is byte
>
>offset inside io vector where next data must be picked and 'count'
>
>which is rest of unprocessed bytes in io vector. So in seqpacket
>
>enqueue callback if 'iov_offset' is 0 i'll send SEQBEGIN, and if
>
>'count' is 0 i'll send SEQEND.
>
Got it, make sense and it's defently more transparent for the vsock
core!
Go head, maybe adding a comment in the vsock core explaining this, so
other developers can understand better if they want to support SEPACKET
in other transports.
Thanks,
Stefano
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC PATCH v5 02/19] af_vsock: separate wait data loop
[not found] ` <20210218053637.1066959-1-arseny.krasnov@kaspersky.com>
2021-02-22 11:29 ` [RFC PATCH v5 02/19] af_vsock: separate wait data loop Stefano Garzarella
@ 2021-02-25 14:24 ` Jorgen Hansen
1 sibling, 0 replies; 21+ messages in thread
From: Jorgen Hansen @ 2021-02-25 14:24 UTC (permalink / raw)
To: Arseny Krasnov
Cc: Andra Paraschiv, kvm@vger.kernel.org, Michael S. Tsirkin,
netdev@vger.kernel.org, stsp2@yandex.ru,
linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org, oxffffaa@gmail.com,
Norbert Slusarek, Stefan Hajnoczi, Colin Ian King, Jakub Kicinski,
David S. Miller
> On 18 Feb 2021, at 06:36, Arseny Krasnov <arseny.krasnov@kaspersky.com> wrote:
>
> This moves wait loop for data to dedicated function, because later
> it will be used by SEQPACKET data receive loop.
>
> Signed-off-by: Arseny Krasnov <arseny.krasnov@kaspersky.com>
> ---
> net/vmw_vsock/af_vsock.c | 155 +++++++++++++++++++++------------------
> 1 file changed, 83 insertions(+), 72 deletions(-)
>
> diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
> index 656370e11707..6cf7bb977aa1 100644
> --- a/net/vmw_vsock/af_vsock.c
> +++ b/net/vmw_vsock/af_vsock.c
> @@ -1832,6 +1832,68 @@ static int vsock_connectible_sendmsg(struct socket *sock, struct msghdr *msg,
> return err;
> }
>
> +static int vsock_wait_data(struct sock *sk, struct wait_queue_entry *wait,
> + long timeout,
> + struct vsock_transport_recv_notify_data *recv_data,
> + size_t target)
> +{
> + const struct vsock_transport *transport;
> + struct vsock_sock *vsk;
> + s64 data;
> + int err;
> +
> + vsk = vsock_sk(sk);
> + err = 0;
> + transport = vsk->transport;
> + prepare_to_wait(sk_sleep(sk), wait, TASK_INTERRUPTIBLE);
> +
> + while ((data = vsock_stream_has_data(vsk)) == 0) {
In the original code, the prepare_to_wait() is called for each iteration of the while loop. In this
version, it is only called once. So if we do multiple iterations, the thread would be in the
TASK_RUNNING state, and subsequent schedule_timeout() will return immediately. So
looks like the prepare_to_wait() should be move here, in case we have a spurious wake_up.
> + if (sk->sk_err != 0 ||
> + (sk->sk_shutdown & RCV_SHUTDOWN) ||
> + (vsk->peer_shutdown & SEND_SHUTDOWN)) {
> + break;
> + }
> +
> + /* Don't wait for non-blocking sockets. */
> + if (timeout == 0) {
> + err = -EAGAIN;
> + break;
> + }
> +
> + if (recv_data) {
> + err = transport->notify_recv_pre_block(vsk, target, recv_data);
> + if (err < 0)
> + break;
> + }
> +
> + release_sock(sk);
> + timeout = schedule_timeout(timeout);
> + lock_sock(sk);
> +
> + if (signal_pending(current)) {
> + err = sock_intr_errno(timeout);
> + break;
> + } else if (timeout == 0) {
> + err = -EAGAIN;
> + break;
> + }
> + }
> +
> + finish_wait(sk_sleep(sk), wait);
> +
> + if (err)
> + return err;
> +
> + /* Internal transport error when checking for available
> + * data. XXX This should be changed to a connection
> + * reset in a later change.
> + */
> + if (data < 0)
> + return -ENOMEM;
> +
> + return data;
> +}
> +
> static int
> vsock_connectible_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
> int flags)
> @@ -1911,85 +1973,34 @@ vsock_connectible_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
>
>
> while (1) {
> - s64 ready;
> -
> - prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
> - ready = vsock_stream_has_data(vsk);
> -
> - if (ready == 0) {
> - if (sk->sk_err != 0 ||
> - (sk->sk_shutdown & RCV_SHUTDOWN) ||
> - (vsk->peer_shutdown & SEND_SHUTDOWN)) {
> - finish_wait(sk_sleep(sk), &wait);
> - break;
> - }
> - /* Don't wait for non-blocking sockets. */
> - if (timeout == 0) {
> - err = -EAGAIN;
> - finish_wait(sk_sleep(sk), &wait);
> - break;
> - }
> + ssize_t read;
>
> - err = transport->notify_recv_pre_block(
> - vsk, target, &recv_data);
> - if (err < 0) {
> - finish_wait(sk_sleep(sk), &wait);
> - break;
> - }
> - release_sock(sk);
> - timeout = schedule_timeout(timeout);
> - lock_sock(sk);
> + err = vsock_wait_data(sk, &wait, timeout, &recv_data, target);
> + if (err <= 0)
> + break;
>
> - if (signal_pending(current)) {
> - err = sock_intr_errno(timeout);
> - finish_wait(sk_sleep(sk), &wait);
> - break;
> - } else if (timeout == 0) {
> - err = -EAGAIN;
> - finish_wait(sk_sleep(sk), &wait);
> - break;
> - }
> - } else {
> - ssize_t read;
> -
> - finish_wait(sk_sleep(sk), &wait);
> -
> - if (ready < 0) {
> - /* Invalid queue pair content. XXX This should
> - * be changed to a connection reset in a later
> - * change.
> - */
> -
> - err = -ENOMEM;
> - goto out;
> - }
> -
> - err = transport->notify_recv_pre_dequeue(
> - vsk, target, &recv_data);
> - if (err < 0)
> - break;
> + err = transport->notify_recv_pre_dequeue(vsk, target,
> + &recv_data);
> + if (err < 0)
> + break;
>
> - read = transport->stream_dequeue(
> - vsk, msg,
> - len - copied, flags);
> - if (read < 0) {
> - err = -ENOMEM;
> - break;
> - }
> + read = transport->stream_dequeue(vsk, msg, len - copied, flags);
> + if (read < 0) {
> + err = -ENOMEM;
> + break;
> + }
>
> - copied += read;
> + copied += read;
>
> - err = transport->notify_recv_post_dequeue(
> - vsk, target, read,
> - !(flags & MSG_PEEK), &recv_data);
> - if (err < 0)
> - goto out;
> + err = transport->notify_recv_post_dequeue(vsk, target, read,
> + !(flags & MSG_PEEK), &recv_data);
> + if (err < 0)
> + goto out;
>
> - if (read >= target || flags & MSG_PEEK)
> - break;
> + if (read >= target || flags & MSG_PEEK)
> + break;
>
> - target -= read;
> - }
> + target -= read;
> }
>
> if (sk->sk_err)
> --
> 2.25.1
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC PATCH v5 04/19] af_vsock: implement SEQPACKET receive loop
[not found] ` <20210218053719.1067237-1-arseny.krasnov@kaspersky.com>
2021-02-22 11:53 ` [RFC PATCH v5 04/19] af_vsock: implement SEQPACKET receive loop Stefano Garzarella
@ 2021-02-25 16:27 ` Jorgen Hansen
1 sibling, 0 replies; 21+ messages in thread
From: Jorgen Hansen @ 2021-02-25 16:27 UTC (permalink / raw)
To: Arseny Krasnov
Cc: Andra Paraschiv, kvm@vger.kernel.org, Michael S. Tsirkin,
netdev@vger.kernel.org, stsp2@yandex.ru,
linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org, oxffffaa@gmail.com,
Norbert Slusarek, Stefan Hajnoczi, Colin Ian King, Jakub Kicinski,
David S. Miller
On 18 Feb 2021, at 06:37, Arseny Krasnov <arseny.krasnov@kaspersky.com> wrote:
>
> This adds receive loop for SEQPACKET. It looks like receive loop for
> STREAM, but there is a little bit difference:
> 1) It doesn't call notify callbacks.
> 2) It doesn't care about 'SO_SNDLOWAT' and 'SO_RCVLOWAT' values, because
> there is no sense for these values in SEQPACKET case.
> 3) It waits until whole record is received or error is found during
> receiving.
> 4) It processes and sets 'MSG_TRUNC' flag.
>
> So to avoid extra conditions for two types of socket inside one loop, two
> independent functions were created.
>
> Signed-off-by: Arseny Krasnov <arseny.krasnov@kaspersky.com>
> ---
> include/net/af_vsock.h | 5 +++
> net/vmw_vsock/af_vsock.c | 97 +++++++++++++++++++++++++++++++++++++++-
> 2 files changed, 101 insertions(+), 1 deletion(-)
>
> diff --git a/include/net/af_vsock.h b/include/net/af_vsock.h
> index b1c717286993..01563338cc03 100644
> --- a/include/net/af_vsock.h
> +++ b/include/net/af_vsock.h
> @@ -135,6 +135,11 @@ struct vsock_transport {
> bool (*stream_is_active)(struct vsock_sock *);
> bool (*stream_allow)(u32 cid, u32 port);
>
> + /* SEQ_PACKET. */
> + size_t (*seqpacket_seq_get_len)(struct vsock_sock *vsk);
> + int (*seqpacket_dequeue)(struct vsock_sock *vsk, struct msghdr *msg,
> + int flags, bool *msg_ready);
> +
> /* Notification. */
> int (*notify_poll_in)(struct vsock_sock *, size_t, bool *);
> int (*notify_poll_out)(struct vsock_sock *, size_t, bool *);
> diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
> index d277dc1cdbdf..b754927a556a 100644
> --- a/net/vmw_vsock/af_vsock.c
> +++ b/net/vmw_vsock/af_vsock.c
> @@ -1972,6 +1972,98 @@ static int __vsock_stream_recvmsg(struct sock *sk, struct msghdr *msg,
> return err;
> }
>
> +static int __vsock_seqpacket_recvmsg(struct sock *sk, struct msghdr *msg,
> + size_t len, int flags)
> +{
> + const struct vsock_transport *transport;
> + const struct iovec *orig_iov;
> + unsigned long orig_nr_segs;
> + bool msg_ready;
> + struct vsock_sock *vsk;
> + size_t record_len;
> + long timeout;
> + int err = 0;
> + DEFINE_WAIT(wait);
> +
> + vsk = vsock_sk(sk);
> + transport = vsk->transport;
> +
> + timeout = sock_rcvtimeo(sk, flags & MSG_DONTWAIT);
> + orig_nr_segs = msg->msg_iter.nr_segs;
> + orig_iov = msg->msg_iter.iov;
> + msg_ready = false;
> + record_len = 0;
> +
> + while (1) {
> + err = vsock_wait_data(sk, &wait, timeout, NULL, 0);
> +
> + if (err <= 0) {
> + /* In case of any loop break(timeout, signal
> + * interrupt or shutdown), we report user that
> + * nothing was copied.
> + */
> + err = 0;
> + break;
> + }
> +
> + if (record_len == 0) {
> + record_len =
> + transport->seqpacket_seq_get_len(vsk);
> +
> + if (record_len == 0)
> + continue;
> + }
> +
> + err = transport->seqpacket_dequeue(vsk, msg,
> + flags, &msg_ready);
> +
> + if (err < 0) {
> + if (err == -EAGAIN) {
> + iov_iter_init(&msg->msg_iter, READ,
> + orig_iov, orig_nr_segs,
> + len);
> + /* Clear 'MSG_EOR' here, because dequeue
> + * callback above set it again if it was
> + * set by sender. This 'MSG_EOR' is from
> + * dropped record.
> + */
> + msg->msg_flags &= ~MSG_EOR;
> + record_len = 0;
> + continue;
> + }
So a question for my understanding of the flow here. SOCK_SEQPACKET is reliable, so
what does it mean to drop the record? Is the transport supposed to roll back to the
beginning of the current record? If the incoming data in the transport doesn’t follow
the protocol, and packets need to be dropped, shouldn’t the socket be reset or similar?
Maybe there is potential for simplifying the flow if that is the case.
> +
> + err = -ENOMEM;
> + break;
> + }
> +
> + if (msg_ready)
> + break;
> + }
> +
> + if (sk->sk_err)
> + err = -sk->sk_err;
> + else if (sk->sk_shutdown & RCV_SHUTDOWN)
> + err = 0;
> +
> + if (msg_ready) {
> + /* User sets MSG_TRUNC, so return real length of
> + * packet.
> + */
> + if (flags & MSG_TRUNC)
> + err = record_len;
> + else
> + err = len - msg->msg_iter.count;
> +
> + /* Always set MSG_TRUNC if real length of packet is
> + * bigger than user's buffer.
> + */
> + if (record_len > len)
> + msg->msg_flags |= MSG_TRUNC;
> + }
> +
> + return err;
> +}
> +
> static int
> vsock_connectible_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
> int flags)
> @@ -2027,7 +2119,10 @@ vsock_connectible_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
> goto out;
> }
>
> - err = __vsock_stream_recvmsg(sk, msg, len, flags);
> + if (sk->sk_type == SOCK_STREAM)
> + err = __vsock_stream_recvmsg(sk, msg, len, flags);
> + else
> + err = __vsock_seqpacket_recvmsg(sk, msg, len, flags);
>
> out:
> release_sock(sk);
> --
> 2.25.1
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC PATCH v5 19/19] virtio/vsock: update trace event for SEQPACKET
[not found] ` <20210218054219.1069224-1-arseny.krasnov@kaspersky.com>
@ 2021-03-02 22:25 ` Steven Rostedt
0 siblings, 0 replies; 21+ messages in thread
From: Steven Rostedt @ 2021-03-02 22:25 UTC (permalink / raw)
To: Arseny Krasnov
Cc: Andra Paraschiv, kvm, Michael S. Tsirkin, netdev, stsp2,
linux-kernel, virtualization, oxffffaa, Ingo Molnar,
Norbert Slusarek, Stefan Hajnoczi, Colin Ian King, Jakub Kicinski,
David S. Miller, Jorgen Hansen
On Thu, 18 Feb 2021 08:42:15 +0300
Arseny Krasnov <arseny.krasnov@kaspersky.com> wrote:
Not sure if this was pulled in yet, but I do have a small issue with this
patch.
> @@ -69,14 +82,19 @@ TRACE_EVENT(virtio_transport_alloc_pkt,
> __entry->type = type;
> __entry->op = op;
> __entry->flags = flags;
> + __entry->msg_len = msg_len;
> + __entry->msg_cnt = msg_cnt;
> ),
> - TP_printk("%u:%u -> %u:%u len=%u type=%s op=%s flags=%#x",
> + TP_printk("%u:%u -> %u:%u len=%u type=%s op=%s flags=%#x "
> + "msg_len=%u msg_cnt=%u",
It's considered poor formatting to split strings like the above. This is
one of the exceptions for the 80 character limit. Do not break strings just
to keep it within 80 characters.
-- Steve
> __entry->src_cid, __entry->src_port,
> __entry->dst_cid, __entry->dst_port,
> __entry->len,
> show_type(__entry->type),
> show_op(__entry->op),
> - __entry->flags)
> + __entry->flags,
> + __entry->msg_len,
> + __entry->msg_cnt)
> );
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2021-03-02 22:25 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20210218053347.1066159-1-arseny.krasnov@kaspersky.com>
[not found] ` <20210218053607.1066783-1-arseny.krasnov@kaspersky.com>
2021-02-22 10:50 ` [RFC PATCH v5 01/19] af_vsock: update functions for connectible socket Stefano Garzarella
[not found] ` <279059b2-4c08-16d4-3bca-03640c7932d9@kaspersky.com>
2021-02-22 11:09 ` Stefano Garzarella
[not found] ` <20210218053637.1066959-1-arseny.krasnov@kaspersky.com>
2021-02-22 11:29 ` [RFC PATCH v5 02/19] af_vsock: separate wait data loop Stefano Garzarella
2021-02-25 14:24 ` Jorgen Hansen
[not found] ` <20210218053653.1067086-1-arseny.krasnov@kaspersky.com>
2021-02-22 11:43 ` [RFC PATCH v5 03/19] af_vsock: separate receive " Stefano Garzarella
[not found] ` <20210218053719.1067237-1-arseny.krasnov@kaspersky.com>
2021-02-22 11:53 ` [RFC PATCH v5 04/19] af_vsock: implement SEQPACKET receive loop Stefano Garzarella
2021-02-25 16:27 ` Jorgen Hansen
[not found] ` <20210218053758.1067436-1-arseny.krasnov@kaspersky.com>
2021-02-22 12:06 ` [RFC PATCH v5 05/19] af_vsock: separate wait space loop Stefano Garzarella
[not found] ` <20210218053831.1067678-1-arseny.krasnov@kaspersky.com>
2021-02-22 14:12 ` [RFC PATCH v5 07/19] af_vsock: rest of SEQPACKET support Stefano Garzarella
[not found] ` <20210218053852.1067811-1-arseny.krasnov@kaspersky.com>
2021-02-22 14:18 ` [RFC PATCH v5 08/19] af_vsock: update comments for stream sockets Stefano Garzarella
2021-02-22 14:23 ` [RFC PATCH v5 00/19] virtio/vsock: introduce SOCK_SEQPACKET support Stefano Garzarella
2021-02-23 14:50 ` Stefano Garzarella
[not found] ` <7a280168-cb54-ae26-4697-c797f6b04708@kaspersky.com>
2021-02-24 8:23 ` Stefano Garzarella
[not found] ` <710d9dc2-3a0c-ea0b-fb02-68b460e6282e@kaspersky.com>
2021-02-24 8:35 ` Stefano Garzarella
[not found] ` <20210218053906.1067920-1-arseny.krasnov@kaspersky.com>
2021-02-23 13:42 ` [RFC PATCH v5 09/19] virtio/vsock: set packet's type in send Stefano Garzarella
[not found] ` <20210218053926.1068053-1-arseny.krasnov@kaspersky.com>
2021-02-23 13:49 ` [RFC PATCH v5 10/19] virtio/vsock: simplify credit update function API Stefano Garzarella
[not found] ` <20210218053940.1068164-1-arseny.krasnov@kaspersky.com>
2021-02-23 14:15 ` [RFC PATCH v5 11/19] virtio/vsock: dequeue callback for SOCK_SEQPACKET Stefano Garzarella
2021-02-23 14:17 ` Michael S. Tsirkin
[not found] ` <661fd81f-daf5-a3eb-6946-8f4e83d1ee54@kaspersky.com>
2021-02-24 6:41 ` Michael S. Tsirkin
2021-02-24 8:31 ` Stefano Garzarella
[not found] ` <20210218054219.1069224-1-arseny.krasnov@kaspersky.com>
2021-03-02 22:25 ` [RFC PATCH v5 19/19] virtio/vsock: update trace event for SEQPACKET Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).