All of lore.kernel.org
 help / color / mirror / Atom feed
* error reporting from pre_load etc callbacks
@ 2020-07-21 14:01 Peter Maydell
  2020-07-21 14:58 ` Dr. David Alan Gilbert
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Maydell @ 2020-07-21 14:01 UTC (permalink / raw)
  To: QEMU Developers, Dr. David Alan Gilbert, Juan Quintela

(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


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...

thanks
-- PMM


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: error reporting from pre_load etc callbacks
  2020-07-21 14:01 error reporting from pre_load etc callbacks Peter Maydell
@ 2020-07-21 14:58 ` Dr. David Alan Gilbert
  0 siblings, 0 replies; 2+ messages in thread
From: Dr. David Alan Gilbert @ 2020-07-21 14:58 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Developers, Juan Quintela

* 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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-21 14:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-21 14:01 error reporting from pre_load etc callbacks Peter Maydell
2020-07-21 14:58 ` Dr. David Alan Gilbert

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.