From: David Gibson <david@gibson.dropbear.id.au>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Jianjun Duan <duanj@linux.vnet.ibm.com>,
qemu-devel@nongnu.org, qemu-ppc@nongnu.org, dmitry@daynix.com,
peter.maydell@linaro.org, kraxel@redhat.com, mst@redhat.com,
pbonzini@redhat.com, veroniabahaa@gmail.com, quintela@redhat.com,
amit.shah@redhat.com, mreitz@redhat.com, kwolf@redhat.com,
rth@twiddle.net, aurelien@aurel32.net, leon.alrae@imgtec.com,
blauwirbel@gmail.com, mark.cave-ayland@ilande.co.uk,
mdroth@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [QEMU PATCH v5 4/6] migration: migrate QTAILQ
Date: Fri, 7 Oct 2016 14:25:52 +1100 [thread overview]
Message-ID: <20161007032552.GN18490@umbus.fritz.box> (raw)
In-Reply-To: <20161006190156.GE3087@work-vm>
[-- Attachment #1: Type: text/plain, Size: 5051 bytes --]
On Thu, Oct 06, 2016 at 08:01:56PM +0100, Dr. David Alan Gilbert wrote:
> * Jianjun Duan (duanj@linux.vnet.ibm.com) wrote:
> >
> >
> > On 10/05/2016 09:56 AM, Dr. David Alan Gilbert wrote:
> > > * Jianjun Duan (duanj@linux.vnet.ibm.com) wrote:
> > >> Currently we cannot directly transfer a QTAILQ instance because of the
> > >> limitation in the migration code. Here we introduce an approach to
> > >> transfer such structures. In our approach such a structure is tagged
> > >> with VMS_LINKED. We then modified vmstate_save_state and vmstate_load_state
> > >> so that when VMS_LINKED is encountered, put and get from VMStateInfo are
> > >> called respectively. We created VMStateInfo vmstate_info_qtailq for QTAILQ.
> > >> Similar VMStateInfo can be created for other data structures such as list.
> > >> This approach will be used to transfer pending_events and ccs_list in spapr
> > >> state.
> > >>
> > >> We also create some macros in qemu/queue.h to access a QTAILQ using pointer
> > >> arithmetic. This ensures that we do not depend on the implementation
> > >> details about QTAILQ in the migration code.
> > >
> > > I think we're going to need a way to have a more flexible
> > > loops; and thus my choice here wouldn't be to use the .get/.put together
> > > with the VMSD; but I think we'll end up needing a new
> > > data structure, maybe a VMStateLoop *loop in VMStateField.
> > >
> > > So would it be easier if you added that new member, then you wouldn't have to
> > > modify every get() and put() function that already exists in the previous patch.
> > >
> > > Specifically, your format of QTAILQ is perfectly reasonable - a
> > > byte before each entry which is 1 to indicate there's an entry or 0
> > > to indicate termination, but there are lots of other variants, e.g.
> > >
> > > a) put_scsi_requests uses that byte to hold a flag, so it's 0,1,2
> > > 0 still means terminate but 1 or 2 set a flag in the structure.
> >
> > I quickly take a look of put_scsi_requests. It is transferring a QTAILQ of
> > SCSIRequest. However it goes into the structure inside to dump the
> > elements out.
> > If using my approach, I would have a VMSD for SCSIRequest. The
> > additional byte used to indicate the end of the queue would lie outside
> > the SCSCIRequest data block, so there would be no confusion.
>
> Hmm OK; I don't think it's that easy but we'll see.
>
> However, can I make one much simpler request; please split this patch
> so that the VMSTATE_LINKED and vmstate_save_state/vmstate_load_state/vmfield_get_type_name
> are in one patch, while the QTAILQ patches are in a separate patch.
> (I'd be OK if you moved the VMSTATE_LINKED into the previous patch).
>
> I've just been thinking about a different use for the same mechanism;
> I want to do a:
> VMSTATE_WITH_TMP(t1*, type1, type2, vmsd)
>
> which also sets the LINKED, where the .get/.put allocate a temporary
> structure (of type/size type2), set up *tmp = t1 and then do the vmstate_load/save
> using the vmsd on the temporary; something like (untested):
>
> static int get_tmp(QEMUFile *f, void *pv, size_t unused_size, VMStateField *field)
> {
> const VMStateDescription *vmsd = field->vmsd;
> size_t size = field->size;
> int version_id = field->version_id;
> void *tmp = gmalloc(size);
> int ret;
>
> *(void **)tmp = pv;
> ret = vmstate_load_state(f, vmsd, tmp, version_id);
> gfree(tmp);
> return ret;
> }
>
> This can be in a generic macro; and we would impose that type2 must be a struct
> with the first element is 'type1* parent' (compile checked).
> This would work nicely for where we have to do some maths to generate some
> temporary results prior to migration; the .pre_save of the vmsd can read the data
> from pv->parent and write it to the other fields but not have to use
> qemu_get_*/qemu_put_* at all.
>
> Dave
Oh, I like this idea. I know there are a number of places where
should-be-obsolete fields are still present in structures purely to
catch incoming migration info which is then converted to the modern
representation in post_load. This would allow cleaning a bunch of
those up.
It would also mean we don't necessarily need explicit handling of
queues/lists. I objected to early versions of this series which
dumped the qtailq into an array and used the existing array vmstate
types, because it meant not just an only-for-migration field in the
structure, but a substantial slab of only-for-migration data.
If we added the concept of temporary "catching" structures to the
vmsd, that objection would go away. I'd be happy enough to
temporarily dump the queue into an array, transfer that over the
stream into another temporary array, then load it into the destination
queue.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2016-10-07 3:37 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-03 18:24 [Qemu-devel] [QEMU PATCH v5 0/6] migration: ensure hotplug and migration work together Jianjun Duan
2016-10-03 18:24 ` [Qemu-devel] [QEMU PATCH v5 1/6] migration: alternative way to set instance_id in SaveStateEntry Jianjun Duan
2016-10-05 10:12 ` Dr. David Alan Gilbert
2016-10-05 16:44 ` Jianjun Duan
2016-10-07 2:54 ` David Gibson
2016-10-07 8:07 ` Dr. David Alan Gilbert
2016-10-10 5:31 ` David Gibson
2016-10-11 16:17 ` Michael Roth
2016-10-11 23:37 ` David Gibson
2016-11-15 23:45 ` Michael Roth
2016-10-05 16:46 ` [Qemu-devel] [Qemu-ppc] " Jianjun Duan
2016-10-03 18:24 ` [Qemu-devel] [QEMU PATCH v5 2/6] migration: spapr_drc: defined VMStateDescription struct Jianjun Duan
2016-10-05 11:38 ` Dr. David Alan Gilbert
2016-10-07 3:17 ` David Gibson
2016-10-07 3:12 ` David Gibson
2016-10-07 17:17 ` Jianjun Duan
2016-10-10 5:09 ` David Gibson
2016-10-10 16:48 ` [Qemu-devel] [Qemu-ppc] " Jianjun Duan
2016-10-03 18:24 ` [Qemu-devel] [QEMU PATCH v5 3/6] migration: extend VMStateInfo Jianjun Duan
2016-10-07 12:08 ` Dr. David Alan Gilbert
2016-10-07 16:35 ` [Qemu-devel] [Qemu-ppc] " Jianjun Duan
2016-10-07 18:42 ` Dr. David Alan Gilbert
2016-10-10 5:02 ` David Gibson
2016-10-12 11:59 ` [Qemu-devel] " Halil Pasic
2016-10-12 12:07 ` Paolo Bonzini
2016-10-12 12:30 ` Halil Pasic
2016-10-12 14:59 ` Dr. David Alan Gilbert
2016-10-13 10:33 ` Halil Pasic
2016-10-13 11:12 ` Dr. David Alan Gilbert
2016-10-12 17:27 ` [Qemu-devel] [Qemu-ppc] " Jianjun Duan
2016-10-13 8:22 ` Paolo Bonzini
2016-10-13 10:48 ` Halil Pasic
2016-10-13 11:20 ` Paolo Bonzini
2016-10-13 16:23 ` Jianjun Duan
2016-10-13 16:32 ` Halil Pasic
2016-10-13 16:35 ` Jianjun Duan
2016-10-03 18:24 ` [Qemu-devel] [QEMU PATCH v5 4/6] migration: migrate QTAILQ Jianjun Duan
2016-10-05 16:56 ` Dr. David Alan Gilbert
2016-10-05 17:19 ` Jianjun Duan
2016-10-06 19:01 ` Dr. David Alan Gilbert
2016-10-06 19:49 ` Jianjun Duan
2016-10-07 3:25 ` David Gibson [this message]
2016-10-07 14:31 ` Paolo Bonzini
2016-10-07 14:34 ` Dr. David Alan Gilbert
2016-10-07 16:31 ` [Qemu-devel] [Qemu-ppc] " Jianjun Duan
2016-10-07 16:32 ` Paolo Bonzini
2016-10-07 17:25 ` Jianjun Duan
2016-10-07 17:34 ` Dr. David Alan Gilbert
2016-10-07 17:43 ` Jianjun Duan
2016-10-08 11:37 ` Paolo Bonzini
2016-10-08 19:28 ` Halil Pasic
2016-10-10 21:29 ` Jianjun Duan
2016-10-11 7:33 ` Paolo Bonzini
2016-10-10 21:40 ` Jianjun Duan
2016-10-06 11:05 ` [Qemu-devel] " Paolo Bonzini
2016-10-06 11:56 ` Dr. David Alan Gilbert
2016-10-06 12:23 ` Paolo Bonzini
2016-10-06 15:21 ` Dr. David Alan Gilbert
2016-10-03 18:24 ` [Qemu-devel] [QEMU PATCH v5 5/6] migration: spapr: migrate ccs_list in spapr state Jianjun Duan
2016-10-07 3:36 ` David Gibson
2016-10-07 14:52 ` Michael Roth
2016-10-10 5:05 ` David Gibson
2016-10-03 18:24 ` [Qemu-devel] [QEMU PATCH v5 6/6] migration: spapr: migrate pending_events of " Jianjun Duan
2016-10-03 18:35 ` [Qemu-devel] [QEMU PATCH v5 0/6] migration: ensure hotplug and migration work together no-reply
2016-10-03 19:00 ` no-reply
2016-10-03 19:11 ` Jianjun Duan
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=20161007032552.GN18490@umbus.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=amit.shah@redhat.com \
--cc=aurelien@aurel32.net \
--cc=blauwirbel@gmail.com \
--cc=dgilbert@redhat.com \
--cc=dmitry@daynix.com \
--cc=duanj@linux.vnet.ibm.com \
--cc=kraxel@redhat.com \
--cc=kwolf@redhat.com \
--cc=leon.alrae@imgtec.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=mdroth@linux.vnet.ibm.com \
--cc=mreitz@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=quintela@redhat.com \
--cc=rth@twiddle.net \
--cc=veroniabahaa@gmail.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.