* Re: [PATCH net-next v3 1/3] vsock: support sockmap
[not found] ` <20230227-vsock-sockmap-upstream-v3-1-7e7f4ce623ee@bytedance.com>
@ 2023-02-28 21:36 ` Michael S. Tsirkin
[not found] ` <Y/B9ddkfQw6Ae/lY@bullseye>
2023-03-02 9:42 ` Stefano Garzarella
1 sibling, 1 reply; 6+ messages in thread
From: Michael S. Tsirkin @ 2023-02-28 21:36 UTC (permalink / raw)
To: Bobby Eshleman
Cc: Cong Wang, kvm, Alexei Starovoitov, virtualization, Song Liu,
Eric Dumazet, Stanislav Fomichev, linux-kselftest, Shuah Khan,
Mykola Lysenko, Daniel Borkmann, John Fastabend, Andrii Nakryiko,
Yonghong Song, Paolo Abeni, KP Singh, Stefan Hajnoczi,
Jakub Kicinski, Hao Luo, netdev, linux-kernel, Jiri Olsa, bpf,
Martin KaFai Lau, David S. Miller
On Tue, Feb 28, 2023 at 07:04:34PM +0000, Bobby Eshleman wrote:
> @@ -1241,19 +1252,34 @@ static int vsock_dgram_connect(struct socket *sock,
>
> memcpy(&vsk->remote_addr, remote_addr, sizeof(vsk->remote_addr));
> sock->state = SS_CONNECTED;
> + sk->sk_state = TCP_ESTABLISHED;
>
> out:
> release_sock(sk);
> return err;
> }
How is this related? Maybe add a comment to explain? Does
TCP_ESTABLISHED make sense for all types of sockets?
--
MST
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next v3 1/3] vsock: support sockmap
[not found] ` <Y/B9ddkfQw6Ae/lY@bullseye>
@ 2023-03-02 9:20 ` Stefano Garzarella
0 siblings, 0 replies; 6+ messages in thread
From: Stefano Garzarella @ 2023-03-02 9:20 UTC (permalink / raw)
To: Bobby Eshleman
Cc: Cong Wang, Bobby Eshleman, kvm, Michael S. Tsirkin, KP Singh,
virtualization, Song Liu, Eric Dumazet, Stanislav Fomichev,
linux-kselftest, Shuah Khan, Mykola Lysenko, Daniel Borkmann,
John Fastabend, Andrii Nakryiko, Jakub Kicinski, Paolo Abeni,
Alexei Starovoitov, Stefan Hajnoczi, Yonghong Song, Hao Luo,
netdev, linux-kernel, Jiri Olsa, bpf, Martin KaFai Lau,
David S. Miller
On Sat, Feb 18, 2023 at 07:25:41AM +0000, Bobby Eshleman wrote:
>On Tue, Feb 28, 2023 at 04:36:22PM -0500, Michael S. Tsirkin wrote:
>> On Tue, Feb 28, 2023 at 07:04:34PM +0000, Bobby Eshleman wrote:
>> > @@ -1241,19 +1252,34 @@ static int vsock_dgram_connect(struct socket *sock,
>> >
>> > memcpy(&vsk->remote_addr, remote_addr, sizeof(vsk->remote_addr));
>> > sock->state = SS_CONNECTED;
>> > + sk->sk_state = TCP_ESTABLISHED;
>> >
>> > out:
>> > release_sock(sk);
>> > return err;
>> > }
>>
>>
>> How is this related? Maybe add a comment to explain? Does
>> TCP_ESTABLISHED make sense for all types of sockets?
>>
>
>Hey Michael, definitely, I can leave a comment.
I agree, since I had the same doubt in previous versions, I think it's
worth putting a comment in the code to explain why.
Since there may be a v4, I'll leave some small comments in a separate
email.
Thanks,
Stefano
>
>The real reason is due to this piece of logic in sockmap:
>https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/net/core/sock_map.c?h=v6.2#n531
>
>And because of it, you see the same thing in (for example)
>unix_dgram_connect():
>https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/net/unix/af_unix.c?h=v6.2#n1394
>
>I believe it makes sense for these other socket types.
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next v3 1/3] vsock: support sockmap
[not found] ` <20230227-vsock-sockmap-upstream-v3-1-7e7f4ce623ee@bytedance.com>
2023-02-28 21:36 ` [PATCH net-next v3 1/3] vsock: support sockmap Michael S. Tsirkin
@ 2023-03-02 9:42 ` Stefano Garzarella
1 sibling, 0 replies; 6+ messages in thread
From: Stefano Garzarella @ 2023-03-02 9:42 UTC (permalink / raw)
To: Bobby Eshleman
Cc: Cong Wang, kvm, Michael S. Tsirkin, Alexei Starovoitov,
virtualization, Song Liu, Eric Dumazet, Stanislav Fomichev,
linux-kselftest, Shuah Khan, Mykola Lysenko, Daniel Borkmann,
John Fastabend, Andrii Nakryiko, Yonghong Song, Paolo Abeni,
KP Singh, Stefan Hajnoczi, Jakub Kicinski, Hao Luo, netdev,
linux-kernel, Jiri Olsa, bpf, Martin KaFai Lau, David S. Miller
On Tue, Feb 28, 2023 at 07:04:34PM +0000, Bobby Eshleman wrote:
>This patch adds sockmap support for vsock sockets. It is intended to be
>usable by all transports, but only the virtio transport is implemented.
>
>Signed-off-by: Bobby Eshleman <bobby.eshleman@bytedance.com>
>---
> drivers/vhost/vsock.c | 1 +
> include/linux/virtio_vsock.h | 1 +
> include/net/af_vsock.h | 17 ++++
> net/vmw_vsock/Makefile | 1 +
> net/vmw_vsock/af_vsock.c | 55 ++++++++--
> net/vmw_vsock/virtio_transport.c | 2 +
> net/vmw_vsock/virtio_transport_common.c | 25 +++++
> net/vmw_vsock/vsock_bpf.c | 174 ++++++++++++++++++++++++++++++++
> net/vmw_vsock/vsock_loopback.c | 2 +
> 9 files changed, 272 insertions(+), 6 deletions(-)
>
>diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c
>index 1f3b89c885cc..3c6dc036b904 100644
>--- a/drivers/vhost/vsock.c
>+++ b/drivers/vhost/vsock.c
>@@ -439,6 +439,7 @@ static struct virtio_transport vhost_transport = {
> .notify_send_post_enqueue = virtio_transport_notify_send_post_enqueue,
> .notify_buffer_size = virtio_transport_notify_buffer_size,
>
>+ .read_skb = virtio_transport_read_skb,
> },
>
> .send_pkt = vhost_transport_send_pkt,
>diff --git a/include/linux/virtio_vsock.h b/include/linux/virtio_vsock.h
>index 3f9c16611306..c58453699ee9 100644
>--- a/include/linux/virtio_vsock.h
>+++ b/include/linux/virtio_vsock.h
>@@ -245,4 +245,5 @@ u32 virtio_transport_get_credit(struct virtio_vsock_sock *vvs, u32 wanted);
> void virtio_transport_put_credit(struct virtio_vsock_sock *vvs, u32 credit);
> void virtio_transport_deliver_tap_pkt(struct sk_buff *skb);
> int virtio_transport_purge_skbs(void *vsk, struct sk_buff_head *list);
>+int virtio_transport_read_skb(struct vsock_sock *vsk, skb_read_actor_t read_actor);
> #endif /* _LINUX_VIRTIO_VSOCK_H */
>diff --git a/include/net/af_vsock.h b/include/net/af_vsock.h
>index 568a87c5e0d0..a73f5fbd296a 100644
>--- a/include/net/af_vsock.h
>+++ b/include/net/af_vsock.h
>@@ -75,6 +75,7 @@ struct vsock_sock {
> void *trans;
> };
>
>+s64 vsock_connectible_has_data(struct vsock_sock *vsk);
> s64 vsock_stream_has_data(struct vsock_sock *vsk);
> s64 vsock_stream_has_space(struct vsock_sock *vsk);
> struct sock *vsock_create_connected(struct sock *parent);
>@@ -173,6 +174,9 @@ struct vsock_transport {
>
> /* Addressing. */
> u32 (*get_local_cid)(void);
>+
>+ /* Read a single skb */
>+ int (*read_skb)(struct vsock_sock *, skb_read_actor_t);
> };
>
> /**** CORE ****/
>@@ -225,5 +229,18 @@ int vsock_init_tap(void);
> int vsock_add_tap(struct vsock_tap *vt);
> int vsock_remove_tap(struct vsock_tap *vt);
> void vsock_deliver_tap(struct sk_buff *build_skb(void *opaque), void *opaque);
>+int vsock_connectible_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
>+ int flags);
>+int vsock_dgram_recvmsg(struct socket *sock, struct msghdr *msg,
>+ size_t len, int flags);
Just because you have to resend a v4, here we can align as `checkpatch
--strict` suggests:
CHECK: Alignment should match open parenthesis
#63: FILE: include/net/af_vsock.h:235:
+int vsock_dgram_recvmsg(struct socket *sock, struct msghdr *msg,
+ size_t len, int flags);
>+
>+#ifdef CONFIG_BPF_SYSCALL
>+extern struct proto vsock_proto;
>+int vsock_bpf_update_proto(struct sock *sk, struct sk_psock *psock, bool restore);
>+void __init vsock_bpf_build_proto(void);
>+#else
>+static inline void __init vsock_bpf_build_proto(void)
>+{}
>+#endif
>
> #endif /* __AF_VSOCK_H__ */
>diff --git a/net/vmw_vsock/Makefile b/net/vmw_vsock/Makefile
>index 6a943ec95c4a..5da74c4a9f1d 100644
>--- a/net/vmw_vsock/Makefile
>+++ b/net/vmw_vsock/Makefile
>@@ -8,6 +8,7 @@ obj-$(CONFIG_HYPERV_VSOCKETS) += hv_sock.o
> obj-$(CONFIG_VSOCKETS_LOOPBACK) += vsock_loopback.o
>
> vsock-y += af_vsock.o af_vsock_tap.o vsock_addr.o
>+vsock-$(CONFIG_BPF_SYSCALL) += vsock_bpf.o
>
> vsock_diag-y += diag.o
>
>diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
>index 19aea7cba26e..f2cc04fb8b13 100644
>--- a/net/vmw_vsock/af_vsock.c
>+++ b/net/vmw_vsock/af_vsock.c
>@@ -116,10 +116,13 @@ static void vsock_sk_destruct(struct sock *sk);
> static int vsock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb);
>
> /* Protocol family. */
>-static struct proto vsock_proto = {
>+struct proto vsock_proto = {
> .name = "AF_VSOCK",
> .owner = THIS_MODULE,
> .obj_size = sizeof(struct vsock_sock),
>+#ifdef CONFIG_BPF_SYSCALL
>+ .psock_update_sk_prot = vsock_bpf_update_proto,
>+#endif
> };
>
> /* The default peer timeout indicates how long we will wait for a peer response
>@@ -865,7 +868,7 @@ s64 vsock_stream_has_data(struct vsock_sock *vsk)
> }
> EXPORT_SYMBOL_GPL(vsock_stream_has_data);
>
>-static s64 vsock_connectible_has_data(struct vsock_sock *vsk)
>+s64 vsock_connectible_has_data(struct vsock_sock *vsk)
> {
> struct sock *sk = sk_vsock(vsk);
>
>@@ -874,6 +877,7 @@ static s64 vsock_connectible_has_data(struct vsock_sock *vsk)
> else
> return vsock_stream_has_data(vsk);
> }
>+EXPORT_SYMBOL_GPL(vsock_connectible_has_data);
>
> s64 vsock_stream_has_space(struct vsock_sock *vsk)
> {
>@@ -1131,6 +1135,13 @@ static __poll_t vsock_poll(struct file *file, struct socket *sock,
> return mask;
> }
>
>+static int vsock_read_skb(struct sock *sk, skb_read_actor_t read_actor)
>+{
>+ struct vsock_sock *vsk = vsock_sk(sk);
>+
>+ return vsk->transport->read_skb(vsk, read_actor);
>+}
>+
> static int vsock_dgram_sendmsg(struct socket *sock, struct msghdr *msg,
> size_t len)
> {
>@@ -1241,19 +1252,34 @@ static int vsock_dgram_connect(struct socket *sock,
>
> memcpy(&vsk->remote_addr, remote_addr, sizeof(vsk->remote_addr));
> sock->state = SS_CONNECTED;
>+ sk->sk_state = TCP_ESTABLISHED;
>
> out:
> release_sock(sk);
> return err;
> }
>
>-static int vsock_dgram_recvmsg(struct socket *sock, struct msghdr *msg,
>- size_t len, int flags)
>+int vsock_dgram_recvmsg(struct socket *sock, struct msghdr *msg,
>+ size_t len, int flags)
> {
>- struct vsock_sock *vsk = vsock_sk(sock->sk);
>+#ifdef CONFIG_BPF_SYSCALL
>+ const struct proto *prot;
>+#endif
>+ struct vsock_sock *vsk;
>+ struct sock *sk;
>+
>+ sk = sock->sk;
>+ vsk = vsock_sk(sk);
>+
>+#ifdef CONFIG_BPF_SYSCALL
>+ prot = READ_ONCE(sk->sk_prot);
>+ if (prot != &vsock_proto)
>+ return prot->recvmsg(sk, msg, len, flags, NULL);
>+#endif
>
> return vsk->transport->dgram_dequeue(vsk, msg, len, flags);
> }
>+EXPORT_SYMBOL_GPL(vsock_dgram_recvmsg);
>
> static const struct proto_ops vsock_dgram_ops = {
> .family = PF_VSOCK,
>@@ -1272,6 +1298,7 @@ static const struct proto_ops vsock_dgram_ops = {
> .recvmsg = vsock_dgram_recvmsg,
> .mmap = sock_no_mmap,
> .sendpage = sock_no_sendpage,
>+ .read_skb = vsock_read_skb,
> };
>
> static int vsock_transport_cancel_pkt(struct vsock_sock *vsk)
>@@ -2086,13 +2113,16 @@ static int __vsock_seqpacket_recvmsg(struct sock *sk, struct msghdr *msg,
> return err;
> }
>
>-static int
>+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;
>+#ifdef CONFIG_BPF_SYSCALL
>+ const struct proto *prot;
>+#endif
> int err;
>
> sk = sock->sk;
>@@ -2139,6 +2169,14 @@ vsock_connectible_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
> goto out;
> }
>
>+#ifdef CONFIG_BPF_SYSCALL
>+ prot = READ_ONCE(sk->sk_prot);
>+ if (prot != &vsock_proto) {
>+ release_sock(sk);
>+ return prot->recvmsg(sk, msg, len, flags, NULL);
>+ }
>+#endif
>+
> if (sk->sk_type == SOCK_STREAM)
> err = __vsock_stream_recvmsg(sk, msg, len, flags);
> else
>@@ -2148,6 +2186,7 @@ vsock_connectible_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
> release_sock(sk);
> return err;
> }
>+EXPORT_SYMBOL_GPL(vsock_connectible_recvmsg);
>
> static int vsock_set_rcvlowat(struct sock *sk, int val)
> {
>@@ -2188,6 +2227,7 @@ static const struct proto_ops vsock_stream_ops = {
> .mmap = sock_no_mmap,
> .sendpage = sock_no_sendpage,
> .set_rcvlowat = vsock_set_rcvlowat,
>+ .read_skb = vsock_read_skb,
> };
>
> static const struct proto_ops vsock_seqpacket_ops = {
>@@ -2209,6 +2249,7 @@ static const struct proto_ops vsock_seqpacket_ops = {
> .recvmsg = vsock_connectible_recvmsg,
> .mmap = sock_no_mmap,
> .sendpage = sock_no_sendpage,
>+ .read_skb = vsock_read_skb,
> };
>
> static int vsock_create(struct net *net, struct socket *sock,
>@@ -2348,6 +2389,8 @@ static int __init vsock_init(void)
> goto err_unregister_proto;
> }
>
>+ vsock_bpf_build_proto();
>+
> return 0;
>
> err_unregister_proto:
>diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c
>index 28b5a8e8e094..e95df847176b 100644
>--- a/net/vmw_vsock/virtio_transport.c
>+++ b/net/vmw_vsock/virtio_transport.c
>@@ -457,6 +457,8 @@ static struct virtio_transport virtio_transport = {
> .notify_send_pre_enqueue = virtio_transport_notify_send_pre_enqueue,
> .notify_send_post_enqueue = virtio_transport_notify_send_post_enqueue,
> .notify_buffer_size = virtio_transport_notify_buffer_size,
>+
>+ .read_skb = virtio_transport_read_skb,
> },
>
> .send_pkt = virtio_transport_send_pkt,
>diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
>index a1581c77cf84..f64527f32385 100644
>--- a/net/vmw_vsock/virtio_transport_common.c
>+++ b/net/vmw_vsock/virtio_transport_common.c
>@@ -1388,6 +1388,31 @@ int virtio_transport_purge_skbs(void *vsk, struct sk_buff_head *queue)
> }
> EXPORT_SYMBOL_GPL(virtio_transport_purge_skbs);
>
>+int virtio_transport_read_skb(struct vsock_sock *vsk, skb_read_actor_t recv_actor)
>+{
>+ struct virtio_vsock_sock *vvs = vsk->trans;
>+ struct sock *sk = sk_vsock(vsk);
>+ struct sk_buff *skb;
>+ int off = 0;
>+ int copied;
>+ int err;
>+
>+ spin_lock_bh(&vvs->rx_lock);
>+ /* Use __skb_recv_datagram() for race-free handling of the receive. It
>+ * works for types other than dgrams.
>+ */
>+ skb = __skb_recv_datagram(sk, &vvs->rx_queue, MSG_DONTWAIT, &off, &err);
>+ spin_unlock_bh(&vvs->rx_lock);
>+
>+ if (!skb)
>+ return err;
>+
>+ copied = recv_actor(sk, skb);
>+ kfree_skb(skb);
>+ return copied;
>+}
>+EXPORT_SYMBOL_GPL(virtio_transport_read_skb);
>+
> MODULE_LICENSE("GPL v2");
> MODULE_AUTHOR("Asias He");
> MODULE_DESCRIPTION("common code for virtio vsock");
>diff --git a/net/vmw_vsock/vsock_bpf.c b/net/vmw_vsock/vsock_bpf.c
>new file mode 100644
>index 000000000000..9c71c163c684
>--- /dev/null
>+++ b/net/vmw_vsock/vsock_bpf.c
>@@ -0,0 +1,174 @@
>+// SPDX-License-Identifier: GPL-2.0
>+/* Copyright (c) 2022 Bobby Eshleman <bobby.eshleman@bytedance.com>
>+ *
>+ * Based off of net/unix/unix_bpf.c
>+ */
>+
>+#include <linux/bpf.h>
>+#include <linux/module.h>
>+#include <linux/skmsg.h>
>+#include <linux/socket.h>
>+#include <linux/wait.h>
>+#include <net/af_vsock.h>
>+#include <net/sock.h>
>+
>+#define vsock_sk_has_data(__sk, __psock) \
>+ ({ !skb_queue_empty(&(__sk)->sk_receive_queue) || \
>+ !skb_queue_empty(&(__psock)->ingress_skb) || \
>+ !list_empty(&(__psock)->ingress_msg); \
>+ })
>+
>+static struct proto *vsock_prot_saved __read_mostly;
>+static DEFINE_SPINLOCK(vsock_prot_lock);
>+static struct proto vsock_bpf_prot;
>+
>+static bool vsock_has_data(struct sock *sk, struct sk_psock *psock)
>+{
>+ struct vsock_sock *vsk = vsock_sk(sk);
>+ s64 ret;
>+
>+ ret = vsock_connectible_has_data(vsk);
>+ if (ret > 0)
>+ return true;
>+
>+ return vsock_sk_has_data(sk, psock);
>+}
>+
>+static bool vsock_msg_wait_data(struct sock *sk, struct sk_psock *psock, long timeo)
>+{
>+ int ret;
`ret` can be bool now.
The rest LGTM.
Thanks,
Stefano
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next v3 2/3] selftests/bpf: add vsock to vmtest.sh
[not found] ` <20230227-vsock-sockmap-upstream-v3-2-7e7f4ce623ee@bytedance.com>
@ 2023-03-02 9:53 ` Stefano Garzarella
0 siblings, 0 replies; 6+ messages in thread
From: Stefano Garzarella @ 2023-03-02 9:53 UTC (permalink / raw)
To: Bobby Eshleman
Cc: Cong Wang, kvm, Michael S. Tsirkin, Alexei Starovoitov,
virtualization, Song Liu, Eric Dumazet, Stanislav Fomichev,
linux-kselftest, Shuah Khan, Mykola Lysenko, Daniel Borkmann,
John Fastabend, Andrii Nakryiko, Yonghong Song, Paolo Abeni,
KP Singh, Stefan Hajnoczi, Jakub Kicinski, Hao Luo, netdev,
linux-kernel, Jiri Olsa, bpf, Martin KaFai Lau, David S. Miller
On Tue, Feb 28, 2023 at 07:04:35PM +0000, Bobby Eshleman wrote:
>Add vsock loopback to the test kernel.
>
>This allows sockmap for vsock to be tested.
>
>Signed-off-by: Bobby Eshleman <bobby.eshleman@bytedance.com>
>---
> tools/testing/selftests/bpf/config.aarch64 | 2 ++
> tools/testing/selftests/bpf/config.s390x | 3 +++
> tools/testing/selftests/bpf/config.x86_64 | 3 +++
> 3 files changed, 8 insertions(+)
I already acked this in the v2, please bring them between versions if
there are no changes.
Acked-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] 6+ messages in thread
* Re: [PATCH net-next v3 3/3] selftests/bpf: add a test case for vsock sockmap
[not found] ` <20230227-vsock-sockmap-upstream-v3-3-7e7f4ce623ee@bytedance.com>
@ 2023-03-02 9:54 ` Stefano Garzarella
0 siblings, 0 replies; 6+ messages in thread
From: Stefano Garzarella @ 2023-03-02 9:54 UTC (permalink / raw)
To: Bobby Eshleman
Cc: Cong Wang, kvm, Michael S. Tsirkin, Alexei Starovoitov,
virtualization, Song Liu, Eric Dumazet, Stanislav Fomichev,
linux-kselftest, Shuah Khan, Mykola Lysenko, Daniel Borkmann,
John Fastabend, Andrii Nakryiko, Yonghong Song, Paolo Abeni,
KP Singh, Stefan Hajnoczi, Jakub Kicinski, Hao Luo, netdev,
linux-kernel, Jiri Olsa, bpf, Martin KaFai Lau, David S. Miller
On Tue, Feb 28, 2023 at 07:04:36PM +0000, Bobby Eshleman wrote:
>Add a test case testing the redirection from connectible AF_VSOCK
>sockets to connectible AF_UNIX sockets.
>
>Signed-off-by: Bobby Eshleman <bobby.eshleman@bytedance.com>
>---
> .../selftests/bpf/prog_tests/sockmap_listen.c | 163 +++++++++++++++++++++
> 1 file changed, 163 insertions(+)
Ditto.
For the vsock part:
Acked-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] 6+ messages in thread
* Re: [PATCH net-next v3 0/3] vsock: add support for sockmap
[not found] <20230227-vsock-sockmap-upstream-v3-0-7e7f4ce623ee@bytedance.com>
` (2 preceding siblings ...)
[not found] ` <20230227-vsock-sockmap-upstream-v3-3-7e7f4ce623ee@bytedance.com>
@ 2023-03-10 8:53 ` Michael S. Tsirkin
3 siblings, 0 replies; 6+ messages in thread
From: Michael S. Tsirkin @ 2023-03-10 8:53 UTC (permalink / raw)
To: Bobby Eshleman
Cc: Cong Wang, kvm, Alexei Starovoitov, virtualization, Song Liu,
Eric Dumazet, Stanislav Fomichev, linux-kselftest, Shuah Khan,
Mykola Lysenko, Daniel Borkmann, John Fastabend, Andrii Nakryiko,
Yonghong Song, Paolo Abeni, KP Singh, Stefan Hajnoczi,
Jakub Kicinski, Hao Luo, netdev, linux-kernel, Jiri Olsa, bpf,
Martin KaFai Lau, David S. Miller
On Tue, Feb 28, 2023 at 07:04:33PM +0000, Bobby Eshleman wrote:
> Add support for sockmap to vsock.
>
> We're testing usage of vsock as a way to redirect guest-local UDS
> requests to the host and this patch series greatly improves the
> performance of such a setup.
>
> Compared to copying packets via userspace, this improves throughput by
> 121% in basic testing.
besides the small comment, looks ok. Feel free to include my ack
in v4:
Acked-by: Michael S. Tsirkin <mst@redhat.com>
> Tested as follows.
>
> Setup: guest unix dgram sender -> guest vsock redirector -> host vsock
> server
> Threads: 1
> Payload: 64k
> No sockmap:
> - 76.3 MB/s
> - The guest vsock redirector was
> "socat VSOCK-CONNECT:2:1234 UNIX-RECV:/path/to/sock"
> Using sockmap (this patch):
> - 168.8 MB/s (+121%)
> - The guest redirector was a simple sockmap echo server,
> redirecting unix ingress to vsock 2:1234 egress.
> - Same sender and server programs
>
> *Note: these numbers are from RFC v1
>
> Only the virtio transport has been tested. The loopback transport was
> used in writing bpf/selftests, but not thoroughly tested otherwise.
>
> This series requires the skb patch.
>
> Changes in v3:
> - vsock/bpf: Refactor wait logic in vsock_bpf_recvmsg() to avoid
> backwards goto
> - vsock/bpf: Check psock before acquiring slock
> - vsock/bpf: Return bool instead of int of 0 or 1
> - vsock/bpf: Wrap macro args __sk/__psock in parens
> - vsock/bpf: Place comment trailer */ on separate line
>
> Changes in v2:
> - vsock/bpf: rename vsock_dgram_* -> vsock_*
> - vsock/bpf: change sk_psock_{get,put} and {lock,release}_sock() order
> to minimize slock hold time
> - vsock/bpf: use "new style" wait
> - vsock/bpf: fix bug in wait log
> - vsock/bpf: add check that recvmsg sk_type is one dgram, seqpacket, or
> stream. Return error if not one of the three.
> - virtio/vsock: comment __skb_recv_datagram() usage
> - virtio/vsock: do not init copied in read_skb()
> - vsock/bpf: add ifdef guard around struct proto in dgram_recvmsg()
> - selftests/bpf: add vsock loopback config for aarch64
> - selftests/bpf: add vsock loopback config for s390x
> - selftests/bpf: remove vsock device from vmtest.sh qemu machine
> - selftests/bpf: remove CONFIG_VIRTIO_VSOCKETS=y from config.x86_64
> - vsock/bpf: move transport-related (e.g., if (!vsk->transport)) checks
> out of fast path
>
> Signed-off-by: Bobby Eshleman <bobby.eshleman@bytedance.com>
> ---
> Bobby Eshleman (3):
> vsock: support sockmap
> selftests/bpf: add vsock to vmtest.sh
> selftests/bpf: Add a test case for vsock sockmap
>
> drivers/vhost/vsock.c | 1 +
> include/linux/virtio_vsock.h | 1 +
> include/net/af_vsock.h | 17 ++
> net/vmw_vsock/Makefile | 1 +
> net/vmw_vsock/af_vsock.c | 55 ++++++-
> net/vmw_vsock/virtio_transport.c | 2 +
> net/vmw_vsock/virtio_transport_common.c | 24 +++
> net/vmw_vsock/vsock_bpf.c | 175 +++++++++++++++++++++
> net/vmw_vsock/vsock_loopback.c | 2 +
> tools/testing/selftests/bpf/config.aarch64 | 2 +
> tools/testing/selftests/bpf/config.s390x | 3 +
> tools/testing/selftests/bpf/config.x86_64 | 3 +
> .../selftests/bpf/prog_tests/sockmap_listen.c | 163 +++++++++++++++++++
> 13 files changed, 443 insertions(+), 6 deletions(-)
> ---
> base-commit: d83115ce337a632f996e44c9f9e18cadfcf5a094
> change-id: 20230118-support-vsock-sockmap-connectible-2e1297d2111a
>
> Best regards,
> --
> Bobby Eshleman <bobby.eshleman@bytedance.com>
>
> ---
> Bobby Eshleman (3):
> vsock: support sockmap
> selftests/bpf: add vsock to vmtest.sh
> selftests/bpf: add a test case for vsock sockmap
>
> drivers/vhost/vsock.c | 1 +
> include/linux/virtio_vsock.h | 1 +
> include/net/af_vsock.h | 17 ++
> net/vmw_vsock/Makefile | 1 +
> net/vmw_vsock/af_vsock.c | 55 ++++++-
> net/vmw_vsock/virtio_transport.c | 2 +
> net/vmw_vsock/virtio_transport_common.c | 25 +++
> net/vmw_vsock/vsock_bpf.c | 174 +++++++++++++++++++++
> net/vmw_vsock/vsock_loopback.c | 2 +
> tools/testing/selftests/bpf/config.aarch64 | 2 +
> tools/testing/selftests/bpf/config.s390x | 3 +
> tools/testing/selftests/bpf/config.x86_64 | 3 +
> .../selftests/bpf/prog_tests/sockmap_listen.c | 163 +++++++++++++++++++
> 13 files changed, 443 insertions(+), 6 deletions(-)
> ---
> base-commit: c2ea552065e43d05bce240f53c3185fd3a066204
> change-id: 20230227-vsock-sockmap-upstream-9d65c84174a2
>
> Best regards,
> --
> Bobby Eshleman <bobby.eshleman@bytedance.com>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-03-10 8:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20230227-vsock-sockmap-upstream-v3-0-7e7f4ce623ee@bytedance.com>
[not found] ` <20230227-vsock-sockmap-upstream-v3-1-7e7f4ce623ee@bytedance.com>
2023-02-28 21:36 ` [PATCH net-next v3 1/3] vsock: support sockmap Michael S. Tsirkin
[not found] ` <Y/B9ddkfQw6Ae/lY@bullseye>
2023-03-02 9:20 ` Stefano Garzarella
2023-03-02 9:42 ` Stefano Garzarella
[not found] ` <20230227-vsock-sockmap-upstream-v3-2-7e7f4ce623ee@bytedance.com>
2023-03-02 9:53 ` [PATCH net-next v3 2/3] selftests/bpf: add vsock to vmtest.sh Stefano Garzarella
[not found] ` <20230227-vsock-sockmap-upstream-v3-3-7e7f4ce623ee@bytedance.com>
2023-03-02 9:54 ` [PATCH net-next v3 3/3] selftests/bpf: add a test case for vsock sockmap Stefano Garzarella
2023-03-10 8:53 ` [PATCH net-next v3 0/3] vsock: add support for sockmap Michael S. Tsirkin
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).