[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 15/45] softmmu/physmem: Mark shared anonymous memory RAM_SHARED
From: |
Paolo Bonzini |
Subject: |
[PULL 15/45] softmmu/physmem: Mark shared anonymous memory RAM_SHARED |
Date: |
Thu, 17 Jun 2021 11:31:04 +0200 |
From: David Hildenbrand <david@redhat.com>
Let's drop the "shared" parameter from ram_block_add() and properly
store it in the flags of the ram block instead, such that
qemu_ram_is_shared() properly succeeds on all ram blocks that were mapped
MAP_SHARED.
We'll use this information next to fix some cases with shared anonymous
memory.
Reviewed-by: Igor Kotrasinski <i.kotrasinsk@partner.samsung.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20210406080126.24010-2-david@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
softmmu/physmem.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
index 1c8717684a..b78b30e7ba 100644
--- a/softmmu/physmem.c
+++ b/softmmu/physmem.c
@@ -1946,8 +1946,9 @@ static void dirty_memory_extend(ram_addr_t old_ram_size,
}
}
-static void ram_block_add(RAMBlock *new_block, Error **errp, bool shared)
+static void ram_block_add(RAMBlock *new_block, Error **errp)
{
+ const bool shared = qemu_ram_is_shared(new_block);
RAMBlock *block;
RAMBlock *last_block = NULL;
ram_addr_t old_ram_size, new_ram_size;
@@ -2084,7 +2085,7 @@ RAMBlock *qemu_ram_alloc_from_fd(ram_addr_t size,
MemoryRegion *mr,
return NULL;
}
- ram_block_add(new_block, &local_err, ram_flags & RAM_SHARED);
+ ram_block_add(new_block, &local_err);
if (local_err) {
g_free(new_block);
error_propagate(errp, local_err);
@@ -2147,10 +2148,13 @@ RAMBlock *qemu_ram_alloc_internal(ram_addr_t size,
ram_addr_t max_size,
if (host) {
new_block->flags |= RAM_PREALLOC;
}
+ if (share) {
+ new_block->flags |= RAM_SHARED;
+ }
if (resizeable) {
new_block->flags |= RAM_RESIZEABLE;
}
- ram_block_add(new_block, &local_err, share);
+ ram_block_add(new_block, &local_err);
if (local_err) {
g_free(new_block);
error_propagate(errp, local_err);
--
2.31.1
- [PULL 01/45] vnc: avoid deprecation warnings for SASL on OS X, (continued)
- [PULL 01/45] vnc: avoid deprecation warnings for SASL on OS X, Paolo Bonzini, 2021/06/17
- [PULL 02/45] vl: Fix an assert failure in error path, Paolo Bonzini, 2021/06/17
- [PULL 04/45] block/scsi: correctly emulate the VPD block limits page, Paolo Bonzini, 2021/06/17
- [PULL 03/45] qemu-config: use qemu_opts_from_qdict, Paolo Bonzini, 2021/06/17
- [PULL 08/45] esp: allow non-DMA callback in esp_transfer_data() initial transfer, Paolo Bonzini, 2021/06/17
- [PULL 05/45] runstate: Initialize Error * to NULL, Paolo Bonzini, 2021/06/17
- [PULL 06/45] esp: only assert INTR_DC interrupt flag if selection fails, Paolo Bonzini, 2021/06/17
- [PULL 07/45] esp: only set ESP_RSEQ at the start of the select sequence, Paolo Bonzini, 2021/06/17
- [PULL 11/45] esp: revert 75ef849696 "esp: correctly fill bus id with requested lun", Paolo Bonzini, 2021/06/17
- [PULL 14/45] esp: store lun coming from the MESSAGE OUT phase, Paolo Bonzini, 2021/06/17
- [PULL 15/45] softmmu/physmem: Mark shared anonymous memory RAM_SHARED,
Paolo Bonzini <=
- [PULL 16/45] softmmu/physmem: Fix ram_block_discard_range() to handle shared anonymous memory, Paolo Bonzini, 2021/06/17
- [PULL 18/45] util/mmap-alloc: Factor out calculation of the pagesize for the guard page, Paolo Bonzini, 2021/06/17
- [PULL 09/45] esp: handle non-DMA transfers from the target one byte at a time, Paolo Bonzini, 2021/06/17
- [PULL 10/45] esp: ensure PDMA write transfers are flushed from the FIFO to the target immediately, Paolo Bonzini, 2021/06/17
- [PULL 13/45] esp: fix migration version check in esp_is_version_5(), Paolo Bonzini, 2021/06/17
- [PULL 12/45] esp: correctly accumulate extended messages for PDMA, Paolo Bonzini, 2021/06/17
- [PULL 17/45] softmmu/physmem: Fix qemu_ram_remap() to handle shared anonymous memory, Paolo Bonzini, 2021/06/17
- [PULL 19/45] util/mmap-alloc: Factor out reserving of a memory region to mmap_reserve(), Paolo Bonzini, 2021/06/17
- [PULL 20/45] util/mmap-alloc: Factor out activating of memory to mmap_activate(), Paolo Bonzini, 2021/06/17
- [PULL 22/45] softmmu/memory: Pass ram_flags to memory_region_init_ram_shared_nomigrate(), Paolo Bonzini, 2021/06/17