[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH V1 19/32] memory: ram_block_add cosmetic changes
From: |
Steve Sistare |
Subject: |
[PATCH V1 19/32] memory: ram_block_add cosmetic changes |
Date: |
Thu, 30 Jul 2020 08:14:23 -0700 |
Massage the code to simplify the later patch "exec, memory: exec(3) to
restart".
No functional change.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
---
exec.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/exec.c b/exec.c
index 02160e0..359e437 100644
--- a/exec.c
+++ b/exec.c
@@ -2233,32 +2233,37 @@ static void ram_block_add(RAMBlock *new_block, Error
**errp, bool shared)
RAMBlock *last_block = NULL;
ram_addr_t old_ram_size, new_ram_size;
Error *err = NULL;
+ const char *name;
+ void *addr;
+ size_t maxlen;
old_ram_size = last_ram_page();
qemu_mutex_lock_ramlist();
- new_block->offset = find_ram_offset(new_block->max_length);
+ maxlen = new_block->max_length;
+ new_block->offset = find_ram_offset(maxlen);
if (!new_block->host) {
if (xen_enabled()) {
- xen_ram_alloc(new_block->offset, new_block->max_length,
- new_block->mr, &err);
+ xen_ram_alloc(new_block->offset, maxlen, new_block->mr, &err);
if (err) {
error_propagate(errp, err);
qemu_mutex_unlock_ramlist();
return;
}
} else {
- new_block->host = phys_mem_alloc(new_block->max_length,
- &new_block->mr->align, shared);
- if (!new_block->host) {
+ name = memory_region_name(new_block->mr);
+ addr = phys_mem_alloc(maxlen, &new_block->mr->align, shared);
+
+ if (!addr) {
error_setg_errno(errp, errno,
"cannot set up guest memory '%s'",
- memory_region_name(new_block->mr));
+ name);
qemu_mutex_unlock_ramlist();
return;
}
- memory_try_enable_merging(new_block->host, new_block->max_length);
+ memory_try_enable_merging(addr, maxlen);
+ new_block->host = addr;
}
}
--
1.8.3.1
- [PATCH V1 28/32] char: restore terminal on restart, (continued)
- [PATCH V1 28/32] char: restore terminal on restart, Steve Sistare, 2020/07/30
- [PATCH V1 29/32] pci: export pci_update_mappings, Steve Sistare, 2020/07/30
- [PATCH V1 25/32] char: save/restore chardev pty fds, Steve Sistare, 2020/07/30
- [PATCH V1 24/32] ui: save/restore vnc socket fds, Steve Sistare, 2020/07/30
- [PATCH V1 31/32] vfio-pci: trace pci config, Steve Sistare, 2020/07/30
- [PATCH V1 02/32] savevm: VM handlers mode mask, Steve Sistare, 2020/07/30
- [PATCH V1 05/32] savevm: QMP command for cprload, Steve Sistare, 2020/07/30
- [PATCH V1 09/32] savevm: prevent cprsave if memory is volatile, Steve Sistare, 2020/07/30
- [PATCH V1 19/32] memory: ram_block_add cosmetic changes,
Steve Sistare <=
- [PATCH V1 18/32] osdep: import MADV_DOEXEC, Steve Sistare, 2020/07/30
- [PATCH V1 21/32] exec, memory: exec(3) to restart, Steve Sistare, 2020/07/30
- [PATCH V1 13/32] gdbstub: gdb support for suspended state, Steve Sistare, 2020/07/30
- [PATCH V1 23/32] char: save/restore chardev socket fds, Steve Sistare, 2020/07/30
- [PATCH V1 26/32] monitor: save/restore QMP negotiation status, Steve Sistare, 2020/07/30
- [PATCH V1 30/32] vfio-pci: save and restore, Steve Sistare, 2020/07/30
- [PATCH V1 32/32] vfio-pci: improved tracing, Steve Sistare, 2020/07/30
- [PATCH V1 27/32] vhost: reset vhost devices upon cprsave, Steve Sistare, 2020/07/30
- Re: [PATCH V1 00/32] Live Update, Daniel P . Berrangé, 2020/07/30