From: Juan Quintela <quintela@redhat.com>
To: Halil Pasic <pasic@linux.vnet.ibm.com>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>,
Christian Borntraeger <borntraeger@de.ibm.com>,
Cornelia Huck <cohuck@redhat.com>,
Yi Min Zhao <zyimin@linux.vnet.ibm.com>,
Pierre Morel <pmorel@linux.vnet.ibm.com>,
qemu-devel <qemu-devel@nongnu.org>,
Alexander Graf <agraf@suse.de>, Thomas Huth <thuth@redhat.com>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH/s390-next 3/3] s390x/flic: migrate ais states
Date: Tue, 18 Jul 2017 12:31:47 +0200 [thread overview]
Message-ID: <87379uyr1o.fsf@secure.mitica> (raw)
In-Reply-To: <1a32d619-0b5b-fe11-36b4-94ef6bdcb331@linux.vnet.ibm.com> (Halil Pasic's message of "Thu, 13 Jul 2017 17:45:28 +0200")
Halil Pasic <pasic@linux.vnet.ibm.com> wrote:
> On 07/13/2017 05:11 PM, Dr. David Alan Gilbert wrote:
>> * Christian Borntraeger (borntraeger@de.ibm.com) wrote:
>>> On 07/13/2017 04:49 PM, Dr. David Alan Gilbert wrote:
>>>> * Halil Pasic (pasic@linux.vnet.ibm.com) wrote:
> @Dave:
> There are a couple of questions I'm gonna have to ask/investigate should
> it be me doing the 'return value for pre_save' (also notes to myself):
As Dave said, just changing the prototype and fix callers will do a lot
of good.
> (keep the current qemu_file_set_error mechanism) or would you prefer
> things converted? IMHO having a single method would be cleaner, but I
> have not looked into this in great detail.
Error handling is a mess in qemu (in general), and worse in migration
(in particular).
History lesson (that is even older than my involvement with qemu)
It used to be that evrything was done with callbacks in the main loop.
So there were not an easy way to pass error messages. Everything was
done through qemu_file_set_error() (well, actually it was done by hand).
Then the migration thread came, and we can do things asyncronously, so
we don't need to store the state in callbacks. I did some changes long,
long ago about returning error messages instead of:
if (error) {
qemu_file_set_error(f, -error);
return;
}
to
if (error) {
return -error;
}
/* fix things to make errors negative, etc, etc, you get the idea */
But we need to fix some things to make this work.
Reception side is done through a coroutine, and then some of such things
still stand. Moving to a thread would be a good idea at some point O:-)
> Also the question what is the semantic of qemu_file_set_error arises.
> It ain't documented and I would intuitively suspect that it's rather
> about the 'file' (that is transport) than the whole migration.
We test in the "interesting" parts if there is an error on the file,
from vmstate_load_state()
} else {
ret = field->info->get(f, curr_elem, size, field);
}
if (ret >= 0) {
ret = qemu_file_get_error(f);
}
if (ret < 0) {
qemu_file_set_error(f, ret);
error_report("Failed to load %s:%s", vmsd->name,
field->name);
trace_vmstate_load_field_error(field->name, ret);
return ret;
}
You can see how many convolutions we do to maintain the error returned
and the one in QEMUFile in sync. Removing the one in QEMUFile would be
a good idea, but requires lots of changes.
For starters, see that all qemu_get_* return void.
To add insult to injury:
int qemu_peek_byte(QEMUFile *f, int offset)
{
int index = f->buf_index + offset;
assert(!qemu_file_is_writable(f));
assert(offset < IO_BUF_SIZE);
if (index >= f->buf_size) {
qemu_fill_buffer(f);
index = f->buf_index + offset;
if (index >= f->buf_size) {
return 0;
}
}
return f->buf[index];
}
I.e. it never returns errors, if there is nothing to read, it just
return 0.
/me stops
>
>
>
>>>>
>>>> I *think* the migration code should spot that before it finishes
>>>> but it might carry on for a little while before it does.
>>>
>>> I will keep this patch as is, since this is one of the "should not happen"
>>> cases.
Later, Juan.
next prev parent reply other threads:[~2017-07-18 10:31 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-13 10:40 [Qemu-devel] [PATCH/s390-next 0/3] s390x: remaining pci related fixes Christian Borntraeger
2017-07-13 10:40 ` [Qemu-devel] [PATCH/s390-next 1/3] s390x: initialize cpu firstly Christian Borntraeger
2017-07-13 11:55 ` Cornelia Huck
2017-07-13 10:40 ` [Qemu-devel] [PATCH/s390-next 2/3] s390x/cpumodel: add zpci, aen and ais facilities Christian Borntraeger
2017-07-13 12:11 ` Cornelia Huck
2017-07-13 12:29 ` Christian Borntraeger
2017-07-13 13:06 ` Cornelia Huck
2017-07-13 13:11 ` Christian Borntraeger
2017-07-13 13:15 ` Cornelia Huck
2017-07-13 12:41 ` Christian Borntraeger
2017-07-13 12:57 ` Cornelia Huck
2017-07-13 13:07 ` Halil Pasic
2017-07-13 10:40 ` [Qemu-devel] [PATCH/s390-next 3/3] s390x/flic: migrate ais states Christian Borntraeger
2017-07-13 12:27 ` Cornelia Huck
2017-07-13 13:02 ` Christian Borntraeger
2017-07-13 13:10 ` Cornelia Huck
2017-07-13 13:41 ` Halil Pasic
2017-07-13 13:58 ` Christian Borntraeger
2017-07-13 14:01 ` Cornelia Huck
2017-07-13 13:18 ` Halil Pasic
2017-07-13 14:49 ` Dr. David Alan Gilbert
2017-07-13 15:05 ` Christian Borntraeger
2017-07-13 15:11 ` Dr. David Alan Gilbert
2017-07-13 15:45 ` Halil Pasic
2017-07-13 15:54 ` Dr. David Alan Gilbert
2017-07-18 10:31 ` Juan Quintela [this message]
2017-07-18 14:07 ` Dr. David Alan Gilbert
2017-07-18 18:24 ` Halil Pasic
2017-07-13 15:27 ` Cornelia Huck
2017-07-13 10:58 ` [Qemu-devel] [PATCH/s390-next 0/3] s390x: remaining pci related fixes Christian Borntraeger
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=87379uyr1o.fsf@secure.mitica \
--to=quintela@redhat.com \
--cc=agraf@suse.de \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=dgilbert@redhat.com \
--cc=pasic@linux.vnet.ibm.com \
--cc=pmorel@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--cc=thuth@redhat.com \
--cc=zyimin@linux.vnet.ibm.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).