[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 62/87] colo: fix return without releasing RCU
From: |
Paolo Bonzini |
Subject: |
[PULL 62/87] colo: fix return without releasing RCU |
Date: |
Wed, 18 Dec 2019 13:02:28 +0100 |
Use WITH_RCU_READ_LOCK_GUARD to avoid exiting colo_init_ram_cache
without releasing RCU.
Cc: Dr. David Alan Gilbert <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
migration/ram.c | 33 +++++++++++++++++----------------
1 file changed, 17 insertions(+), 16 deletions(-)
diff --git a/migration/ram.c b/migration/ram.c
index 219e3ca..96feb40 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -3890,26 +3890,27 @@ int colo_init_ram_cache(void)
{
RAMBlock *block;
- rcu_read_lock();
- RAMBLOCK_FOREACH_NOT_IGNORED(block) {
- block->colo_cache = qemu_anon_ram_alloc(block->used_length,
- NULL,
- false);
- if (!block->colo_cache) {
- error_report("%s: Can't alloc memory for COLO cache of block %s,"
- "size 0x" RAM_ADDR_FMT, __func__, block->idstr,
- block->used_length);
- RAMBLOCK_FOREACH_NOT_IGNORED(block) {
- if (block->colo_cache) {
- qemu_anon_ram_free(block->colo_cache, block->used_length);
- block->colo_cache = NULL;
+ WITH_RCU_READ_LOCK_GUARD() {
+ RAMBLOCK_FOREACH_NOT_IGNORED(block) {
+ block->colo_cache = qemu_anon_ram_alloc(block->used_length,
+ NULL,
+ false);
+ if (!block->colo_cache) {
+ error_report("%s: Can't alloc memory for COLO cache of block
%s,"
+ "size 0x" RAM_ADDR_FMT, __func__, block->idstr,
+ block->used_length);
+ RAMBLOCK_FOREACH_NOT_IGNORED(block) {
+ if (block->colo_cache) {
+ qemu_anon_ram_free(block->colo_cache,
block->used_length);
+ block->colo_cache = NULL;
+ }
}
+ return -errno;
}
- return -errno;
+ memcpy(block->colo_cache, block->host, block->used_length);
}
- memcpy(block->colo_cache, block->host, block->used_length);
}
- rcu_read_unlock();
+
/*
* Record the dirty pages that sent by PVM, we use this dirty bitmap
together
* with to decide which page in cache should be flushed into SVM's RAM. Here
--
1.8.3.1
- [PULL 52/87] pc: stubify x86 iommu, (continued)
- [PULL 52/87] pc: stubify x86 iommu, Paolo Bonzini, 2019/12/18
- [PULL 53/87] hw/i386: De-duplicate gsi_handler() to remove kvm_pc_gsi_handler(), Paolo Bonzini, 2019/12/18
- [PULL 55/87] hw/isa/isa-bus: cleanup irq functions, Paolo Bonzini, 2019/12/18
- [PULL 54/87] hw/i386: Simplify ioapic_init_gsi(), Paolo Bonzini, 2019/12/18
- [PULL 57/87] hw/i386/pc: Inline port92_init(), Paolo Bonzini, 2019/12/18
- [PULL 56/87] hw/i386/pc: Use TYPE_PORT92 instead of hardcoded string, Paolo Bonzini, 2019/12/18
- [PULL 58/87] hw/i386/pc: Extract the port92 device, Paolo Bonzini, 2019/12/18
- [PULL 59/87] hyperv: Use auto rcu_read macros, Paolo Bonzini, 2019/12/18
- [PULL 60/87] qsp: Use WITH_RCU_READ_LOCK_GUARD, Paolo Bonzini, 2019/12/18
- [PULL 61/87] memory: use RCU_READ_LOCK_GUARD, Paolo Bonzini, 2019/12/18
- [PULL 62/87] colo: fix return without releasing RCU,
Paolo Bonzini <=
- [PULL 63/87] build: rename CONFIG_LIBCAP to CONFIG_LIBCAP_NG, Paolo Bonzini, 2019/12/18
- [PULL 65/87] docs: tweak kernel-doc for QEMU coding standards, Paolo Bonzini, 2019/12/18
- [PULL 66/87] docs/conf.py: Enable use of kerneldoc sphinx extension, Paolo Bonzini, 2019/12/18
- [PULL 67/87] Makefile: disable Sphinx nitpicking, Paolo Bonzini, 2019/12/18
- [PULL 71/87] docs: add memory API reference, Paolo Bonzini, 2019/12/18
- [PULL 69/87] docs: Create bitops.rst as example of kernel-docs, Paolo Bonzini, 2019/12/18
- [PULL 68/87] bitops.h: Silence kernel-doc complaints, Paolo Bonzini, 2019/12/18
- [PULL 70/87] memory.h: Silence kernel-doc complaints, Paolo Bonzini, 2019/12/18
- [PULL 73/87] migration: check length directly to make sure the range is aligned, Paolo Bonzini, 2019/12/18
- [PULL 72/87] memory: include MemoryListener documentation and some missing function parameters, Paolo Bonzini, 2019/12/18