[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 05/10] physmem: Fix migration dirty bitmap coherency with TCG memo
From: |
peterx |
Subject: |
[PULL 05/10] physmem: Fix migration dirty bitmap coherency with TCG memory access |
Date: |
Sun, 17 Mar 2024 16:57:58 -0400 |
From: Nicholas Piggin <npiggin@gmail.com>
The fastpath in cpu_physical_memory_sync_dirty_bitmap() to test large
aligned ranges forgot to bring the TCG TLB up to date after clearing
some of the dirty memory bitmap bits. This can result in stores though
the TCG TLB not setting the dirty memory bitmap and ultimately causes
memory corruption / lost updates during migration from a TCG host.
Fix this by calling cpu_physical_memory_dirty_bits_cleared() when
dirty bits have been cleared.
Fixes: aa8dc044772 ("migration: synchronize memory bitmap 64bits at a time")
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20240219061731.232570-1-npiggin@gmail.com>
[PMD: Split patch in 2: part 2/2, slightly adapt description]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Link: 20240312201458.79532-4-philmd@linaro.org">https://lore.kernel.org/r/20240312201458.79532-4-philmd@linaro.org
Signed-off-by: Peter Xu <peterx@redhat.com>
---
include/exec/ram_addr.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h
index b060ea9176..de45ba7bc9 100644
--- a/include/exec/ram_addr.h
+++ b/include/exec/ram_addr.h
@@ -513,6 +513,9 @@ uint64_t cpu_physical_memory_sync_dirty_bitmap(RAMBlock *rb,
idx++;
}
}
+ if (num_dirty) {
+ cpu_physical_memory_dirty_bits_cleared(start, length);
+ }
if (rb->clear_bmap) {
/*
--
2.44.0
- [PULL 00/10] Migration 20240317 patches, peterx, 2024/03/17
- [PULL 01/10] io: Introduce qio_channel_file_new_dupfd, peterx, 2024/03/17
- [PULL 02/10] migration: Fix error handling after dup in file migration, peterx, 2024/03/17
- [PULL 03/10] physmem: Expose tlb_reset_dirty_range_all(), peterx, 2024/03/17
- [PULL 04/10] physmem: Factor cpu_physical_memory_dirty_bits_cleared() out, peterx, 2024/03/17
- [PULL 05/10] physmem: Fix migration dirty bitmap coherency with TCG memory access,
peterx <=
- [PULL 06/10] migration: Skip only empty block devices, peterx, 2024/03/17
- [PULL 07/10] migration: cpr-reboot documentation, peterx, 2024/03/17
- [PULL 09/10] migration/multifd: Ensure we're not given a socket for file migration, peterx, 2024/03/17
- [PULL 08/10] migration: Fix iocs leaks during file and fd migration, peterx, 2024/03/17
- [PULL 10/10] migration/multifd: Duplicate the fd for the outgoing_args, peterx, 2024/03/17
- Re: [PULL 00/10] Migration 20240317 patches, Peter Maydell, 2024/03/19