[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 02/18] postcopy: Require RAMBlocks that are whole pag
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PULL 02/18] postcopy: Require RAMBlocks that are whole pages |
Date: |
Thu, 18 May 2017 19:24:46 +0200 |
From: "Dr. David Alan Gilbert" <address@hidden>
It turns out that it's legal to create a VM with RAMBlocks that aren't
a multiple of the pagesize in use; e.g. a 1025M main memory using
2M host pages. That breaks postcopy's atomic placement of pages,
so disallow it.
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Juan Quintela <address@hidden>
Signed-off-by: Juan Quintela <address@hidden>
---
migration/postcopy-ram.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index a0489f6..63b8501 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -96,14 +96,24 @@ static bool ufd_version_check(int ufd)
/* Callback from postcopy_ram_supported_by_host block iterator.
*/
-static int test_range_shared(const char *block_name, void *host_addr,
+static int test_ramblock_postcopiable(const char *block_name, void *host_addr,
ram_addr_t offset, ram_addr_t length, void
*opaque)
{
- if (qemu_ram_is_shared(qemu_ram_block_by_name(block_name))) {
+ RAMBlock *rb = qemu_ram_block_by_name(block_name);
+ size_t pagesize = qemu_ram_pagesize(rb);
+
+ if (qemu_ram_is_shared(rb)) {
error_report("Postcopy on shared RAM (%s) is not yet supported",
block_name);
return 1;
}
+
+ if (length % pagesize) {
+ error_report("Postcopy requires RAM blocks to be a page size multiple,"
+ " block %s is 0x" RAM_ADDR_FMT " bytes with a "
+ "page size of 0x%zx", block_name, length, pagesize);
+ return 1;
+ }
return 0;
}
@@ -140,7 +150,7 @@ bool postcopy_ram_supported_by_host(void)
}
/* We don't support postcopy with shared RAM yet */
- if (qemu_ram_foreach_block(test_range_shared, NULL)) {
+ if (qemu_ram_foreach_block(test_ramblock_postcopiable, NULL)) {
goto out;
}
--
2.9.3
- [Qemu-devel] [PULL 00/18] Migration pull request, Juan Quintela, 2017/05/18
- [Qemu-devel] [PULL 01/18] migration: Fix non-multiple of page size migration, Juan Quintela, 2017/05/18
- [Qemu-devel] [PULL 02/18] postcopy: Require RAMBlocks that are whole pages,
Juan Quintela <=
- [Qemu-devel] [PULL 03/18] hmp: Use visitor api for hmp_migrate_set_parameter(), Juan Quintela, 2017/05/18
- [Qemu-devel] [PULL 04/18] migration: Create block capability, Juan Quintela, 2017/05/18
- [Qemu-devel] [PULL 05/18] migration: Remove use of old MigrationParams, Juan Quintela, 2017/05/18
- [Qemu-devel] [PULL 06/18] migration: Remove old MigrationParams, Juan Quintela, 2017/05/18
- [Qemu-devel] [PULL 07/18] block migration: Allow compile time disable, Juan Quintela, 2017/05/18
- [Qemu-devel] [PULL 08/18] migration: Create migration/xbzrle.h, Juan Quintela, 2017/05/18
- [Qemu-devel] [PULL 09/18] migration: Split migration/channel.c for channel operations, Juan Quintela, 2017/05/18
- Re: [Qemu-devel] [PULL 00/18] Migration pull request, Stefan Hajnoczi, 2017/05/19