Skip to contentSkip to conversation

QEMUFileBuffered: indicate that we're ready when the underlying file is ready

PATCH Applied Avi Kivity 3 participants 6 messages Jul 7, 2010 – Aug 29, 2010

lore
Share & tools
lore

Avi Kivity

author
#0 lore raw

PATCH 1/1 QEMUFileBuffered: indicate that we're ready when the underlying file is ready

QEMUFileBuffered stops writing when the underlying QEMUFile is not ready, and tells its producer so. However, when the underlying QEMUFile becomes ready, it neglects to pass that information along, resulting in stoppage of all data until the next tick (a tenths of a second).

Usually this doesn't matter, because most QEMUFiles used with QEMUFileBuffered are almost always ready, but in the case of exec: migration this is not true, due to the small pipe buffers used to connect to the target process. The result is very slow migration.

Fix by detecting the readiness notification and propagating it. The detection is a little ugly since QEMUFile overloads put_buffer() to send it, but that's the suject for a different patch.

---
 buffered_file.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
buffered_file.c +8 -0
index 54dc6c2..a79264f 100644
@@ -156,6 +156,14 @@ static int buffered_put_buffer(void *opaque, const uint8_t *buf, int64_t pos, in
         offset = size;
     }
 
+    if (pos == 0 && size == 0) {
+        DPRINTF("file is ready\n");
+        if (s->bytes_xfer <= s->xfer_limit) {
+            DPRINTF("notifying client\n");
+            s->put_ready(s->opaque);
+        }
+    }
+
     return offset;
 }
 
Signature · 1 line
1.7.1
author
#1 lore raw
Quoted 5 lines · Avi Kivity

QEMUFileBuffered stops writing when the underlying QEMUFile is not ready, and tells its producer so. However, when the underlying QEMUFile becomes ready, it neglects to pass that information along, resulting in stoppage of all data until the next tick (a tenths of a second).

Quoted 8 lines

Usually this doesn't matter, because most QEMUFiles used with QEMUFileBuffered are almost always ready, but in the case of exec: migration this is not true, due to the small pipe buffers used to connect to the target process. The result is very slow migration.

Fix by detecting the readiness notification and propagating it. The detection is a little ugly since QEMUFile overloads put_buffer() to send it, but that's the suject for a different patch.

Ping.

Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
#2 lore raw
Quoted 11 lines · On Tue, 03 Aug 2010 09:12:52 +0300 Avi Kivity <[email protected]> wrote:
Quoted 10 lines · Avi Kivity

QEMUFileBuffered stops writing when the underlying QEMUFile is not ready, and tells its producer so. However, when the underlying QEMUFile becomes ready, it neglects to pass that information along, resulting in stoppage of all data until the next tick (a tenths of a second).

Usually this doesn't matter, because most QEMUFiles used with QEMUFileBuffered are almost always ready, but in the case of exec: migration this is not true, due to the small pipe buffers used to connect to the target process. The result is very slow migration.

Quoted 5 lines
Quoted 3 lines

Fix by detecting the readiness notification and propagating it. The detection is a little ugly since QEMUFile overloads put_buffer() to send it, but that's the suject for a different patch.

Ping.

I've queued this fix and another one in a 'for-0.13' branch and was planning to send a pull request as soon as Anthony called for 0.13 fixes, however this didn't happen yet and I forgot.

author
#3 lore raw
Quoted 14 lines · Luiz Capitulino
Quoted 11 lines · On Tue, 03 Aug 2010 09:12:52 +0300 Avi Kivity<[email protected]> wrote:
Quoted 10 lines · Avi Kivity

QEMUFileBuffered stops writing when the underlying QEMUFile is not ready, and tells its producer so. However, when the underlying QEMUFile becomes ready, it neglects to pass that information along, resulting in stoppage of all data until the next tick (a tenths of a second).

Usually this doesn't matter, because most QEMUFiles used with QEMUFileBuffered are almost always ready, but in the case of exec: migration this is not true, due to the small pipe buffers used to connect to the target process. The result is very slow migration.

Quoted 7 lines
Quoted 4 lines
Quoted 3 lines

Fix by detecting the readiness notification and propagating it. The detection is a little ugly since QEMUFile overloads put_buffer() to send it, but that's the suject for a different patch.

Ping.

I've queued this fix and another one in a 'for-0.13' branch and was planning to send a pull request as soon as Anthony called for 0.13 fixes, however this didn't happen yet and I forgot.

Ping again.

I don't want to take over Cam's longest-time-to-apply record, so someone apply this please. 0.13 and mainline.

Signature · 1 line
error compiling committee.c: too many arguments to function
#4 lore raw
In reply to Avi Kivity
Quoted 10 lines · Avi Kivity

QEMUFileBuffered stops writing when the underlying QEMUFile is not ready, and tells its producer so. However, when the underlying QEMUFile becomes ready, it neglects to pass that information along, resulting in stoppage of all data until the next tick (a tenths of a second).

Usually this doesn't matter, because most QEMUFiles used with QEMUFileBuffered are almost always ready, but in the case of exec: migration this is not true, due to the small pipe buffers used to connect to the target process. The result is very slow migration.

Quoted 6 lines

Fix by detecting the readiness notification and propagating it. The detection is a little ugly since QEMUFile overloads put_buffer() to send it, but that's the suject for a different patch.

Applied. Thanks.

Regards,

Anthony Liguori

Quoted 24 lines
---
  buffered_file.c |    8 ++++++++
  1 files changed, 8 insertions(+), 0 deletions(-)
buffered_file.c +8 -0
index 54dc6c2..a79264f 100644
@@ -156,6 +156,14 @@ static int buffered_put_buffer(void *opaque, const uint8_t *buf, int64_t pos, in
          offset = size;
      }
 
+    if (pos == 0&&  size == 0) {
+        DPRINTF("file is ready\n");
+        if (s->bytes_xfer<= s->xfer_limit) {
+            DPRINTF("notifying client\n");
+            s->put_ready(s->opaque);
+        }
+    }
+
      return offset;
  }
 
author
#5 lore raw
Quoted 11 lines · Anthony Liguori
Quoted 10 lines · Avi Kivity

QEMUFileBuffered stops writing when the underlying QEMUFile is not ready, and tells its producer so. However, when the underlying QEMUFile becomes ready, it neglects to pass that information along, resulting in stoppage of all data until the next tick (a tenths of a second).

Usually this doesn't matter, because most QEMUFiles used with QEMUFileBuffered are almost always ready, but in the case of exec: migration this is not true, due to the small pipe buffers used to connect to the target process. The result is very slow migration.

Quoted 7 lines
Quoted 5 lines

Fix by detecting the readiness notification and propagating it. The detection is a little ugly since QEMUFile overloads put_buffer() to send it, but that's the suject for a different patch.

Applied. Thanks.

Should be applied to stable-0.13 as well.

Signature · 1 line
error compiling committee.c: too many arguments to function