qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Jan Kiszka <jan.kiszka@web.de>
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>,
	kvm@vger.kernel.org, "Michael S. Tsirkin" <mst@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	qemu-devel <qemu-devel@nongnu.org>,
	Blue Swirl <blauwirbel@gmail.com>, Avi Kivity <avi@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v5 00/16] uq/master: Introduce basic irqchip support
Date: Mon, 19 Dec 2011 21:10:00 -0600	[thread overview]
Message-ID: <4EEFFC88.7010102@codemonkey.ws> (raw)
In-Reply-To: <4EEFF708.3010104@codemonkey.ws>

On 12/19/2011 08:46 PM, Anthony Liguori wrote:
> On 12/19/2011 07:19 PM, Jan Kiszka wrote:
>> On 2011-12-20 02:08, Anthony Liguori wrote:
> Here's how we solve this problem:
>
> 1) In the short term, advertise both devices as having the same VMstate name.
> Since we don't register until the device is instantiated, this will Just Work
> and is easy.
>
> 2) In the not so short term, we'll have Mike Roth's Visitor series land in the
> tree (Juan promised me it will be in his next pull request).
>
> 3) Once we have the Visitor infrastructure in place, we can introduce a self
> describing migration format (that will also use QOM path names). With a self
> describing format, we can read all of the data from the wire into memory without
> consulting devices.
>
> 4) We now have the ability to arbitrarily manipulate this tree in memory. It's
> just a matter or writing a small tree transformer that converts the KVM-APIC
> state to the APIC device state (by just renaming a level of the tree). Heck, we
> could even map fields if we needed to (although we should probably avoid
> divergence if at all possible).

The way this would is that something would register a migration "filter" when a 
userspace APIC was instantiated.  Maybe that's the device itself or maybe it's 
some centralized logic.  At any rate, since we have a self-describing format 
(and maybe it's just JSON), we can build a QObject.

The filters would get called with the QObject before it was decoded and 
dispatched to devices.  It would look something like:

static QDict *kvm_apic_to_userspace_apic(QDict *state, void *opaque)
{
    if (strcmp(qdict_get_str(state, "__type__"), "kvm-apic") {
       QDict *userspace_apic = qdict_new();
       const char *key;

       qdict_foreach_key(&key, state) {
           QObject *value = qdict_get(state, key);

           qobject_incref(value);
           qdict_put_obj(userspace_apic, key, value);
       }
       qdict_put_str(userspace_apic, "__type__", "apic");
       return userspace_apic;
    } else {
       qobject_incref(state);
       return state;
    }
}

The same sort of filter function could also handle migration compatibility 
between virtio-blk-pci and a pair of virtio-blk/virtio-pci devices.  It would 
simply match on the __type__ of "virtio-blk-pci", and then split apart the state 
into an appropriate "virtio-pci" dictionary and a "virtio-blk" dictionary.

This is just psuedo-code mind you.  We'll need to think carefully about how we 
recurse and apply these filters.  But it will be an extremely powerful mechanism 
that will let us solve most of these compatibility problems in an elegant way.

Regards,

Anthony Liguori

>
> 5) We can now hand this manipulated tree to an input Visitor and the devices
> will read it in as if it came from the same device.
>
> This is the level of flexibility we need to support migration compatibility
> moving forward. We're actually not that far from it either. We'll definitely
> have it in place before we have a new migration protocol.
>
> Regards,
>
> Anthony Liguori
>
>>
>> Jan
>>
>

  reply	other threads:[~2011-12-20  3:10 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-15 12:33 [Qemu-devel] [PATCH v5 00/16] uq/master: Introduce basic irqchip support Jan Kiszka
2011-12-15 12:33 ` [Qemu-devel] [PATCH v5 01/16] msi: Generalize msix_supported to msi_supported Jan Kiszka
2011-12-15 12:33 ` [Qemu-devel] [PATCH v5 02/16] kvm: Move kvmclock into hw/kvm folder Jan Kiszka
2011-12-15 12:33 ` [Qemu-devel] [PATCH v5 03/16] apic: Stop timer on reset Jan Kiszka
2011-12-15 12:33 ` [Qemu-devel] [PATCH v5 04/16] apic: Inject external NMI events via LINT1 Jan Kiszka
2011-12-15 12:33 ` [Qemu-devel] [PATCH v5 05/16] apic: Introduce apic_report_irq_delivered Jan Kiszka
2011-12-15 12:33 ` [Qemu-devel] [PATCH v5 06/16] apic: Introduce backend/frontend infrastructure for KVM reuse Jan Kiszka
2011-12-19 22:14   ` Anthony Liguori
2011-12-19 23:32     ` Jan Kiszka
2011-12-20  0:28       ` Anthony Liguori
2011-12-20  0:32         ` Jan Kiszka
2011-12-20  0:38           ` Anthony Liguori
2011-12-20  9:56             ` Avi Kivity
2011-12-20 13:41               ` Anthony Liguori
2011-12-20 13:51                 ` Paolo Bonzini
2011-12-20 13:54                   ` Anthony Liguori
2011-12-20 13:57                     ` Paolo Bonzini
2011-12-20 14:07                       ` Anthony Liguori
2011-12-20 17:02                         ` Jan Kiszka
2011-12-20 19:14                           ` Anthony Liguori
2011-12-20 21:23                             ` Jan Kiszka
2011-12-20 21:38                               ` Anthony Liguori
2011-12-20 21:45                                 ` Jan Kiszka
2011-12-20 21:55                                   ` Anthony Liguori
2011-12-20 22:20                                     ` Jan Kiszka
2011-12-20 23:41                                       ` Anthony Liguori
2011-12-20 23:45                                         ` Jan Kiszka
2011-12-20 14:07                   ` Avi Kivity
2011-12-15 12:33 ` [Qemu-devel] [PATCH v5 07/16] apic: Open-code timer save/restore Jan Kiszka
2011-12-19 22:21   ` Anthony Liguori
2011-12-19 23:45     ` Jan Kiszka
2011-12-20  0:31       ` Anthony Liguori
2011-12-20  0:34         ` Jan Kiszka
2011-12-20  0:53           ` Anthony Liguori
2011-12-20  1:24             ` Jan Kiszka
2011-12-15 12:33 ` [Qemu-devel] [PATCH v5 08/16] i8259: Introduce backend/frontend infrastructure for KVM reuse Jan Kiszka
2011-12-15 12:33 ` [Qemu-devel] [PATCH v5 09/16] ioapic: " Jan Kiszka
2011-12-15 12:33 ` [Qemu-devel] [PATCH v5 10/16] memory: Introduce memory_region_init_reservation Jan Kiszka
2011-12-15 12:33 ` [Qemu-devel] [PATCH v5 11/16] kvm: Introduce core services for in-kernel irqchip support Jan Kiszka
2011-12-15 12:33 ` [Qemu-devel] [PATCH v5 12/16] kvm: x86: Establish IRQ0 override control Jan Kiszka
2011-12-15 12:33 ` [Qemu-devel] [PATCH v5 13/16] kvm: x86: Add user space part for in-kernel APIC Jan Kiszka
2011-12-15 12:33 ` [Qemu-devel] [PATCH v5 14/16] kvm: x86: Add user space part for in-kernel i8259 Jan Kiszka
2011-12-15 12:33 ` [Qemu-devel] [PATCH v5 15/16] kvm: x86: Add user space part for in-kernel IOAPIC Jan Kiszka
2011-12-15 12:33 ` [Qemu-devel] [PATCH v5 16/16] kvm: Arm in-kernel irqchip support Jan Kiszka
2011-12-19 21:17 ` [Qemu-devel] [PATCH v5 00/16] uq/master: Introduce basic " Marcelo Tosatti
2011-12-19 22:24   ` Anthony Liguori
2011-12-19 23:49     ` Jan Kiszka
2011-12-20  0:32       ` Anthony Liguori
2011-12-20  0:37         ` Jan Kiszka
2011-12-20  0:42           ` Anthony Liguori
2011-12-20 10:01             ` Avi Kivity
2011-12-20  1:08           ` Anthony Liguori
2011-12-20  1:19             ` Jan Kiszka
2011-12-20  1:28               ` Jan Kiszka
2011-12-20  2:46               ` Anthony Liguori
2011-12-20  3:10                 ` Anthony Liguori [this message]
2011-12-20  8:34                   ` Jan Kiszka
2011-12-20 10:03                 ` Avi Kivity
2011-12-20 10:08                   ` Avi Kivity
2011-12-20 13:45                     ` Anthony Liguori

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=4EEFFC88.7010102@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=avi@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=jan.kiszka@web.de \
    --cc=kvm@vger.kernel.org \
    --cc=laijs@cn.fujitsu.com \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).