|
|
9ae3a8 |
From 6499b6033f8aff6482cfa7942b0c16b386a519f5 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
Message-Id: <6499b6033f8aff6482cfa7942b0c16b386a519f5.1387382496.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
In-Reply-To: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
References: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
From: Nigel Croxon <ncroxon@redhat.com>
|
|
|
9ae3a8 |
Date: Thu, 14 Nov 2013 22:52:50 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 14/46] rdma: introduce ram_handle_compressed()
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Nigel Croxon <ncroxon@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1384469598-13137-15-git-send-email-ncroxon@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 55706
|
|
|
9ae3a8 |
O-Subject: [RHEL7.0 PATCH 14/42] rdma: introduce ram_handle_compressed()
|
|
|
9ae3a8 |
Bugzilla: 1011720
|
|
|
9ae3a8 |
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Amit Shah <amit.shah@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Bugzilla: 1011720
|
|
|
9ae3a8 |
https://bugzilla.redhat.com/show_bug.cgi?id=1011720
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
>From commit ID:
|
|
|
9ae3a8 |
commit 44c3b58cf9b2c91a38363f0b45d20f3f40b8f2b3
|
|
|
9ae3a8 |
Author: Michael R. Hines <mrhines@us.ibm.com>
|
|
|
9ae3a8 |
Date: Mon Jul 22 10:01:53 2013 -0400
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
rdma: introduce ram_handle_compressed()
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
This gives RDMA shared access to madvise() on the destination side
|
|
|
9ae3a8 |
when an entire chunk is found to be zero.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Reviewed-by: Juan Quintela <quintela@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Chegu Vinod <chegu_vinod@hp.com>
|
|
|
9ae3a8 |
Tested-by: Chegu Vinod <chegu_vinod@hp.com>
|
|
|
9ae3a8 |
Tested-by: Michael R. Hines <mrhines@us.ibm.com>
|
|
|
9ae3a8 |
Signed-off-by: Michael R. Hines <mrhines@us.ibm.com>
|
|
|
9ae3a8 |
Signed-off-by: Juan Quintela <quintela@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
arch_init.c | 29 +++++++++++++++++++----------
|
|
|
9ae3a8 |
include/migration/migration.h | 2 ++
|
|
|
9ae3a8 |
2 files changed, 21 insertions(+), 10 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Michal Novotny <minovotn@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
arch_init.c | 29 +++++++++++++++++++----------
|
|
|
9ae3a8 |
include/migration/migration.h | 2 ++
|
|
|
9ae3a8 |
2 files changed, 21 insertions(+), 10 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/arch_init.c b/arch_init.c
|
|
|
9ae3a8 |
index e940ede..e7da520 100644
|
|
|
9ae3a8 |
--- a/arch_init.c
|
|
|
9ae3a8 |
+++ b/arch_init.c
|
|
|
9ae3a8 |
@@ -809,6 +809,24 @@ static inline void *host_from_stream_offset(QEMUFile *f,
|
|
|
9ae3a8 |
return NULL;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+/*
|
|
|
9ae3a8 |
+ * If a page (or a whole RDMA chunk) has been
|
|
|
9ae3a8 |
+ * determined to be zero, then zap it.
|
|
|
9ae3a8 |
+ */
|
|
|
9ae3a8 |
+void ram_handle_compressed(void *host, uint8_t ch, uint64_t size)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ if (ch != 0 || !is_zero_page(host)) {
|
|
|
9ae3a8 |
+ memset(host, ch, size);
|
|
|
9ae3a8 |
+#ifndef _WIN32
|
|
|
9ae3a8 |
+ if (ch == 0 &&
|
|
|
9ae3a8 |
+ (!kvm_enabled() || kvm_has_sync_mmu()) &&
|
|
|
9ae3a8 |
+ getpagesize() <= TARGET_PAGE_SIZE) {
|
|
|
9ae3a8 |
+ qemu_madvise(host, TARGET_PAGE_SIZE, QEMU_MADV_DONTNEED);
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+#endif
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
static int ram_load(QEMUFile *f, void *opaque, int version_id)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
ram_addr_t addr;
|
|
|
9ae3a8 |
@@ -876,16 +894,7 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id)
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
ch = qemu_get_byte(f);
|
|
|
9ae3a8 |
- if (ch != 0 || !is_zero_page(host)) {
|
|
|
9ae3a8 |
- memset(host, ch, TARGET_PAGE_SIZE);
|
|
|
9ae3a8 |
-#ifndef _WIN32
|
|
|
9ae3a8 |
- if (ch == 0 &&
|
|
|
9ae3a8 |
- (!kvm_enabled() || kvm_has_sync_mmu()) &&
|
|
|
9ae3a8 |
- getpagesize() <= TARGET_PAGE_SIZE) {
|
|
|
9ae3a8 |
- qemu_madvise(host, TARGET_PAGE_SIZE, QEMU_MADV_DONTNEED);
|
|
|
9ae3a8 |
- }
|
|
|
9ae3a8 |
-#endif
|
|
|
9ae3a8 |
- }
|
|
|
9ae3a8 |
+ ram_handle_compressed(host, ch, TARGET_PAGE_SIZE);
|
|
|
9ae3a8 |
} else if (flags & RAM_SAVE_FLAG_PAGE) {
|
|
|
9ae3a8 |
void *host;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/include/migration/migration.h b/include/migration/migration.h
|
|
|
9ae3a8 |
index 701709a..90b5021 100644
|
|
|
9ae3a8 |
--- a/include/migration/migration.h
|
|
|
9ae3a8 |
+++ b/include/migration/migration.h
|
|
|
9ae3a8 |
@@ -109,6 +109,8 @@ uint64_t xbzrle_mig_pages_transferred(void);
|
|
|
9ae3a8 |
uint64_t xbzrle_mig_pages_overflow(void);
|
|
|
9ae3a8 |
uint64_t xbzrle_mig_pages_cache_miss(void);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+void ram_handle_compressed(void *host, uint8_t ch, uint64_t size);
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
/**
|
|
|
9ae3a8 |
* @migrate_add_blocker - prevent migration from proceeding
|
|
|
9ae3a8 |
*
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.11.7
|
|
|
9ae3a8 |
|