qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Avi Kivity <avi@cloudius-systems.com>
Cc: Jason Wang <jasowang@redhat.com>,
	qemu-devel@nongnu.org, liuyongan@huawei.com,
	qinchuanyu@huawei.com, "Zhangjie (HZ)" <zhangjie14@huawei.com>,
	akong@redhat.com
Subject: Re: [Qemu-devel] [QA-virtio]:Why vring size is limited to 1024?
Date: Wed, 8 Oct 2014 13:55:15 +0300	[thread overview]
Message-ID: <20141008105515.GA4429@redhat.com> (raw)
In-Reply-To: <543513E5.8010507@cloudius-systems.com>

On Wed, Oct 08, 2014 at 01:37:25PM +0300, Avi Kivity wrote:
> 
> On 10/08/2014 01:14 PM, Michael S. Tsirkin wrote:
> >On Wed, Oct 08, 2014 at 12:51:21PM +0300, Avi Kivity wrote:
> >>On 10/08/2014 12:15 PM, Michael S. Tsirkin wrote:
> >>>On Wed, Oct 08, 2014 at 10:43:07AM +0300, Avi Kivity wrote:
> >>>>On 09/30/2014 12:33 PM, Michael S. Tsirkin wrote:
> >>>>>a single descriptor might use all of
> >>>>>the virtqueue. In this case we wont to be able to pass the
> >>>>>descriptor directly to linux as a single iov, since
> >>>>>
> >>>>You could separate maximum request scatter/gather list size from the
> >>>>virtqueue size.  They are totally unrelated - even now you can have a larger
> >>>>request by using indirect descriptors.
> >>>We could add a feature to have a smaller or larger S/G length limit.
> >>>Is this something useful?
> >>>
> >>Having a larger ring size is useful, esp. with zero-copy transmit, and you
> >>would need the sglist length limit in order to not require linearization on
> >>linux hosts.  So the limit is not useful in itself, only indirectly.
> >>
> >>Google cloud engine exposes virtio ring sizes of 16384.
> >OK this sounds useful, I'll queue this up for consideration.
> >Thanks!
> 
> Thanks.
> 
> >>Even more useful is getting rid of the desc array and instead passing descs
> >>inline in avail and used.
> >You expect this to improve performance?
> >Quite possibly but this will have to be demonstrated.
> >
> 
> The top vhost function in small packet workloads is vhost_get_vq_desc, and
> the top instruction within that (50%) is the one that reads the first 8
> bytes of desc.  It's a guaranteed cache line miss (and again on the guest
> side when it's time to reuse).

OK so basically what you are pointing out is that we get 5 accesses:
read of available head, read of available ring, read of descriptor,
write of used ring, write of used ring head.

If processing is in-order, we could build a much simpler design, with a
valid bit in the descriptor, cleared by host as descriptors are
consumed.

Basically get rid of both used and available ring.

Sounds good in theory.

> Inline descriptors will amortize the cache miss over 4 descriptors, and will
> allow the hardware to prefetch, since the descriptors are linear in memory.

If descriptors are used in order (as they are with current qemu)
then aren't they amortized already?

-- 
MST

  reply	other threads:[~2014-10-08 10:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-30  8:36 [Qemu-devel] [QA-virtio]:Why vring size is limited to 1024? Zhangjie (HZ)
2014-09-30  9:33 ` Michael S. Tsirkin
2014-10-08  7:17   ` Zhangjie (HZ)
2014-10-08  7:37     ` Michael S. Tsirkin
2014-10-08  8:07       ` Zhangjie (HZ)
2014-10-08  9:13         ` Michael S. Tsirkin
2014-10-08  7:43   ` Avi Kivity
2014-10-08  8:26     ` Zhangjie (HZ)
2014-10-08  9:15     ` Michael S. Tsirkin
2014-10-08  9:51       ` Avi Kivity
2014-10-08 10:14         ` Michael S. Tsirkin
2014-10-08 10:37           ` Avi Kivity
2014-10-08 10:55             ` Michael S. Tsirkin [this message]
2014-10-08 10:59               ` Avi Kivity
2014-10-08 12:22                 ` Michael S. Tsirkin
2014-10-08 12:28                   ` Avi Kivity
2014-10-08 12:36                     ` Avi Kivity
2014-10-08 11:00               ` Avi Kivity

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=20141008105515.GA4429@redhat.com \
    --to=mst@redhat.com \
    --cc=akong@redhat.com \
    --cc=avi@cloudius-systems.com \
    --cc=jasowang@redhat.com \
    --cc=liuyongan@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qinchuanyu@huawei.com \
    --cc=zhangjie14@huawei.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 NNTP newsgroup(s).