[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v1 1/5] migration/ram: Fix populate_read_range()
From: |
David Hildenbrand |
Subject: |
[PATCH v1 1/5] migration/ram: Fix populate_read_range() |
Date: |
Thu, 5 Jan 2023 13:45:24 +0100 |
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
Signed-off-by: David Hildenbrand <david@redhat.com>
---
migration/ram.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/migration/ram.c b/migration/ram.c
index 334309f1c6..b8f58d2a40 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.0
- [PATCH v1 0/5] migration/ram: background snapshot fixes and optimiations, David Hildenbrand, 2023/01/05
- [PATCH v1 1/5] migration/ram: Fix populate_read_range(),
David Hildenbrand <=
- [PATCH v1 4/5] migration/ram: Rely on used_length for uffd_change_protection(), David Hildenbrand, 2023/01/05
- [PATCH v1 2/5] migration/ram: Fix error handling in ram_write_tracking_start(), David Hildenbrand, 2023/01/05
- [PATCH v1 3/5] migration/ram: Don't explicitly unprotect when unregistering uffd-wp, David Hildenbrand, 2023/01/05
- [PATCH v1 5/5] migration/ram: Optimize ram_write_tracking_start() for RamDiscardManager, David Hildenbrand, 2023/01/05
- Re: [PATCH v1 0/5] migration/ram: background snapshot fixes and optimiations, Peter Xu, 2023/01/05
- Re: [PATCH v1 0/5] migration/ram: background snapshot fixes and optimiations, David Hildenbrand, 2023/01/23