qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/2] Migration PULL request
@ 2015-12-02 23:22 Juan Quintela
  2015-12-02 23:23 ` [Qemu-devel] [PULL 1/2] migration: Clean up use of g_poll() in socket_writev_buffer() Juan Quintela
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Juan Quintela @ 2015-12-02 23:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: amit.shah, dgilbert

Hi

Two small fixes

- Coverity error discovered by Paole that got lost on the track
  (it is a needed cast).
  We got this one in RHEL in the past, so it is not only theoretical.v
- Armbru fix for g_poll() returning one error

Please, apply.


The following changes since commit cf22132367a188426ac07cf1805b214dd2d0cc80:

  Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2015-12-02 17:05:34 +0000)

are available in the git repository at:

  git://github.com/juanquintela/qemu.git tags/migration/20151203

for you to fetch changes up to a694ee343d13159d214823294bbda08e4bdac685:

  migration: do floating-point division (2015-12-03 00:03:00 +0100)

----------------------------------------------------------------
migration/next for 20151203

----------------------------------------------------------------
Markus Armbruster (1):
      migration: Clean up use of g_poll() in socket_writev_buffer()

Paolo Bonzini (1):
      migration: do floating-point division

 migration/migration.c      | 2 +-
 migration/qemu-file-unix.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PULL 1/2] migration: Clean up use of g_poll() in socket_writev_buffer()
  2015-12-02 23:22 [Qemu-devel] [PULL 0/2] Migration PULL request Juan Quintela
@ 2015-12-02 23:23 ` Juan Quintela
  2015-12-02 23:23 ` [Qemu-devel] [PULL 2/2] migration: do floating-point division Juan Quintela
  2015-12-03 11:08 ` [Qemu-devel] [PULL 0/2] Migration PULL request Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Juan Quintela @ 2015-12-02 23:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: amit.shah, dgilbert, Markus Armbruster

From: Markus Armbruster <armbru@redhat.com>

socket_writev_buffer() writes in a loop, using g_poll() to block.  If
g_poll() fails, it tries to write more before the file descriptor is
ready.  In theory, this could go into a tight loop.  In practice,
errors other than EINTR are really unlikely, and when they happen,
we're probably screwed anyway, so we can just as well loop.

Clean it up a bit: retry poll on EINTR, keep ignoring other errors.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 migration/qemu-file-unix.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/migration/qemu-file-unix.c b/migration/qemu-file-unix.c
index c503b02..6ca53e7 100644
--- a/migration/qemu-file-unix.c
+++ b/migration/qemu-file-unix.c
@@ -72,7 +72,8 @@ static ssize_t socket_writev_buffer(void *opaque, struct iovec *iov, int iovcnt,
             pfd.fd = s->fd;
             pfd.events = G_IO_OUT | G_IO_ERR;
             pfd.revents = 0;
-            g_poll(&pfd, 1 /* 1 fd */, -1 /* no timeout */);
+            TFR(err = g_poll(&pfd, 1, -1 /* no timeout */));
+            /* Errors other than EINTR intentionally ignored */
         }
      }

-- 
2.5.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PULL 2/2] migration: do floating-point division
  2015-12-02 23:22 [Qemu-devel] [PULL 0/2] Migration PULL request Juan Quintela
  2015-12-02 23:23 ` [Qemu-devel] [PULL 1/2] migration: Clean up use of g_poll() in socket_writev_buffer() Juan Quintela
@ 2015-12-02 23:23 ` Juan Quintela
  2015-12-03 11:08 ` [Qemu-devel] [PULL 0/2] Migration PULL request Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Juan Quintela @ 2015-12-02 23:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: amit.shah, Paolo Bonzini, dgilbert

From: Paolo Bonzini <pbonzini@redhat.com>

Dividing integer expressions transferred_bytes and time_spent, and then converting
the integer quotient to type double. Any remainder, or fractional part of the
quotient, is ignored.  Fix this.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 migration/migration.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/migration/migration.c b/migration/migration.c
index 1a42aee..adc6b6f 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1674,7 +1674,7 @@ static void *migration_thread(void *opaque)
         if (current_time >= initial_time + BUFFER_DELAY) {
             uint64_t transferred_bytes = qemu_ftell(s->file) - initial_bytes;
             uint64_t time_spent = current_time - initial_time;
-            double bandwidth = transferred_bytes / time_spent;
+            double bandwidth = (double)transferred_bytes / time_spent;
             max_size = bandwidth * migrate_max_downtime() / 1000000;

             s->mbps = time_spent ? (((double) transferred_bytes * 8.0) /
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PULL 0/2] Migration PULL request
  2015-12-02 23:22 [Qemu-devel] [PULL 0/2] Migration PULL request Juan Quintela
  2015-12-02 23:23 ` [Qemu-devel] [PULL 1/2] migration: Clean up use of g_poll() in socket_writev_buffer() Juan Quintela
  2015-12-02 23:23 ` [Qemu-devel] [PULL 2/2] migration: do floating-point division Juan Quintela
@ 2015-12-03 11:08 ` Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2015-12-03 11:08 UTC (permalink / raw)
  To: Juan Quintela; +Cc: Amit Shah, QEMU Developers, Dr. David Alan Gilbert

On 2 December 2015 at 23:22, Juan Quintela <quintela@redhat.com> wrote:
> Hi
>
> Two small fixes
>
> - Coverity error discovered by Paole that got lost on the track
>   (it is a needed cast).
>   We got this one in RHEL in the past, so it is not only theoretical.v
> - Armbru fix for g_poll() returning one error
>
> Please, apply.
>
>
> The following changes since commit cf22132367a188426ac07cf1805b214dd2d0cc80:
>
>   Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2015-12-02 17:05:34 +0000)
>
> are available in the git repository at:
>
>   git://github.com/juanquintela/qemu.git tags/migration/20151203
>
> for you to fetch changes up to a694ee343d13159d214823294bbda08e4bdac685:
>
>   migration: do floating-point division (2015-12-03 00:03:00 +0100)
>
> ----------------------------------------------------------------
> migration/next for 20151203
>
> ----------------------------------------------------------------
> Markus Armbruster (1):
>       migration: Clean up use of g_poll() in socket_writev_buffer()
>
> Paolo Bonzini (1):
>       migration: do floating-point division

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-12-03 11:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-02 23:22 [Qemu-devel] [PULL 0/2] Migration PULL request Juan Quintela
2015-12-02 23:23 ` [Qemu-devel] [PULL 1/2] migration: Clean up use of g_poll() in socket_writev_buffer() Juan Quintela
2015-12-02 23:23 ` [Qemu-devel] [PULL 2/2] migration: do floating-point division Juan Quintela
2015-12-03 11:08 ` [Qemu-devel] [PULL 0/2] Migration PULL request Peter Maydell

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).