* [Qemu-devel] [PATCH 1/2] migrate.c: migrate_fd_put_buffer(): Do not busyloop: stop writing if EWOULDBLOCK
@ 2009-02-03 11:04 Uri Lublin
2009-02-03 11:04 ` [Qemu-devel] [DEBUGGING DO-NOT-COMMIT 2/2]: debugging migration busy-looping Uri Lublin
0 siblings, 1 reply; 2+ messages in thread
From: Uri Lublin @ 2009-02-03 11:04 UTC (permalink / raw)
To: qemu-devel; +Cc: Uri Lublin
Theoretically the migration code is non-blocking, designed for live migration.
Practically migrate_fd_put_buffer busy-loops trying to write. That's since
on many machines EWOULDBLOCK==EAGAIN (e.g. look in
<linux>/include/asm-generic/errno.h).
Busy looping is much worse then blocking (in case a write actually blocks).
Fixed by removing "(s->get_error(s)) == EWOULDBLOCK)" from the while condition.
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 0ef777a..e8bafa6 100644
--- a/migration.c
+++ b/migration.c
@@ -168,7 +168,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] 2+ messages in thread
* [Qemu-devel] [DEBUGGING DO-NOT-COMMIT 2/2]: debugging migration busy-looping
2009-02-03 11:04 [Qemu-devel] [PATCH 1/2] migrate.c: migrate_fd_put_buffer(): Do not busyloop: stop writing if EWOULDBLOCK Uri Lublin
@ 2009-02-03 11:04 ` Uri Lublin
0 siblings, 0 replies; 2+ messages in thread
From: Uri Lublin @ 2009-02-03 11:04 UTC (permalink / raw)
To: qemu-devel; +Cc: Uri Lublin
Try it with/without fix for migration busy-loop, and migrate
a VM. (without the fix, patch fails just manually fix it).
To see the problem clearly try to suspend the destination while a migration
process is active (e.g. with CTRL-z and fg).
Signed-off-by: Uri Lublin <uril@redhat.com>
---
migration.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/migration.c b/migration.c
index e8bafa6..5db9c47 100644
--- a/migration.c
+++ b/migration.c
@@ -165,11 +165,14 @@ ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size)
{
FdMigrationState *s = opaque;
ssize_t ret;
+ int n = 0;
do {
ret = s->write(s, data, size);
+ if (++n % 1000 == 0) printf("LOOP size=%lu n=%d\n", size, n);
} while (ret == -1 && s->get_error(s) == EINTR);
+ if (n > 4) printf("OUT size=%lu n=%d\n", size, n);
if (ret == -1)
ret = -(s->get_error(s));
--
1.6.0.6
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-02-03 11:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-03 11:04 [Qemu-devel] [PATCH 1/2] migrate.c: migrate_fd_put_buffer(): Do not busyloop: stop writing if EWOULDBLOCK Uri Lublin
2009-02-03 11:04 ` [Qemu-devel] [DEBUGGING DO-NOT-COMMIT 2/2]: debugging migration busy-looping Uri Lublin
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).