From: Paolo Abeni <pabeni@redhat.com>
To: Luigi Leonardi <luigi.leonardi@outlook.com>,
mst@redhat.com, xuanzhuo@linux.alibaba.com,
virtualization@lists.linux.dev, sgarzare@redhat.com,
netdev@vger.kernel.org, kuba@kernel.org, stefanha@redhat.com,
davem@davemloft.net, edumazet@google.com, kvm@vger.kernel.org,
jasowang@redhat.com
Subject: Re: [PATCH net-next v2 2/3] vsock/virtio: add SIOCOUTQ support for all virtio based transports
Date: Thu, 11 Apr 2024 09:09:49 +0200 [thread overview]
Message-ID: <c18d4b9220a85f8087eda15526771dac5f8b4c0a.camel@redhat.com> (raw)
In-Reply-To: <AS2P194MB2170FDCADD288267B874B6AC9A002@AS2P194MB2170.EURP194.PROD.OUTLOOK.COM>
On Mon, 2024-04-08 at 15:37 +0200, Luigi Leonardi wrote:
> This patch introduce support for stream_bytes_unsent and
> seqpacket_bytes_unsent ioctl for virtio_transport, vhost_vsock
> and vsock_loopback.
>
> For all transports the unsent bytes counter is incremented
> in virtio_transport_send_pkt_info.
>
> In the virtio_transport (G2H) the counter is decremented each time the host
> notifies the guest that it consumed the skbuffs.
> In vhost-vsock (H2G) the counter is decremented after the skbuff is queued
> in the virtqueue.
> In vsock_loopback the counter is decremented after the skbuff is
> dequeued.
>
> Signed-off-by: Luigi Leonardi <luigi.leonardi@outlook.com>
I think this deserve an explicit ack from Stefano, and Stefano can't
review patches in the next few weeks. If it's not urgent this will have
to wait a bit.
> ---
> drivers/vhost/vsock.c | 4 ++-
> include/linux/virtio_vsock.h | 7 ++++++
> net/vmw_vsock/virtio_transport.c | 4 ++-
> net/vmw_vsock/virtio_transport_common.c | 33 +++++++++++++++++++++++++
> net/vmw_vsock/vsock_loopback.c | 7 ++++++
> 5 files changed, 53 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c
> index ec20ecff85c7..dba8b3ea37bf 100644
> --- a/drivers/vhost/vsock.c
> +++ b/drivers/vhost/vsock.c
> @@ -244,7 +244,7 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock,
> restart_tx = true;
> }
>
> - consume_skb(skb);
> + virtio_transport_consume_skb_sent(skb, true);
> }
> } while(likely(!vhost_exceeds_weight(vq, ++pkts, total_len)));
> if (added)
> @@ -451,6 +451,8 @@ static struct virtio_transport vhost_transport = {
> .notify_buffer_size = virtio_transport_notify_buffer_size,
> .notify_set_rcvlowat = virtio_transport_notify_set_rcvlowat,
>
> + .unsent_bytes = virtio_transport_bytes_unsent,
> +
> .read_skb = virtio_transport_read_skb,
> },
>
> diff --git a/include/linux/virtio_vsock.h b/include/linux/virtio_vsock.h
> index c82089dee0c8..dbb22d45d203 100644
> --- a/include/linux/virtio_vsock.h
> +++ b/include/linux/virtio_vsock.h
> @@ -134,6 +134,8 @@ struct virtio_vsock_sock {
> u32 peer_fwd_cnt;
> u32 peer_buf_alloc;
>
> + atomic_t bytes_unsent;
This will add 2 atomic operations per packet, possibly on contended
cachelines. Have you considered leveraging the existing transport-level
lock to protect the counter updates?
Thanks
Paolo
next prev parent reply other threads:[~2024-04-11 7:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20240408133749.510520-1-luigi.leonardi@outlook.com>
2024-04-08 13:37 ` [PATCH net-next v2 1/3] vsock: add support for SIOCOUTQ ioctl for all vsock socket types Luigi Leonardi
2024-05-08 8:22 ` Stefano Garzarella
2024-04-08 13:37 ` [PATCH net-next v2 2/3] vsock/virtio: add SIOCOUTQ support for all virtio based transports Luigi Leonardi
2024-04-11 7:09 ` Paolo Abeni [this message]
2024-05-07 10:11 ` Stefano Garzarella
2024-04-08 13:37 ` [PATCH net-next v2 3/3] test/vsock: add ioctl unsent bytes test Luigi Leonardi
2024-05-08 10:08 ` Stefano Garzarella
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c18d4b9220a85f8087eda15526771dac5f8b4c0a.camel@redhat.com \
--to=pabeni@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jasowang@redhat.com \
--cc=kuba@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=luigi.leonardi@outlook.com \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=sgarzare@redhat.com \
--cc=stefanha@redhat.com \
--cc=virtualization@lists.linux.dev \
--cc=xuanzhuo@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).