Displaying 20 results from an estimated 92 matches for "buf_alloc".
2019 Oct 11
4
[PATCH v4 1/5] vsock/virtio: limit the memory used per-socket
...gt; avoid the starvation of others sockets.
> > The guests re-fill the "free" queue when the available buffers are
> > less than half.
> >
> > Each peer have these variables in the per-socket state:
> > /* local vars */
> > buf_alloc /* max bytes usable by this socket
> > [exposed to the other peer] */
> > fwd_cnt /* increased when RX packet is consumed by the
> > user space [exposed to the other peer] */
> > tx_cnt...
2019 Oct 11
4
[PATCH v4 1/5] vsock/virtio: limit the memory used per-socket
...gt; avoid the starvation of others sockets.
> > The guests re-fill the "free" queue when the available buffers are
> > less than half.
> >
> > Each peer have these variables in the per-socket state:
> > /* local vars */
> > buf_alloc /* max bytes usable by this socket
> > [exposed to the other peer] */
> > fwd_cnt /* increased when RX packet is consumed by the
> > user space [exposed to the other peer] */
> > tx_cnt...
2019 May 31
0
[PATCH v3 2/5] vsock/virtio: fix locking for fwd_cnt and buf_alloc
fwd_cnt is written with rx_lock, so we should read it using
the same spinlock also if we are in the TX path.
Move also buf_alloc under rx_lock and add a missing locking
when we modify it.
Signed-off-by: Stefano Garzarella <sgarzare at redhat.com>
---
include/linux/virtio_vsock.h | 2 +-
net/vmw_vsock/virtio_transport_common.c | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/includ...
2019 Jun 03
1
[PATCH v3 2/5] vsock/virtio: fix locking for fwd_cnt and buf_alloc
...te: Fri, 31 May 2019 15:39:51 +0200
> @@ -434,7 +434,9 @@ void virtio_transport_set_buffer_size(struct vsock_sock *vsk, u64 val)
> if (val > vvs->buf_size_max)
> vvs->buf_size_max = val;
> vvs->buf_size = val;
> + spin_lock_bh(&vvs->rx_lock);
> vvs->buf_alloc = val;
> + spin_unlock_bh(&vvs->rx_lock);
This locking doesn't do anything other than to strongly order the
buf_size store to occur before the buf_alloc one.
If you need a memory barrier, use one.
2019 Jul 17
1
[PATCH v4 3/5] vsock/virtio: fix locking in virtio_transport_inc_tx_pkt()
On Wed, Jul 17, 2019 at 01:30:28PM +0200, Stefano Garzarella wrote:
> fwd_cnt and last_fwd_cnt are protected by rx_lock, so we should use
> the same spinlock also if we are in the TX path.
>
> Move also buf_alloc under the same lock.
>
> Signed-off-by: Stefano Garzarella <sgarzare at redhat.com>
Wait a second is this a bugfix?
If it's used under the wrong lock won't values get corrupted?
Won't traffic then stall or more data get to sent than
credits?
> ---
> include/linux/v...
2019 Oct 11
0
[PATCH v4 1/5] vsock/virtio: limit the memory used per-socket
...f others sockets.
> > > The guests re-fill the "free" queue when the available buffers are
> > > less than half.
> > >
> > > Each peer have these variables in the per-socket state:
> > > /* local vars */
> > > buf_alloc /* max bytes usable by this socket
> > > [exposed to the other peer] */
> > > fwd_cnt /* increased when RX packet is consumed by the
> > > user space [exposed to the other peer] */
> > >...
2019 Oct 14
0
[PATCH v4 1/5] vsock/virtio: limit the memory used per-socket
...f others sockets.
> > > The guests re-fill the "free" queue when the available buffers are
> > > less than half.
> > >
> > > Each peer have these variables in the per-socket state:
> > > /* local vars */
> > > buf_alloc /* max bytes usable by this socket
> > > [exposed to the other peer] */
> > > fwd_cnt /* increased when RX packet is consumed by the
> > > user space [exposed to the other peer] */
> > >...
2019 Apr 04
1
[PATCH RFC 1/4] vsock/virtio: reduce credit update messages
...2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/include/linux/virtio_vsock.h b/include/linux/virtio_vsock.h
index e223e2632edd..6d7a22cc20bf 100644
--- a/include/linux/virtio_vsock.h
+++ b/include/linux/virtio_vsock.h
@@ -37,6 +37,7 @@ struct virtio_vsock_sock {
u32 tx_cnt;
u32 buf_alloc;
u32 peer_fwd_cnt;
+ u32 last_fwd_cnt;
u32 peer_buf_alloc;
/* Protected by rx_lock */
diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
index 602715fc9a75..f32301d823f5 100644
--- a/net/vmw_vsock/virtio_transport_common.c
+++ b/net/vmw_vsock/virt...
2019 Jul 17
22
[PATCH v4 0/5] vsock/virtio: optimizations to increase the throughput
...2 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.
v4:
- rebased all patches on current master (conflicts is Patch 4)
- Patch 1: added Stefan's R-b
- Patch 3: removed lock when buf_alloc is written [David];
moved this patch after "vsock/virtio: reduce credit update messages"
to make it clearer
- Patch 4: vhost_exceeds_weight() is recently introduced, so I've solved some
conflicts
v3: https://patchwork.kernel.org/cover/10970145
v2: ht...
2019 Jul 17
22
[PATCH v4 0/5] vsock/virtio: optimizations to increase the throughput
...2 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.
v4:
- rebased all patches on current master (conflicts is Patch 4)
- Patch 1: added Stefan's R-b
- Patch 3: removed lock when buf_alloc is written [David];
moved this patch after "vsock/virtio: reduce credit update messages"
to make it clearer
- Patch 4: vhost_exceeds_weight() is recently introduced, so I've solved some
conflicts
v3: https://patchwork.kernel.org/cover/10970145
v2: ht...
2016 Apr 12
0
[RFC v5 0/5] Add virtio transport for AF_VSOCK
...trace is of a simple request response (which both fit in one buffer in
each direction), the lines without an "?X:" prefix are my
annotations/guesses as to what is going on:
TX: =>SRC:00000002.00010002 DST:00000003.00000948
TX: LEN:00000000 TYPE:0001 OP:1=REQUEST
TX: FLAGS:00000000 BUF_ALLOC:00008000 FWD_CNT:00000000
TX: <=SRC:00000003.00000948 DST:00000002.00010002
TX: LEN:00000000 TYPE:0001 OP:2=RESPONSE
TX: FLAGS:00000000 BUF_ALLOC:00040000 FWD_CNT:00000000
REQUEST + RESPONSE == Channel open successfully
RX: =>SRC:00000002.00010002 DST:00000003.00000948
RX: LEN:0000005...
2019 Sep 03
2
[PATCH v4 2/5] vsock/virtio: reduce credit update messages
...virtio_vsock_sock *vvs,
> void virtio_transport_inc_tx_pkt(struct virtio_vsock_sock *vvs, struct virtio_vsock_pkt *pkt)
> {
> spin_lock_bh(&vvs->tx_lock);
> + vvs->last_fwd_cnt = vvs->fwd_cnt;
> pkt->hdr.fwd_cnt = cpu_to_le32(vvs->fwd_cnt);
> pkt->hdr.buf_alloc = cpu_to_le32(vvs->buf_alloc);
> spin_unlock_bh(&vvs->tx_lock);
> @@ -261,6 +262,7 @@ virtio_transport_stream_do_dequeue(struct vsock_sock *vsk,
> struct virtio_vsock_sock *vvs = vsk->trans;
> struct virtio_vsock_pkt *pkt;
> size_t bytes, total = 0;
> + u32 fr...
2019 Sep 03
2
[PATCH v4 2/5] vsock/virtio: reduce credit update messages
...virtio_vsock_sock *vvs,
> void virtio_transport_inc_tx_pkt(struct virtio_vsock_sock *vvs, struct virtio_vsock_pkt *pkt)
> {
> spin_lock_bh(&vvs->tx_lock);
> + vvs->last_fwd_cnt = vvs->fwd_cnt;
> pkt->hdr.fwd_cnt = cpu_to_le32(vvs->fwd_cnt);
> pkt->hdr.buf_alloc = cpu_to_le32(vvs->buf_alloc);
> spin_unlock_bh(&vvs->tx_lock);
> @@ -261,6 +262,7 @@ virtio_transport_stream_do_dequeue(struct vsock_sock *vsk,
> struct virtio_vsock_sock *vvs = vsk->trans;
> struct virtio_vsock_pkt *pkt;
> size_t bytes, total = 0;
> + u32 fr...
2019 Sep 01
0
[PATCH v4 1/5] vsock/virtio: limit the memory used per-socket
...m is per-socket, I think to
> avoid the starvation of others sockets.
> The guests re-fill the "free" queue when the available buffers are
> less than half.
>
> Each peer have these variables in the per-socket state:
> /* local vars */
> buf_alloc /* max bytes usable by this socket
> [exposed to the other peer] */
> fwd_cnt /* increased when RX packet is consumed by the
> user space [exposed to the other peer] */
> tx_cnt /* increased whe...
2019 Jul 17
0
[PATCH v4 3/5] vsock/virtio: fix locking in virtio_transport_inc_tx_pkt()
fwd_cnt and last_fwd_cnt are protected by rx_lock, so we should use
the same spinlock also if we are in the TX path.
Move also buf_alloc under the same lock.
Signed-off-by: Stefano Garzarella <sgarzare at redhat.com>
---
include/linux/virtio_vsock.h | 2 +-
net/vmw_vsock/virtio_transport_common.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/linux/virtio_vsock.h b/include/linux/v...
2019 Sep 02
1
[PATCH v4 1/5] vsock/virtio: limit the memory used per-socket
...t; avoid the starvation of others sockets.
> > The guests re-fill the "free" queue when the available buffers are
> > less than half.
> >
> > Each peer have these variables in the per-socket state:
> > /* local vars */
> > buf_alloc /* max bytes usable by this socket
> > [exposed to the other peer] */
> > fwd_cnt /* increased when RX packet is consumed by the
> > user space [exposed to the other peer] */
> > tx_cnt...
2016 Apr 12
2
[RFC v5 0/5] Add virtio transport for AF_VSOCK
On Mon, Apr 11, 2016 at 03:54:08PM +0300, Michael S. Tsirkin wrote:
> On Mon, Apr 11, 2016 at 11:45:48AM +0100, Stefan Hajnoczi wrote:
> > On Fri, Apr 08, 2016 at 04:35:05PM +0100, Ian Campbell wrote:
> > > On Fri, 2016-04-01 at 15:23 +0100, Stefan Hajnoczi wrote:
> > > > This series is based on Michael Tsirkin's vhost branch (v4.5-rc6).
> > > >
>
2016 Apr 12
2
[RFC v5 0/5] Add virtio transport for AF_VSOCK
On Mon, Apr 11, 2016 at 03:54:08PM +0300, Michael S. Tsirkin wrote:
> On Mon, Apr 11, 2016 at 11:45:48AM +0100, Stefan Hajnoczi wrote:
> > On Fri, Apr 08, 2016 at 04:35:05PM +0100, Ian Campbell wrote:
> > > On Fri, 2016-04-01 at 15:23 +0100, Stefan Hajnoczi wrote:
> > > > This series is based on Michael Tsirkin's vhost branch (v4.5-rc6).
> > > >
>
2019 May 31
7
[PATCH v3 0/5] vsock/virtio: optimizations to increase the throughput
...148.30 148.87 143.89 490.037
256K 148.90 152.77 149.37 528.606
512K 140.68 153.65 152.64 516.622
[1] https://github.com/stefano-garzarella/iperf/
Stefano Garzarella (5):
vsock/virtio: limit the memory used per-socket
vsock/virtio: fix locking for fwd_cnt and buf_alloc
vsock/virtio: reduce credit update messages
vhost/vsock: split packets to send using multiple buffers
vsock/virtio: change the maximum packet size allowed
drivers/vhost/vsock.c | 53 ++++++++++---
include/linux/virtio_vsock.h | 4 +-
net/vmw_vsock/virtio_tran...
2019 Oct 17
3
[PATCH net 0/2] vsock/virtio: make the credit mechanism more robust
This series makes the credit mechanism implemented in the
virtio-vsock devices more robust.
Patch 1 sends an update to the remote peer when the buf_alloc
change.
Patch 2 prevents a malicious peer (especially the guest) can
consume all the memory of the other peer, discarding packets
when the credit available is not respected.
Stefano Garzarella (2):
vsock/virtio: send a credit update when buffer size is changed
vsock/virtio: discard packets if...