[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 03/14] softmmu/physmem: Fix qemu_ram_remap() to handle shared
From: |
David Hildenbrand |
Subject: |
[PATCH v4 03/14] softmmu/physmem: Fix qemu_ram_remap() to handle shared anonymous memory |
Date: |
Fri, 19 Mar 2021 11:12:19 +0100 |
RAM_SHARED now also properly indicates shared anonymous memory. Let's check
that flag for anonymous memory as well, to restore the proper mapping.
Fixes: 06329ccecfa0 ("mem: add share parameter to memory-backend-ram")
Signed-off-by: David Hildenbrand <david@redhat.com>
---
softmmu/physmem.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
index afff96a6dc..cc59f05593 100644
--- a/softmmu/physmem.c
+++ b/softmmu/physmem.c
@@ -2222,13 +2222,13 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t length)
abort();
} else {
flags = MAP_FIXED;
+ flags |= block->flags & RAM_SHARED ?
+ MAP_SHARED : MAP_PRIVATE;
if (block->fd >= 0) {
- flags |= (block->flags & RAM_SHARED ?
- MAP_SHARED : MAP_PRIVATE);
area = mmap(vaddr, length, PROT_READ | PROT_WRITE,
flags, block->fd, offset);
} else {
- flags |= MAP_PRIVATE | MAP_ANONYMOUS;
+ flags |= MAP_ANONYMOUS;
area = mmap(vaddr, length, PROT_READ | PROT_WRITE,
flags, -1, 0);
}
--
2.29.2
- [PATCH v4 00/14] RAM_NORESERVE, MAP_NORESERVE and hostmem "reserve" property, David Hildenbrand, 2021/03/19
- [PATCH v4 01/14] softmmu/physmem: Mark shared anonymous memory RAM_SHARED, David Hildenbrand, 2021/03/19
- [PATCH v4 02/14] softmmu/physmem: Fix ram_block_discard_range() to handle shared anonymous memory, David Hildenbrand, 2021/03/19
- [PATCH v4 03/14] softmmu/physmem: Fix qemu_ram_remap() to handle shared anonymous memory,
David Hildenbrand <=
- [PATCH v4 04/14] util/mmap-alloc: Factor out calculation of the pagesize for the guard page, David Hildenbrand, 2021/03/19
- [PATCH v4 05/14] util/mmap-alloc: Factor out reserving of a memory region to mmap_reserve(), David Hildenbrand, 2021/03/19
- [PATCH v4 06/14] util/mmap-alloc: Factor out activating of memory to mmap_activate(), David Hildenbrand, 2021/03/19
- [PATCH v4 07/14] softmmu/memory: Pass ram_flags to qemu_ram_alloc_from_fd(), David Hildenbrand, 2021/03/19
- [PATCH v4 08/14] softmmu/memory: Pass ram_flags to memory_region_init_ram_shared_nomigrate(), David Hildenbrand, 2021/03/19
- [PATCH v4 09/14] util/mmap-alloc: Pass flags instead of separate bools to qemu_ram_mmap(), David Hildenbrand, 2021/03/19
- [PATCH v4 10/14] memory: Introduce RAM_NORESERVE and wire it up in qemu_ram_mmap(), David Hildenbrand, 2021/03/19