From: "Michael S. Tsirkin" <mst@redhat.com>
To: Will Deacon <will.deacon@arm.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
Sasha Levin <sasha.levin@oracle.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"penberg@kernel.org" <penberg@kernel.org>,
Marc Zyngier <Marc.Zyngier@arm.com>
Subject: Re: virtio-net mq vq initialization (was: [PATCH 0/5] Usual batch of random ARM fixes for kvmtool)
Date: Sun, 14 Apr 2013 13:03:21 +0300 [thread overview]
Message-ID: <20130414100321.GC2548@redhat.com> (raw)
In-Reply-To: <20130412124158.GG12363@mudshark.cambridge.arm.com>
On Fri, Apr 12, 2013 at 01:41:58PM +0100, Will Deacon wrote:
> Hi Rusty,
>
> On Fri, Apr 12, 2013 at 12:36:00PM +0100, Rusty Russell wrote:
> > I'm confused. kvmtool is using too much memory, or the guest? If
> > kvmtool, the Device Initialization section above applies to the driver,
> > not the device. If the guest, well, the language says "UP TO N+1". You
> > want a small guest, don't use them all. Or any...
> >
> > What am I missing?
>
> I don't think you're missing anything. The memory usage is in the guest, not
> kvmtool. If, as you suggest, the spec doesn't mandate greedy initialisation
> of all the virtqueues, then it sounds like a bug in Linux.
>
> Looking at virtio_mmio.c:
>
> /* Allocate pages for the queue - start with a queue as big as
> * possible (limited by maximum size allowed by device), drop down
> * to a minimal size, just big enough to fit descriptor table
> * and two rings (which makes it "alignment_size * 2")
> */
> info->num = readl(vm_dev->base + VIRTIO_MMIO_QUEUE_NUM_MAX);
>
> /* If the device reports a 0 entry queue, we won't be able to
> * use it to perform I/O, and vring_new_virtqueue() can't create
> * empty queues anyway, so don't bother to set up the device.
> */
> if (info->num == 0) {
> err = -ENOENT;
> goto error_alloc_pages;
> }
>
> while (1) {
> size = PAGE_ALIGN(vring_size(info->num,
> VIRTIO_MMIO_VRING_ALIGN));
> /* Did the last iter shrink the queue below minimum size? */
> if (size < VIRTIO_MMIO_VRING_ALIGN * 2) {
> err = -ENOMEM;
> goto error_alloc_pages;
> }
>
> info->queue = alloc_pages_exact(size, GFP_KERNEL | __GFP_ZERO);
> if (info->queue)
> break;
>
> info->num /= 2;
> }
>
> so, although there is some back-off if the allocation fails, it doesn't really
> help userspace when there is enough memory for the maximal buffers, but not
> a lot else.
>
> Will
Well, that's just a couple of pages per virtqueue. How many of these do
you have?
--
MST
next prev parent reply other threads:[~2013-04-14 10:03 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-11 16:36 [PATCH 0/5] Usual batch of random ARM fixes for kvmtool Will Deacon
2013-04-11 16:36 ` [PATCH 1/5] kvm tools: arm: don't crash when no compatible CPU is found Will Deacon
2013-04-11 16:36 ` [PATCH 2/5] kvm tools: arm: add CPU compatible string to target structure Will Deacon
2013-04-11 16:36 ` [PATCH 3/5] kvm tools: arm: consolidate CPU node generation Will Deacon
2013-04-11 16:36 ` [PATCH 4/5] kvm tools: arm64: add support for AEM and Foundation models Will Deacon
2013-04-11 16:36 ` [PATCH 5/5] kvm tools: bump number of virtio MMIO vqueues Will Deacon
2013-04-11 16:45 ` [PATCH 0/5] Usual batch of random ARM fixes for kvmtool Sasha Levin
2013-04-12 6:52 ` Pekka Enberg
2013-04-12 8:30 ` Marc Zyngier
2013-04-12 8:50 ` Will Deacon
2013-04-11 20:02 ` virtio-net mq vq initialization (was: [PATCH 0/5] Usual batch of random ARM fixes for kvmtool) Sasha Levin
2013-04-12 11:36 ` Rusty Russell
2013-04-12 12:41 ` Will Deacon
2013-04-14 10:03 ` Michael S. Tsirkin [this message]
2013-04-13 21:23 ` virtio-net mq vq initialization Sasha Levin
2013-04-14 10:01 ` Michael S. Tsirkin
2013-04-14 15:16 ` Sasha Levin
2013-04-14 15:53 ` Michael S. Tsirkin
2013-04-14 15:59 ` Sasha Levin
2013-04-14 18:35 ` Michael S. Tsirkin
2013-04-15 2:55 ` Rusty Russell
2013-04-15 5:58 ` Jason Wang
2013-04-22 18:32 ` Sasha Levin
2013-04-12 7:12 ` [PATCH 0/5] Usual batch of random ARM fixes for kvmtool Pekka Enberg
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=20130414100321.GC2548@redhat.com \
--to=mst@redhat.com \
--cc=Marc.Zyngier@arm.com \
--cc=kvm@vger.kernel.org \
--cc=penberg@kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=sasha.levin@oracle.com \
--cc=will.deacon@arm.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