Re: [Qemu-devel] [QEMU RFC PATCH v2 4/6] Migration: migrate QTAILQ

2016-05-26 Thread Paolo Bonzini
On 26/05/2016 18:43, Jianjun Duan wrote: >>> The user may only care the position of head and entry. But to >>> implement QTAILQ_RAW_***, we need more offset information than that. >>> If we don't query the offsets using something like offset() and store >>> it in a metadata, we have to make the a

Re: [Qemu-devel] [QEMU RFC PATCH v2 4/6] Migration: migrate QTAILQ

2016-05-26 Thread Jianjun Duan
On 05/26/2016 12:11 AM, Paolo Bonzini wrote: > > > On 25/05/2016 22:17, Jianjun Duan wrote: >> >> >> On 05/25/2016 12:22 PM, Paolo Bonzini wrote: 1 QTAILQ should only be accessed using the interfaces defined in queue.h. Its structs should not be directly used. So I created interf

Re: [Qemu-devel] [QEMU RFC PATCH v2 4/6] Migration: migrate QTAILQ

2016-05-26 Thread Paolo Bonzini
On 25/05/2016 22:17, Jianjun Duan wrote: > > > On 05/25/2016 12:22 PM, Paolo Bonzini wrote: >>> 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 impleme

Re: [Qemu-devel] [QEMU RFC PATCH v2 4/6] Migration: migrate QTAILQ

2016-05-25 Thread Jianjun Duan
On 05/25/2016 12:22 PM, Paolo Bonzini wrote: >> 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 ch

Re: [Qemu-devel] [QEMU RFC PATCH v2 4/6] Migration: migrate QTAILQ

2016-05-25 Thread Paolo Bonzini
> 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 sh

Re: [Qemu-devel] [QEMU RFC PATCH v2 4/6] Migration: migrate QTAILQ

2016-05-25 Thread Jianjun Duan
I will try to explain my design rationale in details here. 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

Re: [Qemu-devel] [QEMU RFC PATCH v2 4/6] Migration: migrate QTAILQ

2016-05-25 Thread Paolo Bonzini
> >> +/* > >> + * Following 3 fields are for VMStateField which needs customized > >> handling, > >> + * such as QTAILQ in qemu/queue.h, lists, and tree. > >> + */ > >> +const void *meta_data; > >> +int (*extend_get)(QEMUFile *f, const void *metadata, void *opaque); > >> +

Re: [Qemu-devel] [QEMU RFC PATCH v2 4/6] Migration: migrate QTAILQ

2016-05-25 Thread Jianjun Duan
On 05/25/2016 01:14 AM, Paolo Bonzini wrote: > > > On 24/05/2016 19:55, Jianjun Duan wrote: >> +/* >> + * Offsets of layout of a tail queue head. >> + */ >> +#define QTAILQ_FIRST_OFFSET(head_type) \ >> +((size_t) ((char *) &((head_type *)0)->tqh_first - (char *)0)) >> + >> +#define QTAI

Re: [Qemu-devel] [QEMU RFC PATCH v2 4/6] Migration: migrate QTAILQ

2016-05-25 Thread Paolo Bonzini
On 24/05/2016 19:55, Jianjun Duan wrote: > +/* > + * Offsets of layout of a tail queue head. > + */ > +#define QTAILQ_FIRST_OFFSET(head_type) \ > +((size_t) ((char *) &((head_type *)0)->tqh_first - (char *)0)) > + > +#define QTAILQ_LAST_OFFSET(head_type) \ > +((size_t) ((char *) &

Re: [Qemu-devel] [QEMU RFC PATCH v2 4/6] Migration: migrate QTAILQ

2016-05-24 Thread David Gibson
On Tue, May 24, 2016 at 10:55:07AM -0700, Jianjun Duan wrote: > A recursive structure has elements of the same type in itself. Currently > we cannot directly transfer a QTAILQ instance, or any recursive > structure such as lists in migration because of the limitation in the > migration code. Here w

[Qemu-devel] [QEMU RFC PATCH v2 4/6] Migration: migrate QTAILQ

2016-05-24 Thread Jianjun Duan
A recursive structure has elements of the same type in itself. Currently we cannot directly transfer a QTAILQ instance, or any recursive structure such as lists in migration because of the limitation in the migration code. Here we introduce a general approach to transfer such structures. In our app