All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Alexander Graf <agraf@suse.de>, qemu-devel@nongnu.org
Cc: amit.shah@redhat.com, pbonzini@redhat.com, afaerber@suse.de,
	quintela@redhat.com
Subject: Re: [Qemu-devel] [PATCH v3 4/5] migration: Append JSON description of migration stream
Date: Tue, 06 Jan 2015 08:56:07 -0700	[thread overview]
Message-ID: <54AC0597.8020009@redhat.com> (raw)
In-Reply-To: <1419604968-87437-5-git-send-email-agraf@suse.de>

[-- Attachment #1: Type: text/plain, Size: 3052 bytes --]

On 12/26/2014 07:42 AM, Alexander Graf wrote:
> One of the annoyances of the current migration format is the fact that
> it's not self-describing. In fact, it's not properly describing at all.
> Some code randomly scattered throughout QEMU elaborates roughly how to
> read and write a stream of bytes.
> 
> We discussed an idea during KVM Forum 2013 to add a JSON description of
> the migration protocol itself to the migration stream. This patch
> adds a section after the VM_END migration end marker that contains
> description data on what the device sections of the stream are composed of.
> 
> With an additional external program this allows us to decipher the
> contents of any migration stream and hopefully make migration bugs easier
> to track down.

Hmm.  The new format IS self-describing, but ONLY because JSON is
technically possible to parse in reverse.  That is, you cannot reliably
look for end-of-stream marker from the beginning of the stream and
reliably get to the JSON description at the end every single time
(because if you don't already know how to interpret the stream, how can
you find end-of-stream), but you CAN reliably look to see if the stream
ends in a JSON object, and then scan backwards for the matching { that
opens the object.

I'm still wondering if you ought to throw in any additional tricks to
make finding the start of the JSON object much easier, such as a
subsection near the beginning of the migration stream, and/or a final
offset description at the tail of the file that says where the JSON
object starts (no additional help for a pipeline, which still has to
store things in memory to loc.  Even doing something like:

stream EOS [ { description... }, offset-of-description ]

and using a JSON array rather than a JSON object as the description
would make it much faster to find the start of the JSON object without
having to scan backwards for matching { (although sticking the offset at
the tail doesn't help the issue that when receiving the migration stream
over a pipeline, you still have to reserve memory for the entire stream
in order to find that offset).

> 
> Signed-off-by: Alexander Graf <agraf@suse.de>
> 
> ---
> 
> v2 -> v3:
> 
>   - Dont compress objects with subsections
>   - Destroy QJSON object
> ---
>  hw/pci/pci.c                  |   2 +-
>  hw/scsi/spapr_vscsi.c         |   2 +-
>  hw/virtio/virtio.c            |   2 +-
>  include/migration/migration.h |   1 +
>  include/migration/vmstate.h   |   3 +-
>  migration/vmstate.c           | 186 ++++++++++++++++++++++++++++++++++++++++--
>  savevm.c                      |  54 ++++++++++--
>  tests/test-vmstate.c          |   6 +-
>  8 files changed, 237 insertions(+), 19 deletions(-)
> 

At this point, I haven't actually reviewed the patch (I'm more
interested in seeing the JSON it generates), but want to make sure we're
getting an optimal design.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2015-01-06 15:56 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-26 14:42 [Qemu-devel] [PATCH v3 0/5] Migration Deciphering aid Alexander Graf
2014-12-26 14:42 ` [Qemu-devel] [PATCH v3 1/5] QJSON: Add JSON writer Alexander Graf
2015-01-06 15:41   ` Eric Blake
2015-01-06 21:39     ` Alexander Graf
2014-12-26 14:42 ` [Qemu-devel] [PATCH v3 2/5] " Alexander Graf
2015-01-06 15:44   ` Eric Blake
2015-01-06 21:16     ` Alexander Graf
2014-12-26 14:42 ` [Qemu-devel] [PATCH v3 3/5] qemu-file: Add fast ftell code path Alexander Graf
2015-01-06 15:46   ` Eric Blake
2014-12-26 14:42 ` [Qemu-devel] [PATCH v3 4/5] migration: Append JSON description of migration stream Alexander Graf
2015-01-06 15:56   ` Eric Blake [this message]
2015-01-06 21:25     ` Alexander Graf
2015-01-20 10:30   ` Amit Shah
2014-12-26 14:42 ` [Qemu-devel] [PATCH v3 5/5] Add migration stream analyzation script Alexander Graf
2015-01-06 16:05   ` Eric Blake
2015-01-06 21:29     ` Alexander Graf
2015-01-20 10:31 ` [Qemu-devel] [PATCH v3 0/5] Migration Deciphering aid Amit Shah
2015-01-20 10:54   ` Alexander Graf
2015-01-21  6:05     ` Amit Shah

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=54AC0597.8020009@redhat.com \
    --to=eblake@redhat.com \
    --cc=afaerber@suse.de \
    --cc=agraf@suse.de \
    --cc=amit.shah@redhat.com \
    --cc=pbonzini@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.