summaryrefslogtreecommitdiffstats
path: root/exec.c
diff options
context:
space:
mode:
authorPeter Maydell2016-10-17 11:31:10 +0200
committerPeter Maydell2016-10-17 11:31:10 +0200
commit4378caf59edf6df796b9ad3174e5703fd25a781c (patch)
treeea5627e0532e0cbfffd103be09cff3796f5122d0 /exec.c
parentMerge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20161013-1' into st... (diff)
parentdocs/xbzrle: correction (diff)
downloadqemu-4378caf59edf6df796b9ad3174e5703fd25a781c.tar.gz
qemu-4378caf59edf6df796b9ad3174e5703fd25a781c.tar.xz
qemu-4378caf59edf6df796b9ad3174e5703fd25a781c.zip
Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20161014' into staging
migration/next for 20161014 # gpg: Signature made Fri 14 Oct 2016 16:24:13 BST # gpg: using RSA key 0xF487EF185872D723 # gpg: Good signature from "Juan Quintela <quintela@redhat.com>" # gpg: aka "Juan Quintela <quintela@trasno.org>" # Primary key fingerprint: 1899 FF8E DEBF 58CC EE03 4B82 F487 EF18 5872 D723 * remotes/juanquintela/tags/migration/20161014: docs/xbzrle: correction migrate: move max-bandwidth and downtime-limit to migrate_set_parameter migration: Fix seg with missing port migration/postcopy: Explicitly disallow huge pages RAMBlocks: Store page size Postcopy vs xbzrle: Don't send xbzrle pages once in postcopy [for 2.8] migrate: Fix bounds check for migration parameters in migration.c migrate: Use boxed qapi for migrate-set-parameters migrate: Share common MigrationParameters struct migrate: Fix cpu-throttle-increment regression in HMP migration/rdma: Don't flag an error when we've been told about one migration: Make failed migration load set file error migration/rdma: Pass qemu_file errors across link migration: Report values for comparisons migration: report an error giving the failed field Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/exec.c b/exec.c
index 374c364dff..e63c5a1bd4 100644
--- a/exec.c
+++ b/exec.c
@@ -1199,7 +1199,6 @@ static void *file_ram_alloc(RAMBlock *block,
char *c;
void *area = MAP_FAILED;
int fd = -1;
- int64_t page_size;
if (kvm_enabled() && !kvm_has_sync_mmu()) {
error_setg(errp,
@@ -1254,17 +1253,17 @@ static void *file_ram_alloc(RAMBlock *block,
*/
}
- page_size = qemu_fd_getpagesize(fd);
- block->mr->align = MAX(page_size, QEMU_VMALLOC_ALIGN);
+ block->page_size = qemu_fd_getpagesize(fd);
+ block->mr->align = MAX(block->page_size, QEMU_VMALLOC_ALIGN);
- if (memory < page_size) {
+ if (memory < block->page_size) {
error_setg(errp, "memory size 0x" RAM_ADDR_FMT " must be equal to "
- "or larger than page size 0x%" PRIx64,
- memory, page_size);
+ "or larger than page size 0x%zx",
+ memory, block->page_size);
goto error;
}
- memory = ROUND_UP(memory, page_size);
+ memory = ROUND_UP(memory, block->page_size);
/*
* ftruncate is not supported by hugetlbfs in older
@@ -1419,6 +1418,11 @@ void qemu_ram_unset_idstr(RAMBlock *block)
}
}
+size_t qemu_ram_pagesize(RAMBlock *rb)
+{
+ return rb->page_size;
+}
+
static int memory_try_enable_merging(void *addr, size_t len)
{
if (!machine_mem_merge(current_machine)) {
@@ -1658,6 +1662,7 @@ RAMBlock *qemu_ram_alloc_internal(ram_addr_t size, ram_addr_t max_size,
new_block->max_length = max_size;
assert(max_size >= size);
new_block->fd = -1;
+ new_block->page_size = getpagesize();
new_block->host = host;
if (host) {
new_block->flags |= RAM_PREALLOC;