From: Paolo Bonzini <pbonzini@redhat.com>
To: Jianjun Duan <duanj@linux.vnet.ibm.com>
Cc: qemu-devel@nongnu.org, quintela@redhat.com,
mdroth@linux.vnet.ibm.com, qemu-ppc@nongnu.org,
amit shah <amit.shah@redhat.com>,
david@gibson.dropbear.id.au
Subject: Re: [Qemu-devel] [QEMU RFC PATCH v2 4/6] Migration: migrate QTAILQ
Date: Wed, 25 May 2016 15:22:34 -0400 (EDT) [thread overview]
Message-ID: <275886818.17251052.1464204154028.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <5745EF5D.8050705@linux.vnet.ibm.com>
> 1 QTAILQ should only be accessed using the interfaces defined in
> queue.h. Its structs should not be directly used. So I created
> interfaces in queue.h to query about its layout. If the implementation
> is changed, these interfaces should be changed accordingly. Code using
> these interfaces should not break.
You don't need to query the layout, as long as the knowledge
remains hidden in QTAILQ_RAW_* macros. And because QTAILQ_*_OFFSET
returns constant values, you can just put the knowledge of the offsets
directly in QTAILQ_RAW_FOREACH and QTAILQ_RAW_INSERT_TAIL.
> 2 Based on point 1, vmstate_load_state/vmstate_put_state in vmstate.c
> doesn't exactly know the structs of QTAILAQ head and entry. So pointer
> arithmetic is needed to put/get a QTAILQ. To do it, we need those 6
> parameters to be passed in. So it is not redundant if we only want to
> only use the interfaces.
No, you only need two. The other four are internal to qemu/queue.h.
Just like QTAILQ users do not know about tqh_* and tqe_*, they need not
know about their offsets, only the fields that contain them.
> 3 At this moment, vmstate_load_state/vmstate_put_state couldn't handle a
> queue, or a list, or another recursive structure. To make it
> extensible, I think a metadata is needed. The idea is for any
> structure which needs special handling, customized metadata/put/get
> should provide enough flexibility to hack around.
I think your solution is a bit overengineered. If the metadata can
fit in the VMStateField, you can use VMStateField.
Thanks,
Paolo
next prev parent reply other threads:[~2016-05-25 19:22 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-24 17:55 [Qemu-devel] [QEMU RFC PATCH v2 0/6] Migration: ensure hotplug and migration work together Jianjun Duan
2016-05-24 17:55 ` [Qemu-devel] [QEMU RFC PATCH v2 1/6] spapr: ensure device trees are always associated with DRC Jianjun Duan
2016-05-25 5:20 ` David Gibson
2016-05-24 17:55 ` [Qemu-devel] [QEMU RFC PATCH v2 2/6] Migration: Defined VMStateDescription struct for spapr_drc Jianjun Duan
2016-05-24 17:55 ` [Qemu-devel] [QEMU RFC PATCH v2 3/6] vmstate: Define VARRAY with VMS_ALLOC Jianjun Duan
2016-05-24 17:55 ` [Qemu-devel] [QEMU RFC PATCH v2 4/6] Migration: migrate QTAILQ Jianjun Duan
2016-05-25 5:38 ` David Gibson
2016-05-25 8:14 ` Paolo Bonzini
2016-05-25 16:37 ` Jianjun Duan
2016-05-25 17:51 ` Paolo Bonzini
2016-05-25 18:30 ` Jianjun Duan
2016-05-25 19:22 ` Paolo Bonzini [this message]
2016-05-25 20:17 ` Jianjun Duan
2016-05-26 7:11 ` Paolo Bonzini
2016-05-26 16:43 ` Jianjun Duan
2016-05-26 16:52 ` Paolo Bonzini
2016-05-24 17:55 ` [Qemu-devel] [QEMU RFC PATCH v2 5/6] Migration: migrate ccs_list in spapr state Jianjun Duan
2016-05-24 17:55 ` [Qemu-devel] [QEMU RFC PATCH v2 6/6] Migration: migrate pending_events of " 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=275886818.17251052.1464204154028.JavaMail.zimbra@redhat.com \
--to=pbonzini@redhat.com \
--cc=amit.shah@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=duanj@linux.vnet.ibm.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@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).