From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>,
Juan Quintela <quintela@redhat.com>
Subject: Re: error reporting from pre_load etc callbacks
Date: Tue, 21 Jul 2020 15:58:32 +0100 [thread overview]
Message-ID: <20200721145832.GC2800@work-vm> (raw)
In-Reply-To: <CAFEAcA_rFLk2Fs1ibHH7YnR38K-nGjKas5SkPP8ReubHfHtvMQ@mail.gmail.com>
* Peter Maydell (peter.maydell@linaro.org) wrote:
> (This was pointed out to me off-list.)
>
> What is the intended API of the pre_load() etc callbacks?
> docs/devel/migration.rst doesn't say, and there's no doc comment
> in include/migration/vmstate.h. Most actual device implementations
> of the hooks seem to return 0 on success and -1 on failure.
> But the callers of the hooks like vmstate_load_state() seem to
> assume they return negative-errnos: a non-zero return value
> is just propagated up to the caller, and can end up for
> instance treated as negative-errno in process_incoming_migration_co():
> error_report("load of migration failed: %s", strerror(-ret));
> which results in nonsensical error messages to the user like:
> qemu-system-aarch64: load of migration failed: Operation not permitted
In theory (pre|post)_(load|save) have the same interface; in practice
they're all rather inconsistent.
Returning 0 on success, -errno on failure is my preference.
> More generally, it would be nice if a pre_load/post_load/etc
> hook could report an error more precisely than just yes/no
> or even than just an errno: in the case of arm CPU loading
> we could in theory report more detail like which register the
> kernel didn't handle...
On the load side, just error_report as tightly as you can; what
you should see on stderr is basically a backtrace:
'failed to do something in ...'
'load of migration failed of ...'
Dave
> thanks
> -- PMM
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
prev parent reply other threads:[~2020-07-21 14:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-21 14:01 error reporting from pre_load etc callbacks Peter Maydell
2020-07-21 14:58 ` Dr. David Alan Gilbert [this message]
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=20200721145832.GC2800@work-vm \
--to=dgilbert@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@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).