From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56527) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCklv-0006pi-QJ for qemu-devel@nongnu.org; Tue, 14 Jun 2016 05:36:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bCklp-000231-PA for qemu-devel@nongnu.org; Tue, 14 Jun 2016 05:36:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41683) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCklp-00022t-Gb for qemu-devel@nongnu.org; Tue, 14 Jun 2016 05:36:29 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1AC6680E4A for ; Tue, 14 Jun 2016 09:36:29 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" Date: Tue, 14 Jun 2016 10:36:26 +0100 Message-Id: <1465896986-16132-1-git-send-email-dgilbert@redhat.com> Subject: [Qemu-devel] [PATCH] migration: Trace improvements List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, amit.shah@redhat.com, quintela@redhat.com From: "Dr. David Alan Gilbert" A couple of improvements to tracing that have come out of helping people with migration problems: * vmstate_n_elems trace the count/name - for when you have problems getting array counts right * vmstate_subsection_load_bad - add the idstr, for when you receive a subsection you weren't expecting. Signed-off-by: Dr. David Alan Gilbert --- migration/vmstate.c | 13 +++++++------ trace-events | 3 ++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/migration/vmstate.c b/migration/vmstate.c index 46dc55e..fc29acf 100644 --- a/migration/vmstate.c +++ b/migration/vmstate.c @@ -32,6 +32,7 @@ static int vmstate_n_elems(void *opaque, VMStateField *field) n_elems *= field->num; } + trace_vmstate_n_elems(field->name, n_elems); return n_elems; } @@ -381,25 +382,25 @@ static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd, len = qemu_peek_byte(f, 1); if (len < strlen(vmsd->name) + 1) { /* subsection name has be be "section_name/a" */ - trace_vmstate_subsection_load_bad(vmsd->name, "(short)"); + trace_vmstate_subsection_load_bad(vmsd->name, "(short)", ""); return 0; } size = qemu_peek_buffer(f, (uint8_t **)&idstr_ret, len, 2); if (size != len) { - trace_vmstate_subsection_load_bad(vmsd->name, "(peek fail)"); + trace_vmstate_subsection_load_bad(vmsd->name, "(peek fail)", ""); return 0; } memcpy(idstr, idstr_ret, size); idstr[size] = 0; if (strncmp(vmsd->name, idstr, strlen(vmsd->name)) != 0) { - trace_vmstate_subsection_load_bad(vmsd->name, idstr); - /* it don't have a valid subsection name */ + trace_vmstate_subsection_load_bad(vmsd->name, idstr, "(prefix)"); + /* it doesn't have a valid subsection name */ return 0; } sub_vmsd = vmstate_get_subsection(vmsd->subsections, idstr); if (sub_vmsd == NULL) { - trace_vmstate_subsection_load_bad(vmsd->name, "(lookup)"); + trace_vmstate_subsection_load_bad(vmsd->name, idstr, "(lookup)"); return -ENOENT; } qemu_file_skip(f, 1); /* subsection */ @@ -409,7 +410,7 @@ static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd, ret = vmstate_load_state(f, sub_vmsd, opaque, version_id); if (ret) { - trace_vmstate_subsection_load_bad(vmsd->name, "(child)"); + trace_vmstate_subsection_load_bad(vmsd->name, idstr, "(child)"); return ret; } } diff --git a/trace-events b/trace-events index 421d89f..af3786b 100644 --- a/trace-events +++ b/trace-events @@ -1271,8 +1271,9 @@ vmstate_load_field_error(const char *field, int ret) "field \"%s\" load failed, vmstate_load_state(const char *name, int version_id) "%s v%d" vmstate_load_state_end(const char *name, const char *reason, int val) "%s %s/%d" vmstate_load_state_field(const char *name, const char *field) "%s:%s" +vmstate_n_elems(const char *name, int n_elems) "%s: %d" vmstate_subsection_load(const char *parent) "%s" -vmstate_subsection_load_bad(const char *parent, const char *sub) "%s: %s" +vmstate_subsection_load_bad(const char *parent, const char *sub, const char *sub2) "%s: %s/%s" vmstate_subsection_load_good(const char *parent) "%s" # qemu-file.c -- 2.7.4