From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:58122) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rcv9x-0007m9-7j for qemu-devel@nongnu.org; Tue, 20 Dec 2011 03:34:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rcv9v-0005Rp-KE for qemu-devel@nongnu.org; Tue, 20 Dec 2011 03:34:53 -0500 Received: from fmmailgate05.web.de ([217.72.192.243]:55310) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rcv9v-0005Ri-3I for qemu-devel@nongnu.org; Tue, 20 Dec 2011 03:34:51 -0500 Received: from moweb002.kundenserver.de (moweb002.kundenserver.de [172.19.20.108]) by fmmailgate05.web.de (Postfix) with ESMTP id 98530683158E for ; Tue, 20 Dec 2011 09:34:49 +0100 (CET) Message-ID: <4EF048A1.6070900@web.de> Date: Tue, 20 Dec 2011 09:34:41 +0100 From: Jan Kiszka MIME-Version: 1.0 References: <20111219211737.GA17469@amt.cnet> <4EEFB9AE.7050309@codemonkey.ws> <4EEFCD71.5040603@web.de> <4EEFD7A9.3050007@codemonkey.ws> <4EEFD8D1.3060707@web.de> <4EEFDFFE.6000402@codemonkey.ws> <4EEFE2BD.2090201@web.de> <4EEFF708.3010104@codemonkey.ws> <4EEFFC88.7010102@codemonkey.ws> In-Reply-To: <4EEFFC88.7010102@codemonkey.ws> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig379E428EFA3DB5D94215961B" Subject: Re: [Qemu-devel] [PATCH v5 00/16] uq/master: Introduce basic irqchip support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Lai Jiangshan , kvm@vger.kernel.org, "Michael S. Tsirkin" , Marcelo Tosatti , qemu-devel , Blue Swirl , Avi Kivity This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig379E428EFA3DB5D94215961B Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 2011-12-20 04:10, Anthony Liguori wrote: > 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 avo= id >> divergence if at all possible). >=20 > 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 QObje= ct. >=20 > The filters would get called with the QObject before it was decoded and= > dispatched to devices. It would look something like: >=20 > static QDict *kvm_apic_to_userspace_apic(QDict *state, void *opaque) > { > if (strcmp(qdict_get_str(state, "__type__"), "kvm-apic") { > QDict *userspace_apic =3D qdict_new(); > const char *key; >=20 > qdict_foreach_key(&key, state) { > QObject *value =3D qdict_get(state, key); >=20 > 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; > } > } >=20 > The same sort of filter function could also handle migration > compatibility between virtio-blk-pci and a pair of virtio-blk/virtio-pc= i > devices. It would simply match on the __type__ of "virtio-blk-pci", an= d > then split apart the state into an appropriate "virtio-pci" dictionary > and a "virtio-blk" dictionary. >=20 > 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. Another approach, which also solves an issue the above does not, go like this: Use some device alias as name fore saving, and also accept this for addressing the device in a running VM. The latter would allow for /path/to/the/ioapic to always point you to the currently used IOAPIC version, no matter if it is actually kvm-ioapic or [qemu-]ioapic. This feature was requested by Avi back then. It doesn't map to existing features directly, though. In any case, I'm not going to touch a line of code until there is consensus about the way to go. Jan --------------enig379E428EFA3DB5D94215961B Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk7wSKUACgkQitSsb3rl5xQQZACgj6das5buSv3x4oyr1XGAV1Kc OakAnjeySMm7KeTtUqv5Xq3cHDJkLvDL =TqpP -----END PGP SIGNATURE----- --------------enig379E428EFA3DB5D94215961B--