提交 46a02a74 编写于 作者: D Dr. David Alan Gilbert

migration/tracing: Add tracing on save

Add some tracing to vmstate_subsection_save and vmstate_save_state
to help in debugging when you're not sure if a conditional piece
of data is being saved.

In vmstate_subsection_save I renamed the inner vmsd to avoid the aliasing
and be able to print both names.
Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20161212125838.14425-1-dgilbert@redhat.com>
Reviewed-by: NJuan Quintela <quintela@redhat.com>
Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
上级 55c4446b
...@@ -40,6 +40,10 @@ savevm_state_iterate(void) "" ...@@ -40,6 +40,10 @@ savevm_state_iterate(void) ""
savevm_state_cleanup(void) "" savevm_state_cleanup(void) ""
savevm_state_complete_precopy(void) "" savevm_state_complete_precopy(void) ""
vmstate_save(const char *idstr, const char *vmsd_name) "%s, %s" vmstate_save(const char *idstr, const char *vmsd_name) "%s, %s"
vmstate_save_state_loop(const char *name, const char *field, int n_elems) "%s/%s[%d]"
vmstate_save_state_top(const char *idstr) "%s"
vmstate_subsection_save_loop(const char *name, const char *sub) "%s/%s"
vmstate_subsection_save_top(const char *idstr) "%s"
vmstate_load(const char *idstr, const char *vmsd_name) "%s, %s" vmstate_load(const char *idstr, const char *vmsd_name) "%s, %s"
qemu_announce_self_iter(const char *mac) "%s" qemu_announce_self_iter(const char *mac) "%s"
......
...@@ -306,6 +306,8 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd, ...@@ -306,6 +306,8 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
{ {
VMStateField *field = vmsd->fields; VMStateField *field = vmsd->fields;
trace_vmstate_save_state_top(vmsd->name);
if (vmsd->pre_save) { if (vmsd->pre_save) {
vmsd->pre_save(opaque); vmsd->pre_save(opaque);
} }
...@@ -325,6 +327,7 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd, ...@@ -325,6 +327,7 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
int64_t old_offset, written_bytes; int64_t old_offset, written_bytes;
QJSON *vmdesc_loop = vmdesc; QJSON *vmdesc_loop = vmdesc;
trace_vmstate_save_state_loop(vmsd->name, field->name, n_elems);
for (i = 0; i < n_elems; i++) { for (i = 0; i < n_elems; i++) {
void *addr = base_addr + size * i; void *addr = base_addr + size * i;
...@@ -434,11 +437,13 @@ static void vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd, ...@@ -434,11 +437,13 @@ static void vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
const VMStateDescription **sub = vmsd->subsections; const VMStateDescription **sub = vmsd->subsections;
bool subsection_found = false; bool subsection_found = false;
trace_vmstate_subsection_save_top(vmsd->name);
while (sub && *sub && (*sub)->needed) { while (sub && *sub && (*sub)->needed) {
if ((*sub)->needed(opaque)) { if ((*sub)->needed(opaque)) {
const VMStateDescription *vmsd = *sub; const VMStateDescription *vmsdsub = *sub;
uint8_t len; uint8_t len;
trace_vmstate_subsection_save_loop(vmsd->name, vmsdsub->name);
if (vmdesc) { if (vmdesc) {
/* Only create subsection array when we have any */ /* Only create subsection array when we have any */
if (!subsection_found) { if (!subsection_found) {
...@@ -450,11 +455,11 @@ static void vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd, ...@@ -450,11 +455,11 @@ static void vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
} }
qemu_put_byte(f, QEMU_VM_SUBSECTION); qemu_put_byte(f, QEMU_VM_SUBSECTION);
len = strlen(vmsd->name); len = strlen(vmsdsub->name);
qemu_put_byte(f, len); qemu_put_byte(f, len);
qemu_put_buffer(f, (uint8_t *)vmsd->name, len); qemu_put_buffer(f, (uint8_t *)vmsdsub->name, len);
qemu_put_be32(f, vmsd->version_id); qemu_put_be32(f, vmsdsub->version_id);
vmstate_save_state(f, vmsd, opaque, vmdesc); vmstate_save_state(f, vmsdsub, opaque, vmdesc);
if (vmdesc) { if (vmdesc) {
json_end_object(vmdesc); json_end_object(vmdesc);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册