[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 06/13] exec: Relax range check in ram_block_discard_range()
From: |
David Hildenbrand |
Subject: |
[PATCH v3 06/13] exec: Relax range check in ram_block_discard_range() |
Date: |
Wed, 26 Feb 2020 16:52:57 +0100 |
We want to make use of ram_block_discard_range() in the RAM block resize
callback when growing a RAM block, *before* used_length is changed.
Let's relax the check. We always have a reserved mapping for the whole
max_length, so we cannot corrupt unrelated data.
Reviewed-by: Peter Xu <address@hidden>
Cc: Richard Henderson <address@hidden>
Cc: Paolo Bonzini <address@hidden>
Cc: Eduardo Habkost <address@hidden>
Cc: Peter Xu <address@hidden>
Signed-off-by: David Hildenbrand <address@hidden>
---
exec.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/exec.c b/exec.c
index d30a5d297a..9d351a7492 100644
--- a/exec.c
+++ b/exec.c
@@ -3876,7 +3876,7 @@ int ram_block_discard_range(RAMBlock *rb, uint64_t start,
size_t length)
goto err;
}
- if ((start + length) <= rb->used_length) {
+ if ((start + length) <= rb->max_length) {
bool need_madvise, need_fallocate;
if (!QEMU_IS_ALIGNED(length, rb->page_size)) {
error_report("ram_block_discard_range: Unaligned length: %zx",
@@ -3943,7 +3943,7 @@ int ram_block_discard_range(RAMBlock *rb, uint64_t start,
size_t length)
} else {
error_report("ram_block_discard_range: Overrun block '%s' (%" PRIu64
"/%zx/" RAM_ADDR_FMT")",
- rb->idstr, start, length, rb->used_length);
+ rb->idstr, start, length, rb->max_length);
}
err:
--
2.24.1
- [PATCH v3 00/13] migrate/ram: Fix resizing RAM blocks while migrating, David Hildenbrand, 2020/02/26
- [PATCH v3 01/13] util: vfio-helpers: Factor out and fix processing of existing ram blocks, David Hildenbrand, 2020/02/26
- [PATCH v3 02/13] stubs/ram-block: Remove stubs that are no longer needed, David Hildenbrand, 2020/02/26
- [PATCH v3 03/13] numa: Teach ram block notifiers about resizeable ram blocks, David Hildenbrand, 2020/02/26
- [PATCH v3 04/13] numa: Make all callbacks of ram block notifiers optional, David Hildenbrand, 2020/02/26
- [PATCH v3 05/13] migration/ram: Handle RAM block resizes during precopy, David Hildenbrand, 2020/02/26
- [PATCH v3 06/13] exec: Relax range check in ram_block_discard_range(),
David Hildenbrand <=
- [PATCH v3 07/13] migration/ram: Discard RAM when growing RAM blocks after ram_postcopy_incoming_init(), David Hildenbrand, 2020/02/26
- [PATCH v3 08/13] migration/ram: Simplify host page handling in ram_load_postcopy(), David Hildenbrand, 2020/02/26
- [PATCH v3 09/13] migration/ram: Consolidate variable reset after placement in ram_load_postcopy(), David Hildenbrand, 2020/02/26
- [PATCH v3 10/13] migration/ram: Handle RAM block resizes during postcopy, David Hildenbrand, 2020/02/26
- [PATCH v3 11/13] migration/multifd: Print used_length of memory block, David Hildenbrand, 2020/02/26
- [PATCH v3 12/13] migration/ram: Use offset_in_ramblock() in range checks, David Hildenbrand, 2020/02/26
- [PATCH v3 13/13] migration/ram: Tolerate partially changed mappings in postcopy code, David Hildenbrand, 2020/02/26