From: Gleb Natapov <gleb@redhat.com>
To: Juan Quintela <quintela@redhat.com>
Cc: qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>
Subject: [Qemu-devel] Re: optional feature
Date: Wed, 16 Sep 2009 14:18:45 +0300 [thread overview]
Message-ID: <20090916111845.GJ23157@redhat.com> (raw)
In-Reply-To: <m34or3up58.fsf@neno.mitica>
On Wed, Sep 16, 2009 at 01:04:19PM +0200, Juan Quintela wrote:
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
> > On Wed, Sep 09, 2009 at 10:47:27AM +0200, Juan Quintela wrote:
> >> How do we deal with optional features?
> >
> > Here's an idea that Gleb suggested in a private
> > conversation: make optional features into
> > separate, non-user-visible devices.
> >
> > Thus we would have vmstate for virtio and additionally, if msix is
> > enabled, vmstate for msix. This solves the problem of the number of
> > devices becoming exponential with the number of features: we have device
> > per feature.
> >
> > I understand that RTC does something like this.
>
> And it is wrong :) I sent a patch to fix it properly, but we have the
> problem of backward compatibility with kvm.
>
> Forget msix for virtio, virtio has the problem already with pci.
What is wrong about it?
>
> virtio_save()
> {
>
> if (vdev->binding->save_config)
> vdev->binding->save_config(vdev->binding_opaque, f);
>
> qemu_put_8s(f, &vdev->status);
>
> .... some other normal fields ...
>
> for (i = 0; i < VIRTIO_PCI_QUEUE_MAX; i++) {
> if (vdev->vq[i].vring.num == 0)
> break;
>
> Not a problem, we can precalculate i on pre_save()
>
>
> qemu_put_be32(f, vdev->vq[i].vring.num);
> qemu_put_be64(f, vdev->vq[i].pa);
> qemu_put_be16s(f, &vdev->vq[i].last_avail_idx);
>
> This is sending a partial array of struct (the "i" 1st entries)
> No problem here.
>
> if (vdev->binding->save_queue)
> vdev->binding->save_queue(vdev->binding_opaque, i, f);
>
> Again, what to do with this one.
>
> }
>
> }
>
> Looking at what does virtio_pci_save_queue()
>
> static void virtio_pci_save_queue(void * opaque, int n, QEMUFile *f)
> {
> VirtIOPCIProxy *proxy = opaque;
> if (msix_present(&proxy->pci_dev))
> qemu_put_be16(f, virtio_queue_vector(proxy->vdev, n));
> }
>
> i.e. and now, an optional field.
>
> And no, I don't have either a clean design that will be backward
> compatible and clean. Clean design is easy:
>
> virtio
> virtio-pci (it does the equivalent of save_config() and then call
> virtio_save)
> virtio-pci-msix (it calls virtio-pci and then send a partial array of
> queues. (the save queue thing)
>
> Before you ask, partial arrays are sent: <num_elems> + array
> where num_elems == 0 is valid.
>
> But this is the "good" design if we started _now_, that is not the case,
> and I am trying to get something clean and bacward compatible.
>
> Later, Juan.
>
> PD. Optional fields are going to have to be in, arm cpus really need
> them if we want to maintain backward compatibility.
--
Gleb.
next prev parent reply other threads:[~2009-09-16 11:18 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-16 10:46 [Qemu-devel] optional feature (was Re: The State of the SaveVM format) Michael S. Tsirkin
2009-09-16 11:04 ` [Qemu-devel] Re: optional feature Juan Quintela
2009-09-16 11:18 ` Gleb Natapov [this message]
2009-09-16 11:48 ` Juan Quintela
2009-09-16 11:52 ` Michael S. Tsirkin
2009-09-16 12:14 ` Juan Quintela
2009-09-16 12:18 ` Michael S. Tsirkin
2009-09-16 12:26 ` Juan Quintela
2009-09-16 12:37 ` Michael S. Tsirkin
2009-09-16 13:01 ` Juan Quintela
2009-09-16 13:03 ` Michael S. Tsirkin
2009-09-16 13:34 ` Juan Quintela
2009-09-16 14:02 ` Michael S. Tsirkin
2009-09-16 11:57 ` Gleb Natapov
2009-09-16 12:23 ` Juan Quintela
2009-09-16 12:35 ` Gleb Natapov
2009-09-16 12:40 ` Michael S. Tsirkin
2009-09-16 13:22 ` Juan Quintela
2009-09-16 14:08 ` Anthony Liguori
2009-09-16 14:12 ` Michael S. Tsirkin
2009-09-16 14:21 ` Anthony Liguori
2009-09-16 14:34 ` Michael S. Tsirkin
2009-09-16 14:53 ` Juan Quintela
2009-09-16 15:11 ` Michael S. Tsirkin
2009-09-16 15:25 ` Juan Quintela
2009-09-16 15:45 ` Anthony Liguori
2009-09-16 15:58 ` Anthony Liguori
2009-09-16 13:51 ` Anthony Liguori
2009-09-16 11:41 ` Michael S. Tsirkin
2009-09-16 12:13 ` Juan Quintela
2009-09-16 12:29 ` Michael S. Tsirkin
2009-09-16 13:31 ` Juan Quintela
2009-09-16 14:07 ` Michael S. Tsirkin
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=20090916111845.GJ23157@redhat.com \
--to=gleb@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.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).