[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 07/26] migration/ram: Fix populate_read_range()
From: |
Juan Quintela |
Subject: |
[PULL 07/26] migration/ram: Fix populate_read_range() |
Date: |
Thu, 2 Feb 2023 17:06:21 +0100 |
From: David Hildenbrand <david@redhat.com>
Unfortunately, commit f7b9dcfbcf44 broke populate_read_range(): the loop
end condition is very wrong, resulting in that function not populating the
full range. Lets' fix that.
Fixes: f7b9dcfbcf44 ("migration/ram: Factor out populating pages readable in
ram_block_populate_pages()")
Cc: qemu-stable@nongnu.org
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
migration/ram.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/migration/ram.c b/migration/ram.c
index 885d7dbf23..ba228eead4 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -1774,13 +1774,15 @@ out:
static inline void populate_read_range(RAMBlock *block, ram_addr_t offset,
ram_addr_t size)
{
+ const ram_addr_t end = offset + size;
+
/*
* We read one byte of each page; this will preallocate page tables if
* required and populate the shared zeropage on MAP_PRIVATE anonymous
memory
* where no page was populated yet. This might require adaption when
* supporting other mappings, like shmem.
*/
- for (; offset < size; offset += block->page_size) {
+ for (; offset < end; offset += block->page_size) {
char tmp = *((char *)block->host + offset);
/* Don't optimize the read out */
--
2.39.1
- [PULL 00/26] Next patches, Juan Quintela, 2023/02/02
- [PULL 02/26] migration: No save_live_pending() method uses the QEMUFile parameter, Juan Quintela, 2023/02/02
- [PULL 01/26] migration: Fix migration crash when target psize larger than host, Juan Quintela, 2023/02/02
- [PULL 04/26] migration: Remove unused threshold_size parameter, Juan Quintela, 2023/02/02
- [PULL 05/26] migration: simplify migration_iteration_run(), Juan Quintela, 2023/02/02
- [PULL 07/26] migration/ram: Fix populate_read_range(),
Juan Quintela <=
- [PULL 09/26] migration/ram: Don't explicitly unprotect when unregistering uffd-wp, Juan Quintela, 2023/02/02
- [PULL 08/26] migration/ram: Fix error handling in ram_write_tracking_start(), Juan Quintela, 2023/02/02
- [PULL 10/26] migration/ram: Rely on used_length for uffd_change_protection(), Juan Quintela, 2023/02/02
- [PULL 12/26] migration/savevm: Move more savevm handling into vmstate_save(), Juan Quintela, 2023/02/02
- [PULL 13/26] migration/savevm: Prepare vmdesc json writer in qemu_savevm_state_setup(), Juan Quintela, 2023/02/02
- [PULL 15/26] migration/vmstate: Introduce VMSTATE_WITH_TMP_TEST() and VMSTATE_BITMAP_TEST(), Juan Quintela, 2023/02/02
- [PULL 14/26] migration/savevm: Allow immutable device state to be migrated early (i.e., before RAM), Juan Quintela, 2023/02/02
- [PULL 16/26] migration/ram: Factor out check for advised postcopy, Juan Quintela, 2023/02/02
- [PULL 06/26] util/userfaultfd: Add uffd_open(), Juan Quintela, 2023/02/02
- [PULL 17/26] virtio-mem: Fail if a memory backend with "prealloc=on" is specified, Juan Quintela, 2023/02/02