* [Qemu-devel] [PATCH] migrate.c: migrate_fd_put_buffer: Do not busyloop: stop writing if EWOULDBLOCK
@ 2009-05-19 11:08 Uri Lublin
2009-05-21 9:32 ` Dor Laor
0 siblings, 1 reply; 4+ messages in thread
From: Uri Lublin @ 2009-05-19 11:08 UTC (permalink / raw)
To: qemu-devel
The migration code is non-blocking, designed for live migration.
Practically migrate_fd_put_buffer busy-loops trying to write, as
on many machines EWOULDBLOCK==EAGAIN (look in include/asm-generic/errno.h).
Signed-off-by: Uri Lublin <uril@redhat.com>
---
migration.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/migration.c b/migration.c
index 859d945..ca397fa 100644
--- a/migration.c
+++ b/migration.c
@@ -176,7 +176,7 @@ ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size)
do {
ret = s->write(s, data, size);
- } while (ret == -1 && ((s->get_error(s)) == EINTR || (s->get_error(s)) == EWOULDBLOCK));
+ } while (ret == -1 && ((s->get_error(s)) == EINTR));
if (ret == -1)
ret = -(s->get_error(s));
--
1.6.0.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] migrate.c: migrate_fd_put_buffer: Do not busyloop: stop writing if EWOULDBLOCK
2009-05-19 11:08 [Qemu-devel] [PATCH] migrate.c: migrate_fd_put_buffer: Do not busyloop: stop writing if EWOULDBLOCK Uri Lublin
@ 2009-05-21 9:32 ` Dor Laor
2009-05-22 13:20 ` Anthony Liguori
0 siblings, 1 reply; 4+ messages in thread
From: Dor Laor @ 2009-05-21 9:32 UTC (permalink / raw)
To: Uri Lublin; +Cc: qemu-devel
Uri Lublin wrote:
> The migration code is non-blocking, designed for live migration.
>
> Practically migrate_fd_put_buffer busy-loops trying to write, as
> on many machines EWOULDBLOCK==EAGAIN (look in include/asm-generic/errno.h).
>
> Signed-off-by: Uri Lublin <uril@redhat.com>
> ---
> migration.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/migration.c b/migration.c
> index 859d945..ca397fa 100644
> --- a/migration.c
> +++ b/migration.c
> @@ -176,7 +176,7 @@ ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size)
>
> do {
> ret = s->write(s, data, size);
> - } while (ret == -1 && ((s->get_error(s)) == EINTR || (s->get_error(s)) == EWOULDBLOCK));
> + } while (ret == -1 && ((s->get_error(s)) == EINTR));
>
> if (ret == -1)
> ret = -(s->get_error(s));
>
There is additional stuff that needs to test EWOULDBLOCK in further
locations in the code.
Otherwise migration will fail.
commit 2d875410cb168fa728dcde96885a3e4ddfd0bb58
Author: Dor Laor <dor@redhat.com>
Date: Thu May 21 12:29:39 2009 +0300
The migration code is non-blocking, designed for live migration.
Practically migrate_fd_put_buffer busy-loops trying to write, as
on many machines EWOULDBLOCK==EAGAIN (look in
include/asm-generic/errno.h).
Based on Uri Lublin's patch.
Signed-off-by: Dor Laor <dor@redhat.com>
diff --git a/qemu/buffered_file.c b/qemu/buffered_file.c
index be5baea..34cde6e 100644
--- a/qemu/buffered_file.c
+++ b/qemu/buffered_file.c
@@ -86,7 +86,7 @@ static void buffered_flush(QEMUFileBuffered *s)
ret = s->put_buffer(s->opaque, s->buffer + offset,
s->buffer_size - offset);
- if (ret == -EAGAIN) {
+ if (ret == -EAGAIN || ret == -EWOULDBLOCK) {
dprintf("backend not ready, freezing\n");
s->freeze_output = 1;
break;
@@ -132,7 +132,7 @@ static int buffered_put_buffer(void *opaque, const
uint8_t *buf, int64_t pos, in
}
ret = s->put_buffer(s->opaque, buf + offset, size - offset);
- if (ret == -EAGAIN) {
+ if (ret == -EAGAIN || ret ==-EWOULDBLOCK) {
dprintf("backend not ready, freezing\n");
s->freeze_output = 1;
break;
diff --git a/qemu/migration.c b/qemu/migration.c
index 85757c5..8846eee 100644
--- a/qemu/migration.c
+++ b/qemu/migration.c
@@ -174,7 +174,7 @@ ssize_t migrate_fd_put_buffer(void *opaque, const
void *data, size_t size)
if (ret == -1)
ret = -(s->get_error(s));
- if (ret == -EAGAIN)
+ if (ret == -EAGAIN || ret == -EWOULDBLOCK)
qemu_set_fd_handler2(s->fd, NULL, NULL, migrate_fd_put_notify, s);
return ret;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] migrate.c: migrate_fd_put_buffer: Do not busyloop: stop writing if EWOULDBLOCK
2009-05-21 9:32 ` Dor Laor
@ 2009-05-22 13:20 ` Anthony Liguori
2009-05-23 15:55 ` Dor Laor
0 siblings, 1 reply; 4+ messages in thread
From: Anthony Liguori @ 2009-05-22 13:20 UTC (permalink / raw)
To: dlaor; +Cc: Uri Lublin, qemu-devel
Dor Laor wrote:
> Uri Lublin wrote:
>> The migration code is non-blocking, designed for live migration.
>>
>> Practically migrate_fd_put_buffer busy-loops trying to write, as
>> on many machines EWOULDBLOCK==EAGAIN (look in
>> include/asm-generic/errno.h).
>>
>> Signed-off-by: Uri Lublin <uril@redhat.com>
>> ---
>> migration.c | 2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/migration.c b/migration.c
>> index 859d945..ca397fa 100644
>> --- a/migration.c
>> +++ b/migration.c
>> @@ -176,7 +176,7 @@ ssize_t migrate_fd_put_buffer(void *opaque, const
>> void *data, size_t size)
>>
>> do {
>> ret = s->write(s, data, size);
>> - } while (ret == -1 && ((s->get_error(s)) == EINTR ||
>> (s->get_error(s)) == EWOULDBLOCK));
>> + } while (ret == -1 && ((s->get_error(s)) == EINTR));
>>
>> if (ret == -1)
>> ret = -(s->get_error(s));
>>
> There is additional stuff that needs to test EWOULDBLOCK in further
> locations in the code.
> Otherwise migration will fail.
>
> commit 2d875410cb168fa728dcde96885a3e4ddfd0bb58
> Author: Dor Laor <dor@redhat.com>
> Date: Thu May 21 12:29:39 2009 +0300
>
> The migration code is non-blocking, designed for live migration.
> Practically migrate_fd_put_buffer busy-loops trying to write, as
> on many machines EWOULDBLOCK==EAGAIN (look in
> include/asm-generic/errno.h).
> Based on Uri Lublin's patch.
> Signed-off-by: Dor Laor <dor@redhat.com>
This is whitespace damaged, presumably from copy/paste, can you resend?
--
Regards,
Anthony Liguori
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] migrate.c: migrate_fd_put_buffer: Do not busyloop: stop writing if EWOULDBLOCK
2009-05-22 13:20 ` Anthony Liguori
@ 2009-05-23 15:55 ` Dor Laor
0 siblings, 0 replies; 4+ messages in thread
From: Dor Laor @ 2009-05-23 15:55 UTC (permalink / raw)
To: Anthony Liguori; +Cc: Uri Lublin, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 123 bytes --]
Anthony Liguori wrote:
>
> This is whitespace damaged, presumably from copy/paste, can you resend?
>
Here is a better one.
[-- Attachment #2: 0001-The-migration-code-is-non-blocking-designed-for-liv.patch --]
[-- Type: text/plain, Size: 1913 bytes --]
>From 2d875410cb168fa728dcde96885a3e4ddfd0bb58 Mon Sep 17 00:00:00 2001
From: Dor Laor <dor@redhat.com>
Date: Thu, 21 May 2009 12:29:39 +0300
Subject: [PATCH] The migration code is non-blocking, designed for live migration.
Practically migrate_fd_put_buffer busy-loops trying to write, as
on many machines EWOULDBLOCK==EAGAIN (look in include/asm-generic/errno.h).
Based on Uri Lublin's patch.
Signed-off-by: Dor Laor <dor@redhat.com>
---
qemu/buffered_file.c | 4 ++--
qemu/migration.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/qemu/buffered_file.c b/qemu/buffered_file.c
index be5baea..34cde6e 100644
--- a/qemu/buffered_file.c
+++ b/qemu/buffered_file.c
@@ -86,7 +86,7 @@ static void buffered_flush(QEMUFileBuffered *s)
ret = s->put_buffer(s->opaque, s->buffer + offset,
s->buffer_size - offset);
- if (ret == -EAGAIN) {
+ if (ret == -EAGAIN || ret == -EWOULDBLOCK) {
dprintf("backend not ready, freezing\n");
s->freeze_output = 1;
break;
@@ -132,7 +132,7 @@ static int buffered_put_buffer(void *opaque, const uint8_t *buf, int64_t pos, in
}
ret = s->put_buffer(s->opaque, buf + offset, size - offset);
- if (ret == -EAGAIN) {
+ if (ret == -EAGAIN || ret ==-EWOULDBLOCK) {
dprintf("backend not ready, freezing\n");
s->freeze_output = 1;
break;
diff --git a/qemu/migration.c b/qemu/migration.c
index 85757c5..8846eee 100644
--- a/qemu/migration.c
+++ b/qemu/migration.c
@@ -174,7 +174,7 @@ ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size)
if (ret == -1)
ret = -(s->get_error(s));
- if (ret == -EAGAIN)
+ if (ret == -EAGAIN || ret == -EWOULDBLOCK)
qemu_set_fd_handler2(s->fd, NULL, NULL, migrate_fd_put_notify, s);
return ret;
--
1.5.6.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-05-23 15:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-19 11:08 [Qemu-devel] [PATCH] migrate.c: migrate_fd_put_buffer: Do not busyloop: stop writing if EWOULDBLOCK Uri Lublin
2009-05-21 9:32 ` Dor Laor
2009-05-22 13:20 ` Anthony Liguori
2009-05-23 15:55 ` Dor Laor
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).