mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
migration: migrate QTAILQ
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. We created VMStateInfo vmstate_info_qtailq for QTAILQ. Similar VMStateInfo can be created for other data structures such as list. When a QTAILQ is migrated from source to target, it is appended to the corresponding QTAILQ structure, which is assumed to have been properly initialized. 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. Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Jianjun Duan <duanj@linux.vnet.ibm.com> Message-Id: <1484852453-12728-3-git-send-email-duanj@linux.vnet.ibm.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
parent
2c21ee769e
commit
94869d5c52
4 changed files with 153 additions and 0 deletions
|
@ -260,6 +260,7 @@ extern const VMStateInfo vmstate_info_timer;
|
|||
extern const VMStateInfo vmstate_info_buffer;
|
||||
extern const VMStateInfo vmstate_info_unused_buffer;
|
||||
extern const VMStateInfo vmstate_info_bitmap;
|
||||
extern const VMStateInfo vmstate_info_qtailq;
|
||||
|
||||
#define type_check_2darray(t1,t2,n,m) ((t1(*)[n][m])0 - (t2*)0)
|
||||
#define type_check_array(t1,t2,n) ((t1(*)[n])0 - (t2*)0)
|
||||
|
@ -671,6 +672,25 @@ extern const VMStateInfo vmstate_info_bitmap;
|
|||
.offset = offsetof(_state, _field), \
|
||||
}
|
||||
|
||||
/* For migrating a QTAILQ.
|
||||
* Target QTAILQ needs be properly initialized.
|
||||
* _type: type of QTAILQ element
|
||||
* _next: name of QTAILQ entry field in QTAILQ element
|
||||
* _vmsd: VMSD for QTAILQ element
|
||||
* size: size of QTAILQ element
|
||||
* start: offset of QTAILQ entry in QTAILQ element
|
||||
*/
|
||||
#define VMSTATE_QTAILQ_V(_field, _state, _version, _vmsd, _type, _next) \
|
||||
{ \
|
||||
.name = (stringify(_field)), \
|
||||
.version_id = (_version), \
|
||||
.vmsd = &(_vmsd), \
|
||||
.size = sizeof(_type), \
|
||||
.info = &vmstate_info_qtailq, \
|
||||
.offset = offsetof(_state, _field), \
|
||||
.start = offsetof(_type, _next), \
|
||||
}
|
||||
|
||||
/* _f : field name
|
||||
_f_n : num of elements field_name
|
||||
_n : num of elements
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue