[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 17/27] postcopy: Record largest page size
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[Qemu-devel] [PULL 17/27] postcopy: Record largest page size |
Date: |
Tue, 28 Feb 2017 12:40:46 +0000 |
From: "Dr. David Alan Gilbert" <address@hidden>
Record the largest page size in use; we'll need it soon for allocating
temporary buffers.
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Juan Quintela <address@hidden>
Reviewed-by: Laurent Vivier <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
---
exec.c | 13 +++++++++++++
include/exec/cpu-common.h | 1 +
include/migration/migration.h | 1 +
migration/migration.c | 1 +
4 files changed, 16 insertions(+)
diff --git a/exec.c b/exec.c
index 24cdf64..785d20f 100644
--- a/exec.c
+++ b/exec.c
@@ -1524,6 +1524,19 @@ size_t qemu_ram_pagesize(RAMBlock *rb)
return rb->page_size;
}
+/* Returns the largest size of page in use */
+size_t qemu_ram_pagesize_largest(void)
+{
+ RAMBlock *block;
+ size_t largest = 0;
+
+ QLIST_FOREACH_RCU(block, &ram_list.blocks, next) {
+ largest = MAX(largest, qemu_ram_pagesize(block));
+ }
+
+ return largest;
+}
+
static int memory_try_enable_merging(void *addr, size_t len)
{
if (!machine_mem_merge(current_machine)) {
diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
index 1350c2e..8c305aa 100644
--- a/include/exec/cpu-common.h
+++ b/include/exec/cpu-common.h
@@ -64,6 +64,7 @@ void qemu_ram_set_idstr(RAMBlock *block, const char *name,
DeviceState *dev);
void qemu_ram_unset_idstr(RAMBlock *block);
const char *qemu_ram_get_idstr(RAMBlock *rb);
size_t qemu_ram_pagesize(RAMBlock *block);
+size_t qemu_ram_pagesize_largest(void);
void cpu_physical_memory_rw(hwaddr addr, uint8_t *buf,
int len, int is_write);
diff --git a/include/migration/migration.h b/include/migration/migration.h
index 6272adf..08b98e9 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -93,6 +93,7 @@ struct MigrationIncomingState {
*/
QemuEvent main_thread_load_event;
+ size_t largest_page_size;
bool have_fault_thread;
QemuThread fault_thread;
QemuSemaphore fault_thread_sem;
diff --git a/migration/migration.c b/migration/migration.c
index 481c540..3dab684 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -387,6 +387,7 @@ static void process_incoming_migration_co(void *opaque)
int ret;
mis->from_src_file = f;
+ mis->largest_page_size = qemu_ram_pagesize_largest();
postcopy_state_set(POSTCOPY_INCOMING_NONE);
migrate_set_state(&mis->state, MIGRATION_STATUS_NONE,
MIGRATION_STATUS_ACTIVE);
--
2.9.3
- [Qemu-devel] [PULL 06/27] tests/test-vmstate.c: test array of ptr to primitive, (continued)
- [Qemu-devel] [PULL 06/27] tests/test-vmstate.c: test array of ptr to primitive, Dr. David Alan Gilbert (git), 2017/02/28
- [Qemu-devel] [PULL 07/27] vmstate-static-checker: update white list with spapr_pci, Dr. David Alan Gilbert (git), 2017/02/28
- [Qemu-devel] [PULL 08/27] migrate: Introduce a 'dc->vmsd' check to avoid segfault for --only-migratable, Dr. David Alan Gilbert (git), 2017/02/28
- [Qemu-devel] [PULL 09/27] migration: fix id leak regression, Dr. David Alan Gilbert (git), 2017/02/28
- [Qemu-devel] [PULL 10/27] migration: Update docs to discourage version bumps, Dr. David Alan Gilbert (git), 2017/02/28
- [Qemu-devel] [PULL 12/27] postcopy: Transmit ram size summary word, Dr. David Alan Gilbert (git), 2017/02/28
- [Qemu-devel] [PULL 11/27] migration: fix use-after-free of to_dst_file, Dr. David Alan Gilbert (git), 2017/02/28
- [Qemu-devel] [PULL 13/27] postcopy: Transmit and compare individual page sizes, Dr. David Alan Gilbert (git), 2017/02/28
- [Qemu-devel] [PULL 14/27] postcopy: Chunk discards for hugepages, Dr. David Alan Gilbert (git), 2017/02/28
- [Qemu-devel] [PULL 16/27] postcopy: enhance ram_block_discard_range for hugepages, Dr. David Alan Gilbert (git), 2017/02/28
- [Qemu-devel] [PULL 17/27] postcopy: Record largest page size,
Dr. David Alan Gilbert (git) <=
- [Qemu-devel] [PULL 15/27] exec: ram_block_discard_range, Dr. David Alan Gilbert (git), 2017/02/28
- [Qemu-devel] [PULL 18/27] postcopy: Plumb pagesize down into place helpers, Dr. David Alan Gilbert (git), 2017/02/28
- [Qemu-devel] [PULL 19/27] postcopy: Use temporary for placing zero huge pages, Dr. David Alan Gilbert (git), 2017/02/28
- [Qemu-devel] [PULL 20/27] postcopy: Load huge pages in one go, Dr. David Alan Gilbert (git), 2017/02/28
- [Qemu-devel] [PULL 21/27] postcopy: Mask fault addresses to huge page boundary, Dr. David Alan Gilbert (git), 2017/02/28
- [Qemu-devel] [PULL 22/27] postcopy: Send whole huge pages, Dr. David Alan Gilbert (git), 2017/02/28
- [Qemu-devel] [PULL 23/27] postcopy: Allow hugepages, Dr. David Alan Gilbert (git), 2017/02/28
- [Qemu-devel] [PULL 24/27] postcopy: Update userfaultfd.h header, Dr. David Alan Gilbert (git), 2017/02/28
- [Qemu-devel] [PULL 25/27] postcopy: Check for userfault+hugepage feature, Dr. David Alan Gilbert (git), 2017/02/28
- [Qemu-devel] [PULL 26/27] postcopy: Add doc about hugepages and postcopy, Dr. David Alan Gilbert (git), 2017/02/28