Netdev List
 help / color / mirror / Atom feed
From: Stefano Garzarella <sgarzare@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: netdev@vger.kernel.org, Jason Wang <jasowang@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	kvm@vger.kernel.org, virtualization@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH RFC 3/4] vsock/virtio: change the maximum packet size allowed
Date: Fri, 5 Apr 2019 12:07:47 +0200	[thread overview]
Message-ID: <20190405100747.dbwi3sjaudp3d2wa@steredhat> (raw)
In-Reply-To: <20190405082447.GD25152@stefanha-x1.localdomain>

On Fri, Apr 05, 2019 at 09:24:47AM +0100, Stefan Hajnoczi wrote:
> On Thu, Apr 04, 2019 at 12:58:37PM +0200, Stefano Garzarella wrote:
> > Since now we are able to split packets, we can avoid limiting
> > their sizes to VIRTIO_VSOCK_DEFAULT_RX_BUF_SIZE.
> > Instead, we can use VIRTIO_VSOCK_MAX_PKT_BUF_SIZE as the max
> > packet size.
> > 
> > Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
> > ---
> >  net/vmw_vsock/virtio_transport_common.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
> > index f32301d823f5..822e5d07a4ec 100644
> > --- a/net/vmw_vsock/virtio_transport_common.c
> > +++ b/net/vmw_vsock/virtio_transport_common.c
> > @@ -167,8 +167,8 @@ static int virtio_transport_send_pkt_info(struct vsock_sock *vsk,
> >  	vvs = vsk->trans;
> >  
> >  	/* we can send less than pkt_len bytes */
> > -	if (pkt_len > VIRTIO_VSOCK_DEFAULT_RX_BUF_SIZE)
> > -		pkt_len = VIRTIO_VSOCK_DEFAULT_RX_BUF_SIZE;
> > +	if (pkt_len > VIRTIO_VSOCK_MAX_PKT_BUF_SIZE)
> > +		pkt_len = VIRTIO_VSOCK_MAX_PKT_BUF_SIZE;
> 
> The next line limits pkt_len based on available credits:
> 
>   /* virtio_transport_get_credit might return less than pkt_len credit */
>   pkt_len = virtio_transport_get_credit(vvs, pkt_len);
> 
> I think drivers/vhost/vsock.c:vhost_transport_do_send_pkt() now works
> correctly even with pkt_len > VIRTIO_VSOCK_MAX_PKT_BUF_SIZE.

Correct.

> 
> The other ->send_pkt() callback is
> net/vmw_vsock/virtio_transport.c:virtio_transport_send_pkt_work() and it
> can already send any size packet.
> 
> Do you remember why VIRTIO_VSOCK_MAX_PKT_BUF_SIZE still needs to be the
> limit?  I'm wondering if we can get rid of it now and just limit packets
> to the available credits.

There are 2 reasons why I left this limit:
1. When the host receives a packets, it must be <=
   VIRTIO_VSOCK_MAX_PKT_BUF_SIZE [drivers/vhost/vsock.c:vhost_vsock_alloc_pkt()]
   So in this way we can limit the packets sent from the guest.

2. When the host send packets, it help us to increase the parallelism
   (especially if the guest has 64 KB RX buffers) because the user thread
   will split packets, calling multiple times transport->stream_enqueue()
   in net/vmw_vsock/af_vsock.c:vsock_stream_sendmsg() while the
   vhost_transport_send_pkt_work() send them to the guest.


Do you think make sense?

Thanks,
Stefano

  reply	other threads:[~2019-04-05 10:07 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-04 10:58 [PATCH RFC 0/4] vsock/virtio: optimizations to increase the throughput Stefano Garzarella
2019-04-04 10:58 ` [PATCH RFC 1/4] vsock/virtio: reduce credit update messages Stefano Garzarella
2019-04-04 19:15   ` Stefan Hajnoczi
2019-04-05  8:16     ` Stefano Garzarella
2019-04-08  9:25       ` Stefan Hajnoczi
2019-04-04 10:58 ` [PATCH RFC 2/4] vhost/vsock: split packets to send using multiple buffers Stefano Garzarella
2019-04-05  8:13   ` Stefan Hajnoczi
2019-04-05  9:36     ` Stefano Garzarella
2019-04-08  9:28       ` Stefan Hajnoczi
2019-04-04 10:58 ` [PATCH RFC 3/4] vsock/virtio: change the maximum packet size allowed Stefano Garzarella
2019-04-05  8:24   ` Stefan Hajnoczi
2019-04-05 10:07     ` Stefano Garzarella [this message]
2019-04-08  9:37       ` Stefan Hajnoczi
2019-04-08 14:55         ` Stefano Garzarella
2019-04-08 14:57           ` Michael S. Tsirkin
2019-04-08 15:17             ` Stefano Garzarella
2019-04-08 15:45               ` Stefan Hajnoczi
2019-04-04 10:58 ` [PATCH RFC 4/4] vsock/virtio: increase RX buffer size to 64 KiB Stefano Garzarella
2019-04-05  8:44   ` Stefan Hajnoczi
2019-04-08  6:35     ` Jason Wang
2019-04-04 14:14 ` [PATCH RFC 0/4] vsock/virtio: optimizations to increase the throughput Stefan Hajnoczi
2019-04-04 15:44   ` Stefano Garzarella
2019-04-04 15:52 ` Michael S. Tsirkin
2019-04-04 16:47   ` Stefano Garzarella
2019-04-04 18:04     ` Michael S. Tsirkin
2019-04-05  7:49       ` Stefano Garzarella
2019-04-08  9:23         ` Stefan Hajnoczi
2019-04-08  6:43 ` Jason Wang
2019-04-08  9:44   ` Stefan Hajnoczi
2019-04-09  8:36     ` Jason Wang
2019-04-09  9:13   ` 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=20190405100747.dbwi3sjaudp3d2wa@steredhat \
    --to=sgarzare@redhat.com \
    --cc=davem@davemloft.net \
    --cc=jasowang@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=stefanha@gmail.com \
    --cc=stefanha@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    /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