[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v5 07/73] cpu: make per-CPU locks an alias of th
From: |
Emilio G. Cota |
Subject: |
Re: [Qemu-devel] [PATCH v5 07/73] cpu: make per-CPU locks an alias of the BQL in TCG rr mode |
Date: |
Fri, 14 Dec 2018 20:51:00 -0500 |
User-agent: |
Mutt/1.9.4 (2018-02-28) |
On Thu, Dec 13, 2018 at 00:03:47 -0500, Emilio G. Cota wrote:
(snip)
> diff --git a/qom/cpu.c b/qom/cpu.c
> index aa15ea4af5..2ea5b1da08 100644
> --- a/qom/cpu.c
> +++ b/qom/cpu.c
> @@ -371,7 +371,6 @@ static void cpu_common_initfn(Object *obj)
> cpu->nr_cores = 1;
> cpu->nr_threads = 1;
>
> - qemu_mutex_init(&cpu->lock);
> qemu_cond_init(&cpu->cond);
> QSIMPLEQ_INIT(&cpu->work_list);
> QTAILQ_INIT(&cpu->breakpoints);
*ouch* this breaks user-mode, since we end up with cpu->lock == NULL.
I'm surprised that make check-qtest didn't pick this up--guess it's
all system-mode tests.
I've fixed this commit on github's v5 branch with the appended.
Thanks,
Emilio
---
diff --git a/cpus.c b/cpus.c
index d8261903ac..9c6cd9b90f 100644
--- a/cpus.c
+++ b/cpus.c
@@ -2326,10 +2326,9 @@ void qemu_init_vcpu(CPUState *cpu)
* cpu->lock is a standalone per-CPU lock.
*/
if (qemu_is_tcg_rr()) {
+ qemu_mutex_destroy(cpu->lock);
+ g_free(cpu->lock);
cpu->lock = &qemu_global_mutex;
- } else {
- cpu->lock = g_malloc(sizeof(*cpu->lock));
- qemu_mutex_init(cpu->lock);
}
if (kvm_enabled()) {
diff --git a/qom/cpu.c b/qom/cpu.c
index 386b1e29dd..c4cb626393 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -367,6 +367,8 @@ static void cpu_common_initfn(Object *obj)
cpu->nr_cores = 1;
cpu->nr_threads = 1;
+ cpu->lock = g_new(QemuMutex, 1);
+ qemu_mutex_init(cpu->lock);
qemu_cond_init(&cpu->cond);
QSIMPLEQ_INIT(&cpu->work_list);
QTAILQ_INIT(&cpu->breakpoints);
- [Qemu-devel] [PATCH v5 00/73] per-CPU locks, Emilio G. Cota, 2018/12/13
- [Qemu-devel] [PATCH v5 06/73] cpu: introduce process_queued_cpu_work_locked, Emilio G. Cota, 2018/12/13
- [Qemu-devel] [PATCH v5 03/73] cpu: introduce cpu_mutex_lock/unlock, Emilio G. Cota, 2018/12/13
- [Qemu-devel] [PATCH v5 02/73] cpu: rename cpu->work_mutex to cpu->lock, Emilio G. Cota, 2018/12/13
- [Qemu-devel] [PATCH v5 07/73] cpu: make per-CPU locks an alias of the BQL in TCG rr mode, Emilio G. Cota, 2018/12/13
- Re: [Qemu-devel] [PATCH v5 07/73] cpu: make per-CPU locks an alias of the BQL in TCG rr mode,
Emilio G. Cota <=
- [Qemu-devel] [PATCH v5 01/73] cpu: convert queued work to a QSIMPLEQ, Emilio G. Cota, 2018/12/13
- [Qemu-devel] [PATCH v5 04/73] cpu: make qemu_work_cond per-cpu, Emilio G. Cota, 2018/12/13
- [Qemu-devel] [PATCH v5 11/73] hppa: convert to helper_cpu_halted_set, Emilio G. Cota, 2018/12/13
- [Qemu-devel] [PATCH v5 10/73] cris: convert to helper_cpu_halted_set, Emilio G. Cota, 2018/12/13
- [Qemu-devel] [PATCH v5 05/73] cpu: move run_on_cpu to cpus-common, Emilio G. Cota, 2018/12/13
- [Qemu-devel] [PATCH v5 09/73] ppc: convert to helper_cpu_halted_set, Emilio G. Cota, 2018/12/13
- [Qemu-devel] [PATCH v5 12/73] m68k: convert to helper_cpu_halted_set, Emilio G. Cota, 2018/12/13
- [Qemu-devel] [PATCH v5 27/73] xtensa: convert to cpu_halted, Emilio G. Cota, 2018/12/13
- [Qemu-devel] [PATCH v5 16/73] tcg-runtime: convert to cpu_halted_set, Emilio G. Cota, 2018/12/13