From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Eric Blake <eblake@redhat.com>, Amit Shah <amit.shah@redhat.com>,
qemu-devel@nongnu.org, famz@redhat.com,
Juan Quintela <quintela@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v3 10/18] vmstate: Use new JSON output visitor
Date: Wed, 4 May 2016 09:54:41 +0100 [thread overview]
Message-ID: <20160504085440.GB2302@work-vm> (raw)
In-Reply-To: <87vb2uz07l.fsf@dusky.pond.sub.org>
* Markus Armbruster (armbru@redhat.com) wrote:
> "Dr. David Alan Gilbert" <dgilbert@redhat.com> writes:
>
> > * Eric Blake (eblake@redhat.com) wrote:
> >> On 05/03/2016 06:26 AM, Markus Armbruster wrote:
> >>
> >> >>> + visit_type_int(vmdesc, "size", &size, &error_abort);
> >> >>> + visit_start_list(vmdesc, "fields", NULL, 0, &error_abort);
> >> >>> + visit_start_struct(vmdesc, NULL, NULL, 0, &error_abort);
> >> >>
> >> >> Please avoid error_abort in migration code, especially on the source side.
> >> >> You've got an apparently happily working VM, we must never kill it
> >> >> while attempting migration.
> >> >
> >> > These functions cannot fail, and &error_abort is a concise way to
> >> > express that. It's the same as
> >> >
> >> > visit_type_int(vmdesc, "size", &size, &err);
> >> > assert(!err);
> >>
> >> &error_abort is ONLY supposed to be used to flag programming errors (ie.
> >> they should never be reachable). I'm asserting that the errors don't
> >> happen, and therefore this cannot make the migration fail - in other
> >> words, this is NOT going to kill a VM that attempts migration.
> >
> > OK, but remember that I work on the basis that there are programming errors
> > in both the migration code and the VMState descriptions for devices.
> > If those break it still shouldn't kill the source.
> > (Note this isn't just true of migration - we need to be careful about
> > it in all cases where we're doing stuff to an otherwise happy VM).
>
> While you can safely recover from certain programming errors, you can't
> do it in general. Worse, deciding whether recovery from a certain
> programming error is safe can be intractable.
>
> Example: visit_type_enum(v, name, &enum_val, enum_str, &err), where v is
> an output visitor. This can fail when enum_val is not a valid subscript
> of enum_str[]. Can we recover safely? Assume that we can cleanly fail
> the task at hand at this point of its execution.
>
> Perhaps enum_str[] doesn't match the actual enum. This is a programming
> error. Failing the task is graceful degradation, and safe enough.
>
> But what if enum_str[] is fine, but enum_val got corrupted? Then
> failing the task is still safe as long as enum_val isn't visible outside
> the task. But if it is visible, all bets are off. The corruption can
> spread, and do real damage. Can be the difference between a crash that
> forces a reboot with a filesystem journal replay, and massive data
> corruption.
>
> So, should we try to recover here? Assuming we want to, badly. If
> analysis shows the possible causes of this error are safely isolated by
> the recovery, yes. Without such analysis, the only prudent answer is
> no.
>
> Real world examples typically deal with state more complex than just an
> enum (all too often a thicket of pointers), and the safety argument gets
> much hairier.
>
> If you want more tractable arguments, try Erlang.
And so my argument here is very simple; if we believe we have a corruption
in migration data then we fail migration - I don't try and do anything
clever about trying to bound what's broken.
This isn't about getting formal/tractable arguments, it's about making
a practical system.
> >> > * Conditions where the JSON output visitor itself sets an error:
> >> >
> >> > - None.
> >>
> >> The JSON output visitor itself may be adding an error for an attempt to
> >> output Inf or NaN for a floating point number - but since vmstate
> >> doesn't use visit_type_number(), this is not possible. And if we are
> >> really worried about it, then in my next spin of the patch I may make it
> >> user-configurable whether we stick to strict JSON or whether we relax
> >> things and output Inf/NaN anyways.
> >
> > If that's the only case, and you're already saying it doesn't use it, then
> > I don't see there's a point in making that bit any more configurable.
>
> I listed all possible failures of the JSON output visitor upthread.
> This is an additional failure we've considered. I'm wary of adding it
> precisely because I do worry about upsetting apple carts like this one.
Dave
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2016-05-04 8:55 UTC|newest]
Thread overview: 77+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-29 4:23 [Qemu-devel] [PATCH v3 00/18] Add qapi-to-JSON and clone visitors Eric Blake
2016-04-29 4:23 ` [Qemu-devel] [PATCH v3 01/18] qapi: Rename (one) qjson.h to qobject-json.h Eric Blake
2016-04-29 4:23 ` [Qemu-devel] [PATCH v3 02/18] qapi: Improve use of qmp/types.h Eric Blake
2016-04-29 11:46 ` Markus Armbruster
2016-04-29 4:23 ` [Qemu-devel] [PATCH v3 03/18] qapi: Factor out JSON string escaping Eric Blake
2016-04-29 12:09 ` Markus Armbruster
2016-04-29 17:57 ` Eric Blake
2016-05-03 7:36 ` Markus Armbruster
2016-04-29 4:23 ` [Qemu-devel] [PATCH v3 04/18] qapi: Factor out JSON number formatting Eric Blake
2016-04-29 13:22 ` Markus Armbruster
2016-04-29 13:43 ` Eric Blake
2016-05-03 8:02 ` Markus Armbruster
2016-04-29 4:23 ` [Qemu-devel] [PATCH v3 05/18] qapi: Use qstring_append_chr() where appropriate Eric Blake
2016-04-29 13:25 ` Markus Armbruster
2016-04-29 4:23 ` [Qemu-devel] [PATCH v3 06/18] qapi: Add qstring_append_format() Eric Blake
2016-04-29 13:40 ` Markus Armbruster
2016-04-29 4:23 ` [Qemu-devel] [PATCH v3 07/18] qapi: Add json output visitor Eric Blake
2016-05-02 9:15 ` Markus Armbruster
2016-05-02 15:11 ` Eric Blake
2016-05-03 8:22 ` Markus Armbruster
2016-05-04 15:45 ` Markus Armbruster
2016-05-06 4:16 ` Eric Blake
2016-05-06 12:31 ` Markus Armbruster
2016-05-06 14:08 ` Eric Blake
2016-05-10 4:22 ` Eric Blake
2016-05-18 15:16 ` Eric Blake
2016-05-18 15:24 ` Eric Blake
2016-05-02 15:00 ` Markus Armbruster
2016-04-29 4:23 ` [Qemu-devel] [PATCH v3 08/18] qjson: Simplify by using json-output-visitor Eric Blake
2016-05-02 12:45 ` Markus Armbruster
2016-05-02 12:49 ` Markus Armbruster
2016-04-29 4:23 ` [Qemu-devel] [PATCH v3 09/18] Revert "qjson: Simplify by using json-output-visitor" Eric Blake
2016-04-29 4:23 ` [Qemu-devel] [PATCH v3 10/18] vmstate: Use new JSON output visitor Eric Blake
2016-05-02 13:26 ` Markus Armbruster
2016-05-02 14:23 ` Eric Blake
2016-05-03 8:30 ` Markus Armbruster
2016-05-03 9:44 ` Dr. David Alan Gilbert
2016-05-03 12:26 ` Markus Armbruster
2016-05-03 12:34 ` Eric Blake
2016-05-03 13:27 ` Dr. David Alan Gilbert
2016-05-04 8:39 ` Markus Armbruster
2016-05-04 8:54 ` Dr. David Alan Gilbert [this message]
2016-05-24 7:15 ` Paolo Bonzini
2016-05-03 13:23 ` Dr. David Alan Gilbert
2016-05-04 9:11 ` Markus Armbruster
2016-05-04 9:22 ` Dr. David Alan Gilbert
2016-05-04 11:37 ` Markus Armbruster
2016-05-04 11:56 ` Dr. David Alan Gilbert
2016-05-04 13:00 ` Markus Armbruster
2016-05-04 13:19 ` Dr. David Alan Gilbert
2016-05-04 14:10 ` Markus Armbruster
2016-05-04 14:53 ` Dr. David Alan Gilbert
2016-05-04 15:17 ` Eric Blake
2016-05-04 15:42 ` Markus Armbruster
2016-04-29 4:23 ` [Qemu-devel] [PATCH v3 11/18] qjson: Remove unused file Eric Blake
2016-04-29 4:23 ` [Qemu-devel] [PATCH v3 12/18] qapi: Add qobject_to_json_pretty_prefix() Eric Blake
2016-05-02 13:56 ` Markus Armbruster
2016-05-02 15:14 ` Eric Blake
2016-05-03 8:32 ` Markus Armbruster
2016-04-29 4:23 ` [Qemu-devel] [PATCH v3 13/18] qapi: Support pretty printing in JSON output visitor Eric Blake
2016-04-29 4:23 ` [Qemu-devel] [PATCH v3 14/18] qemu-img: Use new JSON output formatter Eric Blake
2016-05-02 14:04 ` Markus Armbruster
2016-04-29 4:23 ` [Qemu-devel] [PATCH v3 15/18] qapi: Add new clone visitor Eric Blake
2016-05-02 17:54 ` Markus Armbruster
2016-05-02 19:25 ` Eric Blake
2016-05-03 11:36 ` Markus Armbruster
2016-04-29 4:23 ` [Qemu-devel] [PATCH v3 16/18] sockets: Use new QAPI cloning Eric Blake
2016-04-29 8:30 ` Daniel P. Berrange
2016-04-29 4:23 ` [Qemu-devel] [PATCH v3 17/18] replay: " Eric Blake
2016-04-29 4:23 ` [Qemu-devel] [PATCH v3 18/18] qapi: Add parameter to visit_end_* Eric Blake
2016-05-02 18:20 ` Markus Armbruster
2016-05-02 19:31 ` Eric Blake
2016-05-03 11:53 ` Markus Armbruster
2016-05-03 12:41 ` Eric Blake
2016-05-09 8:50 ` [Qemu-devel] [PATCH v3 00/18] Add qapi-to-JSON and clone visitors Paolo Bonzini
2016-05-09 9:29 ` Paolo Bonzini
2016-05-09 14:52 ` Eric Blake
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=20160504085440.GB2302@work-vm \
--to=dgilbert@redhat.com \
--cc=amit.shah@redhat.com \
--cc=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=famz@redhat.com \
--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).