[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 29/36] cpus-common: nuke finish_safe_work
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 29/36] cpus-common: nuke finish_safe_work |
Date: |
Tue, 20 Aug 2019 08:59:48 +0200 |
From: Roman Kagan <address@hidden>
It was introduced in commit ab129972c8b41e15b0521895a46fd9c752b68a5e,
with the following motivation:
Because start_exclusive uses CPU_FOREACH, merge exclusive_lock with
qemu_cpu_list_lock: together with a call to exclusive_idle (via
cpu_exec_start/end) in cpu_list_add, this protects exclusive work
against concurrent CPU addition and removal.
However, it seems to be redundant, because the cpu-exclusive
infrastructure provides suffificent protection against the newly added
CPU starting execution while the cpu-exclusive work is running, and the
aforementioned traversing of the cpu list is protected by
qemu_cpu_list_lock.
Besides, this appears to be the only place where the cpu-exclusive
section is entered with the BQL taken, which has been found to trigger
AB-BA deadlock as follows:
vCPU thread main thread
----------- -----------
async_safe_run_on_cpu(self,
async_synic_update)
... [cpu hot-add]
process_queued_cpu_work()
qemu_mutex_unlock_iothread()
[grab BQL]
start_exclusive() cpu_list_add()
async_synic_update() finish_safe_work()
qemu_mutex_lock_iothread() cpu_exec_start()
So remove it. This paves the way to establishing a strict nesting rule
of never entering the exclusive section with the BQL taken.
Signed-off-by: Roman Kagan <address@hidden>
Message-Id: <address@hidden>
---
cpus-common.c | 8 --------
1 file changed, 8 deletions(-)
diff --git a/cpus-common.c b/cpus-common.c
index 3ca58c6..023cfeb 100644
--- a/cpus-common.c
+++ b/cpus-common.c
@@ -69,12 +69,6 @@ static int cpu_get_free_index(void)
return cpu_index;
}
-static void finish_safe_work(CPUState *cpu)
-{
- cpu_exec_start(cpu);
- cpu_exec_end(cpu);
-}
-
void cpu_list_add(CPUState *cpu)
{
qemu_mutex_lock(&qemu_cpu_list_lock);
@@ -86,8 +80,6 @@ void cpu_list_add(CPUState *cpu)
}
QTAILQ_INSERT_TAIL_RCU(&cpus, cpu, node);
qemu_mutex_unlock(&qemu_cpu_list_lock);
-
- finish_safe_work(cpu);
}
void cpu_list_remove(CPUState *cpu)
--
1.8.3.1
- [Qemu-devel] [PULL 31/36] kvm: vmxcap: Enhance with latest features, (continued)
- [Qemu-devel] [PULL 31/36] kvm: vmxcap: Enhance with latest features, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 16/36] mc146818rtc: Remove reset notifiers, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 15/36] memory: fix race between TCG and accesses to dirty bitmap, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 17/36] timer: Remove reset notifiers, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 12/36] tests: Fix uninitialized byte in test_visitor_in_fuzz, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 14/36] target/i386: Return 'indefinite integer value' for invalid SSE fp->int conversions, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 19/36] timer: last, remove last bits of last, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 20/36] kconfig: do not select VMMOUSE, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 18/36] replay: Remove host_clock_last, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 25/36] replay: refine replay-time module, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 29/36] cpus-common: nuke finish_safe_work,
Paolo Bonzini <=
- [Qemu-devel] [PULL 27/36] icount: clean up cpu_can_io at the entry to the block, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 36/36] x86: Intel AVX512_BF16 feature enabling, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 28/36] icount: remove unnecessary gen_io_end calls, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 26/36] replay: rename step-related variables and functions, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 32/36] HACKING: Document 'struct' keyword usage, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 23/36] util/qemu-timer: refactor deadline calculation for external timers, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 33/36] migration: do not rom_reset() during incoming migration, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 34/36] test-bitmap: test set 1 bit case for bitmap_set, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 35/36] scsi: lsi: exit infinite loop while executing script (CVE-2019-12068), Paolo Bonzini, 2019/08/20
- Re: [Qemu-devel] [PULL 00/36] QEMU patches for 2018-08-20, no-reply, 2019/08/20