From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Amit Shah <amit.shah@redhat.com>
Cc: qemu-devel@nongnu.org, stefanha@redhat.com, quintela@redhat.com
Subject: Re: [Qemu-devel] [PATCH 2/3] Migration: Add lots of trace events
Date: Wed, 21 Jan 2015 09:19:26 +0000 [thread overview]
Message-ID: <20150121091925.GA2354@work-vm> (raw)
In-Reply-To: <20150121060203.GQ31174@grmbl.mre>
* Amit Shah (amit.shah@redhat.com) wrote:
> On (Tue) 20 Jan 2015 [14:48:02], Dr. David Alan Gilbert (git) wrote:
> > From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> >
> > Mostly on the load side, so that when we get a complaint about
> > a migration failure we can figure out what it didn't like.
>
> Nice!
>
> Just one note below.
>
> > Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> > ---
> > migration/vmstate.c | 22 +++++++++++++++++++---
> > savevm.c | 10 +++++++---
> > trace-events | 11 ++++++++++-
> > 3 files changed, 36 insertions(+), 7 deletions(-)
> >
> > diff --git a/migration/vmstate.c b/migration/vmstate.c
> > index 2c0b135..7b8dc3f 100644
> > --- a/migration/vmstate.c
> > +++ b/migration/vmstate.c
> > @@ -75,14 +75,19 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
> > VMStateField *field = vmsd->fields;
> > int ret;
> >
> > + trace_vmstate_load_state(vmsd->name, version_id);
> > if (version_id > vmsd->version_id) {
> > + trace_vmstate_load_state_end(vmsd->name, "too new", -EINVAL);
> > return -EINVAL;
> > }
> > if (version_id < vmsd->minimum_version_id) {
> > if (vmsd->load_state_old &&
> > version_id >= vmsd->minimum_version_id_old) {
> > - return vmsd->load_state_old(f, opaque, version_id);
> > + ret = vmsd->load_state_old(f, opaque, version_id);
> > + trace_vmstate_load_state_end(vmsd->name, "old path", ret);
> > + return ret;
> > }
> > + trace_vmstate_load_state_end(vmsd->name, "too old", -EINVAL);
> > return -EINVAL;
> > }
> > if (vmsd->pre_load) {
> > @@ -92,6 +97,7 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
> > }
> > }
> > while (field->name) {
> > + trace_vmstate_load_state_field(vmsd->name, field->name);
> > if ((field->field_exists &&
> > field->field_exists(opaque, version_id)) ||
> > (!field->field_exists &&
> > @@ -134,9 +140,10 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
> > return ret;
> > }
> > if (vmsd->post_load) {
> > - return vmsd->post_load(opaque, version_id);
> > + ret = vmsd->post_load(opaque, version_id);
> > }
> > - return 0;
> > + trace_vmstate_load_state_end(vmsd->name, "end", ret);
> > + return ret;
> > }
>
> "return 0" becomes "return ret", and ret isn't assigned anywhere.
Oops, yes, I'll reroll it.
Dave
>
> > void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
> > @@ -193,6 +200,8 @@ static const VMStateDescription *
> > static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd,
> > void *opaque)
> > {
> > + trace_vmstate_subsection_load(vmsd->name);
> > +
> > while (qemu_peek_byte(f, 0) == QEMU_VM_SUBSECTION) {
> > char idstr[256];
> > int ret;
> > @@ -202,20 +211,24 @@ 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)");
> > return 0;
>
> Nice how you use the () to differentiate from the idstr below..
>
> > }
> > size = qemu_peek_buffer(f, (uint8_t *)idstr, len, 2);
> > if (size != len) {
> > + trace_vmstate_subsection_load_bad(vmsd->name, "(peek fail)");
> > return 0;
> > }
> > 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 */
> > return 0;
>
>
> Amit
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2015-01-21 9:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-20 14:48 [Qemu-devel] [PATCH 0/3] Migration tracing and errors Dr. David Alan Gilbert (git)
2015-01-20 14:48 ` [Qemu-devel] [PATCH 1/3] savevm: Convert fprintf to error_report Dr. David Alan Gilbert (git)
2015-01-21 5:56 ` Amit Shah
2015-01-20 14:48 ` [Qemu-devel] [PATCH 2/3] Migration: Add lots of trace events Dr. David Alan Gilbert (git)
2015-01-21 6:02 ` Amit Shah
2015-01-21 9:19 ` Dr. David Alan Gilbert [this message]
2015-01-20 14:48 ` [Qemu-devel] [PATCH 3/3] Print errors in some of the early migration failure cases Dr. David Alan Gilbert (git)
2015-01-21 6:03 ` Amit Shah
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=20150121091925.GA2354@work-vm \
--to=dgilbert@redhat.com \
--cc=amit.shah@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=stefanha@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).