qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Denis V. Lunev" <den@openvz.org>
Cc: "Denis V. Lunev" <den@openvz.org>,
	Igor Redko <redkoi@virtuozzo.com>,
	jsnow@redhat.com, qemu-devel@nongnu.org, annam@virtuozzo.com
Subject: [Qemu-devel] [PATCH 2/8] qemu-file: new hook in qemu-file
Date: Wed,  7 Oct 2015 09:20:40 +0300	[thread overview]
Message-ID: <1444198846-5383-3-git-send-email-den@openvz.org> (raw)
In-Reply-To: <1444198846-5383-1-git-send-email-den@openvz.org>

From: Igor Redko <redkoi@virtuozzo.com>

This patch adds hook_ram_sync() to QEMUFile abstraction. This hook
can be used for passing information about dirty memory.
An alternative is using existing hook_ram_load(). But this hook is
designed for incoming VM migration, so using it for outcoming VM
migration may complicate understanding of the code. On the other
hand, using existing code decreases volume of the patchset and its
impact.

Signed-off-by: Igor Redko <redkoi@virtuozzo.com>
Reviewed-by: Anna Melekhova <annam@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
---
 include/migration/migration.h |  1 +
 include/migration/qemu-file.h |  1 +
 migration/qemu-file.c         | 12 ++++++++++++
 3 files changed, 14 insertions(+)

diff --git a/include/migration/migration.h b/include/migration/migration.h
index 8334621..deb0d21 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -182,6 +182,7 @@ bool migrate_use_events(void);
 void ram_control_before_iterate(QEMUFile *f, uint64_t flags);
 void ram_control_after_iterate(QEMUFile *f, uint64_t flags);
 void ram_control_load_hook(QEMUFile *f, uint64_t flags, void *data);
+void ram_control_sync_hook(QEMUFile *f, uint64_t flags, void *data);
 
 /* Whenever this is found in the data stream, the flags
  * will be passed to ram_control_load_hook in the incoming-migration
diff --git a/include/migration/qemu-file.h b/include/migration/qemu-file.h
index 29a338d..770dd98 100644
--- a/include/migration/qemu-file.h
+++ b/include/migration/qemu-file.h
@@ -105,6 +105,7 @@ typedef struct QEMUFileOps {
     QEMURamHookFunc *before_ram_iterate;
     QEMURamHookFunc *after_ram_iterate;
     QEMURamHookFunc *hook_ram_load;
+    QEMURamHookFunc *hook_ram_sync;
     QEMURamSaveFunc *save_page;
     QEMUFileShutdownFunc *shut_down;
 } QEMUFileOps;
diff --git a/migration/qemu-file.c b/migration/qemu-file.c
index 49addf6..a05d672 100644
--- a/migration/qemu-file.c
+++ b/migration/qemu-file.c
@@ -168,6 +168,18 @@ void ram_control_load_hook(QEMUFile *f, uint64_t flags, void *data)
     }
 }
 
+void ram_control_sync_hook(QEMUFile *f, uint64_t flags, void *data)
+{
+    int ret = 0;
+
+    if (f->ops->hook_ram_sync) {
+        ret = f->ops->hook_ram_sync(f, f->opaque, flags, data);
+        if (ret < 0) {
+            qemu_file_set_error(f, ret);
+        }
+    }
+}
+
 size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset,
                              ram_addr_t offset, size_t size,
                              uint64_t *bytes_sent)
-- 
2.1.4

  parent reply	other threads:[~2015-10-07  6:20 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-06 18:46 [Qemu-devel] Debugging Migration John Snow
2015-10-06 19:00 ` Dr. David Alan Gilbert
2015-10-06 22:40 ` Denis V. Lunev
2015-10-06 23:02   ` John Snow
2015-10-07  6:20     ` [Qemu-devel] [RFC 0/8] QEMUFile-way to gather VM's memory statistics Denis V. Lunev
2015-10-07  6:20       ` [Qemu-devel] [PATCH 1/8] migration: fix expected_downtime Denis V. Lunev
2015-10-07  6:20       ` Denis V. Lunev [this message]
2015-10-07  6:20       ` [Qemu-devel] [PATCH 3/8] migration: add new capability test-only Denis V. Lunev
2015-10-07 15:05         ` Eric Blake
2015-10-08 14:54           ` Denis V. Lunev
2015-10-09 15:19             ` Dr. David Alan Gilbert
2015-10-07  6:20       ` [Qemu-devel] [PATCH 4/8] migration: add function for reseting migration bitmap Denis V. Lunev
2015-10-07  6:20       ` [Qemu-devel] [PATCH 5/8] migration: add draft of new transport Denis V. Lunev
2015-10-07  6:20       ` [Qemu-devel] [PATCH 6/8] migration: implementation of hook_ram_sync Denis V. Lunev
2015-10-07  9:44         ` Paolo Bonzini
2015-10-08 16:51           ` Denis V. Lunev
2015-10-07  9:44         ` Paolo Bonzini
2015-10-08 16:39           ` Denis V. Lunev
2015-10-07 14:03         ` Dr. David Alan Gilbert
2015-10-07  6:20       ` [Qemu-devel] [PATCH 7/8] migration: new migration test mode Denis V. Lunev
2015-10-07 13:56         ` Dr. David Alan Gilbert
2015-10-07 15:08           ` Eric Blake
2015-10-08 17:01             ` Denis V. Lunev
2015-10-08 17:05               ` Dr. David Alan Gilbert
2015-10-08 17:05           ` Denis V. Lunev
2015-10-08 18:57             ` Dr. David Alan Gilbert
2015-10-07  6:20       ` [Qemu-devel] [PATCH 8/8] migration: add output of gathered statistics Denis V. Lunev
2015-10-07 14:19       ` [Qemu-devel] [RFC 0/8] QEMUFile-way to gather VM's memory statistics Dr. David Alan Gilbert
2015-10-07  6:38     ` [Qemu-devel] Debugging Migration Denis V. Lunev

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=1444198846-5383-3-git-send-email-den@openvz.org \
    --to=den@openvz.org \
    --cc=annam@virtuozzo.com \
    --cc=jsnow@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=redkoi@virtuozzo.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).