search for: virtio_transport_recv_connect

Displaying 20 results from an estimated 49 matches for "virtio_transport_recv_connect".

2019 May 31
0
[PATCH v3 1/5] vsock/virtio: limit the memory used per-socket
...@@ -65,6 +68,9 @@ virtio_transport_alloc_pkt(struct virtio_vsock_pkt_info *info, pkt->buf = kmalloc(len, GFP_KERNEL); if (!pkt->buf) goto out_pkt; + + pkt->buf_len = len; + err = memcpy_from_msg(pkt->buf, info->msg, len); if (err) goto out; @@ -842,24 +848,60 @@ virtio_transport_recv_connecting(struct sock *sk, return err; } +static void +virtio_transport_recv_enqueue(struct vsock_sock *vsk, + struct virtio_vsock_pkt *pkt) +{ + struct virtio_vsock_sock *vvs = vsk->trans; + bool free_pkt = false; + + pkt->len = le32_to_cpu(pkt->hdr.len); + pkt->off = 0; + + spin...
2019 Jul 17
0
[PATCH v4 1/5] vsock/virtio: limit the memory used per-socket
...@@ -64,6 +67,9 @@ virtio_transport_alloc_pkt(struct virtio_vsock_pkt_info *info, pkt->buf = kmalloc(len, GFP_KERNEL); if (!pkt->buf) goto out_pkt; + + pkt->buf_len = len; + err = memcpy_from_msg(pkt->buf, info->msg, len); if (err) goto out; @@ -841,24 +847,60 @@ virtio_transport_recv_connecting(struct sock *sk, return err; } +static void +virtio_transport_recv_enqueue(struct vsock_sock *vsk, + struct virtio_vsock_pkt *pkt) +{ + struct virtio_vsock_sock *vvs = vsk->trans; + bool free_pkt = false; + + pkt->len = le32_to_cpu(pkt->hdr.len); + pkt->off = 0; + + spin...
2019 May 16
2
[PATCH v2 1/8] vsock/virtio: limit the memory used per-socket
...pkt->buf_len) { > + buf->addr = pkt->buf; > + pkt->buf = NULL; > + } else { > + buf->addr = kmalloc(pkt->len, GFP_KERNEL); buf and buf->addr could be allocated in a single call, though I'm not sure how big an optimization this is. > @@ -841,20 +882,24 @@ virtio_transport_recv_connected(struct sock *sk, > { > struct vsock_sock *vsk = vsock_sk(sk); > struct virtio_vsock_sock *vvs = vsk->trans; > + struct virtio_vsock_buf *buf; > int err = 0; > > switch (le16_to_cpu(pkt->hdr.op)) { > case VIRTIO_VSOCK_OP_RW: > pkt->len = le32_to_...
2019 May 16
2
[PATCH v2 1/8] vsock/virtio: limit the memory used per-socket
...pkt->buf_len) { > + buf->addr = pkt->buf; > + pkt->buf = NULL; > + } else { > + buf->addr = kmalloc(pkt->len, GFP_KERNEL); buf and buf->addr could be allocated in a single call, though I'm not sure how big an optimization this is. > @@ -841,20 +882,24 @@ virtio_transport_recv_connected(struct sock *sk, > { > struct vsock_sock *vsk = vsock_sk(sk); > struct virtio_vsock_sock *vvs = vsk->trans; > + struct virtio_vsock_buf *buf; > int err = 0; > > switch (le16_to_cpu(pkt->hdr.op)) { > case VIRTIO_VSOCK_OP_RW: > pkt->len = le32_to_...
2013 Jun 27
1
[RFC 2/5] VSOCK: Introduce virtio-vsock-common.ko
...+ }; > + > + pr_debug("%s\n", __func__); > + > + /* Send RST only if the original pkt is not a RST pkt */ > + if (pkt->hdr.op == VIRTIO_VSOCK_OP_RST) > + return 0; > + > + return trans->ops->send_pkt(vsk, &info); > +} > + > +static int > +virtio_transport_recv_connecting(struct sock *sk, > + struct virtio_vsock_pkt *pkt) > +{ > + struct vsock_sock *vsk = vsock_sk(sk); > + int err; > + int skerr; > + > + pr_debug("%s: vsk=%p\n", __func__, vsk); > + switch (pkt->hdr.op) { > + case VIRTIO_VSOCK_OP_ATTACH: > + pr_debug...
2013 Jun 27
1
[RFC 2/5] VSOCK: Introduce virtio-vsock-common.ko
...+ }; > + > + pr_debug("%s\n", __func__); > + > + /* Send RST only if the original pkt is not a RST pkt */ > + if (pkt->hdr.op == VIRTIO_VSOCK_OP_RST) > + return 0; > + > + return trans->ops->send_pkt(vsk, &info); > +} > + > +static int > +virtio_transport_recv_connecting(struct sock *sk, > + struct virtio_vsock_pkt *pkt) > +{ > + struct vsock_sock *vsk = vsock_sk(sk); > + int err; > + int skerr; > + > + pr_debug("%s: vsk=%p\n", __func__, vsk); > + switch (pkt->hdr.op) { > + case VIRTIO_VSOCK_OP_ATTACH: > + pr_debug...
2015 Dec 09
0
[PATCH v3 1/4] VSOCK: Introduce virtio-vsock-common.ko
...CK_OP_RST, + .type = VIRTIO_VSOCK_TYPE_STREAM, + }; + + pr_debug("%s\n", __func__); + + /* Send RST only if the original pkt is not a RST pkt */ + if (le16_to_cpu(pkt->hdr.op) == VIRTIO_VSOCK_OP_RST) + return 0; + + return trans->ops->send_pkt(vsk, &info); +} + +static int +virtio_transport_recv_connecting(struct sock *sk, + struct virtio_vsock_pkt *pkt) +{ + struct vsock_sock *vsk = vsock_sk(sk); + int err; + int skerr; + + pr_debug("%s: vsk=%p\n", __func__, vsk); + switch (le16_to_cpu(pkt->hdr.op)) { + case VIRTIO_VSOCK_OP_RESPONSE: + pr_debug("%s: got RESPONSE\n", __...
2013 Jun 27
0
[RFC 2/5] VSOCK: Introduce virtio-vsock-common.ko
...fo = { + .op = VIRTIO_VSOCK_OP_RST, + .type = SOCK_STREAM, + }; + + pr_debug("%s\n", __func__); + + /* Send RST only if the original pkt is not a RST pkt */ + if (pkt->hdr.op == VIRTIO_VSOCK_OP_RST) + return 0; + + return trans->ops->send_pkt(vsk, &info); +} + +static int +virtio_transport_recv_connecting(struct sock *sk, + struct virtio_vsock_pkt *pkt) +{ + struct vsock_sock *vsk = vsock_sk(sk); + int err; + int skerr; + + pr_debug("%s: vsk=%p\n", __func__, vsk); + switch (pkt->hdr.op) { + case VIRTIO_VSOCK_OP_ATTACH: + pr_debug("%s: got attach\n", __func__); + sk-&g...
2019 May 17
0
[PATCH v2 1/8] vsock/virtio: limit the memory used per-socket
...a single call, though I'm not > sure how big an optimization this is. > IIUC, in the case of zero-copy I should allocate only the buf, otherwise I should allocate both buf and buf->addr in a single call when I'm doing a full-copy. Is it correct? > > @@ -841,20 +882,24 @@ virtio_transport_recv_connected(struct sock *sk, > > { > > struct vsock_sock *vsk = vsock_sk(sk); > > struct virtio_vsock_sock *vvs = vsk->trans; > > + struct virtio_vsock_buf *buf; > > int err = 0; > > > > switch (le16_to_cpu(pkt->hdr.op)) { > > case VIRTIO_VSO...
2019 Nov 08
1
[PATCH] vsock/virtio: fix sock refcnt holding during the shutdown
...- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c index 481f7f8a1655..fb2060dffb0a 100644 --- a/net/vmw_vsock/virtio_transport_common.c +++ b/net/vmw_vsock/virtio_transport_common.c @@ -947,9 +947,11 @@ virtio_transport_recv_connected(struct sock *sk, if (le32_to_cpu(pkt->hdr.flags) & VIRTIO_VSOCK_SHUTDOWN_SEND) vsk->peer_shutdown |= SEND_SHUTDOWN; if (vsk->peer_shutdown == SHUTDOWN_MASK && - vsock_stream_has_data(vsk) <= 0) { - sock_set_flag(sk, SOCK_DONE); - sk->sk_state = TCP_CL...
2020 May 31
0
[PATCH v3] virtio_vsock: Fix race condition in virtio_transport_recv_pkt
...ocket (found sk) > lock_sock_nested > vsock_remove_sock > sock_orphan > sk_set_socket(sk, NULL) > sk->sk_shutdown = SHUTDOWN_MASK > ... > release_sock > lock_sock > virtio_transport_recv_connecting > sk->sk_socket->state (panic!) > > The root cause is that vsock_find_bound_socket can't hold the lock_sock, > so there is a small race window between vsock_find_bound_socket() and > lock_sock(). If __vsock_release() is running i...
2020 May 29
0
[PATCH] virtio_vsock: Fix race condition in virtio_transport_recv_pkt
...; __vsock_release vsock_find_bound_socket (found) > lock_sock_nested > vsock_remove_sock > sock_orphan > sk_set_socket(sk, NULL) > ... > release_sock > lock_sock > virtio_transport_recv_connecting > sk->sk_socket->state (panic) > > This fixes it by checking vsk again whether it is in bound/connected table. > > Signed-off-by: Jia He <justin.he at arm.com> > Cc: stable at vger.kernel.org > --- > net/vmw_vsock/virtio...
2019 Jul 29
3
[PATCH v4 1/5] vsock/virtio: limit the memory used per-socket
...ct virtio_vsock_pkt_info *info, > pkt->buf = kmalloc(len, GFP_KERNEL); > if (!pkt->buf) > goto out_pkt; > + > + pkt->buf_len = len; > + > err = memcpy_from_msg(pkt->buf, info->msg, len); > if (err) > goto out; > @@ -841,24 +847,60 @@ virtio_transport_recv_connecting(struct sock *sk, > return err; > } > > +static void > +virtio_transport_recv_enqueue(struct vsock_sock *vsk, > + struct virtio_vsock_pkt *pkt) > +{ > + struct virtio_vsock_sock *vvs = vsk->trans; > + bool free_pkt = false; > + > + pkt->len = le...
2019 Jul 29
3
[PATCH v4 1/5] vsock/virtio: limit the memory used per-socket
...ct virtio_vsock_pkt_info *info, > pkt->buf = kmalloc(len, GFP_KERNEL); > if (!pkt->buf) > goto out_pkt; > + > + pkt->buf_len = len; > + > err = memcpy_from_msg(pkt->buf, info->msg, len); > if (err) > goto out; > @@ -841,24 +847,60 @@ virtio_transport_recv_connecting(struct sock *sk, > return err; > } > > +static void > +virtio_transport_recv_enqueue(struct vsock_sock *vsk, > + struct virtio_vsock_pkt *pkt) > +{ > + struct virtio_vsock_sock *vvs = vsk->trans; > + bool free_pkt = false; > + > + pkt->len = le...
2020 May 29
0
[PATCH v2] virtio_vsock: Fix race condition in virtio_transport_recv_pkt
...(found) > lock_sock_nested > vsock_remove_sock > sock_orphan > sk_set_socket(sk, NULL) Here we can add: sk->sk_shutdown = SHUTDOWN_MASK; > ... > release_sock > lock_sock > virtio_transport_recv_connecting > sk->sk_socket->state (panic) > > The root cause is that vsock_find_bound_socket can't hold the lock_sock, > so there is a small race window between vsock_find_bound_socket() and > lock_sock(). If there is __vsock_release() in anoth...
2015 Dec 10
1
[PATCH v3 1/4] VSOCK: Introduce virtio-vsock-common.ko
...> + pr_debug("%s\n", __func__); > + > + /* Send RST only if the original pkt is not a RST pkt */ > + if (le16_to_cpu(pkt->hdr.op) == VIRTIO_VSOCK_OP_RST) > + return 0; > + > + return trans->ops->send_pkt(vsk, &info); > +} > + > +static int > +virtio_transport_recv_connecting(struct sock *sk, > + struct virtio_vsock_pkt *pkt) > +{ > + struct vsock_sock *vsk = vsock_sk(sk); > + int err; > + int skerr; > + > + pr_debug("%s: vsk=%p\n", __func__, vsk); > + switch (le16_to_cpu(pkt->hdr.op)) { > + case VIRTIO_VSOCK_OP_RESPONSE: &...
2015 Dec 10
1
[PATCH v3 1/4] VSOCK: Introduce virtio-vsock-common.ko
...> + pr_debug("%s\n", __func__); > + > + /* Send RST only if the original pkt is not a RST pkt */ > + if (le16_to_cpu(pkt->hdr.op) == VIRTIO_VSOCK_OP_RST) > + return 0; > + > + return trans->ops->send_pkt(vsk, &info); > +} > + > +static int > +virtio_transport_recv_connecting(struct sock *sk, > + struct virtio_vsock_pkt *pkt) > +{ > + struct vsock_sock *vsk = vsock_sk(sk); > + int err; > + int skerr; > + > + pr_debug("%s: vsk=%p\n", __func__, vsk); > + switch (le16_to_cpu(pkt->hdr.op)) { > + case VIRTIO_VSOCK_OP_RESPONSE: &...
2019 May 12
1
[PATCH v2 1/8] vsock/virtio: limit the memory used per-socket
...; > + buf->off += bytes; > + if (buf->off == buf->len) { > + virtio_transport_dec_rx_pkt(vvs, buf->len); > + list_del(&buf->list); > + virtio_transport_free_buf(buf); > } > } > spin_unlock_bh(&vvs->rx_lock); > @@ -841,20 +882,24 @@ virtio_transport_recv_connected(struct sock *sk, > { > struct vsock_sock *vsk = vsock_sk(sk); > struct virtio_vsock_sock *vvs = vsk->trans; > + struct virtio_vsock_buf *buf; > int err = 0; > > switch (le16_to_cpu(pkt->hdr.op)) { > case VIRTIO_VSOCK_OP_RW: > pkt->len = le32_to_...
2014 Jul 05
0
[RFC V2 3/7] VSOCK: Introduce virtio-vsock-common.ko
...= VIRTIO_VSOCK_OP_RST, + .type = SOCK_STREAM, + }; + + pr_debug("%s\n", __func__); + + /* Send RST only if the original pkt is not a RST pkt */ + if (le16_to_cpu(pkt->hdr.op) == VIRTIO_VSOCK_OP_RST) + return 0; + + return trans->ops->send_pkt(vsk, &info); +} + +static int +virtio_transport_recv_connecting(struct sock *sk, + struct virtio_vsock_pkt *pkt) +{ + struct vsock_sock *vsk = vsock_sk(sk); + int err; + int skerr; + u32 cookie; + + pr_debug("%s: vsk=%p\n", __func__, vsk); + switch (le16_to_cpu(pkt->hdr.op)) { + case VIRTIO_VSOCK_OP_RESPONSE: + cookie = le32_to_cpu(pkt->...
2019 May 31
7
[PATCH v3 0/5] vsock/virtio: optimizations to increase the throughput
This series tries to increase the throughput of virtio-vsock with slight changes. While I was testing the v2 of this series I discovered an huge use of memory, so I added patch 1 to mitigate this issue. I put it in this series in order to better track the performance trends. v3: - Patch 1: added a threshold to copy only small packets [Jason] - Patch 1: replaced the allocation of a new buffer