[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v6 61/73] cpu: call .cpu_has_work with the CPU lock
From: |
Emilio G. Cota |
Subject: |
[Qemu-devel] [PATCH v6 61/73] cpu: call .cpu_has_work with the CPU lock held |
Date: |
Tue, 29 Jan 2019 19:47:59 -0500 |
Reviewed-by: Richard Henderson <address@hidden>
Signed-off-by: Emilio G. Cota <address@hidden>
---
include/qom/cpu.h | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 4a87c1fef7..96a5d0cb94 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -85,7 +85,8 @@ struct TranslationBlock;
* @parse_features: Callback to parse command line arguments.
* @reset: Callback to reset the #CPUState to its initial state.
* @reset_dump_flags: #CPUDumpFlags to use for reset logging.
- * @has_work: Callback for checking if there is work to do.
+ * @has_work: Callback for checking if there is work to do. Called with the
+ * CPU lock held.
* @do_interrupt: Callback for interrupt handling.
* @do_unassigned_access: Callback for unassigned access handling.
* (this is deprecated: new targets should use do_transaction_failed instead)
@@ -795,9 +796,16 @@ const char *parse_cpu_model(const char *cpu_model);
static inline bool cpu_has_work(CPUState *cpu)
{
CPUClass *cc = CPU_GET_CLASS(cpu);
+ bool ret;
g_assert(cc->has_work);
- return cc->has_work(cpu);
+ if (cpu_mutex_locked(cpu)) {
+ return cc->has_work(cpu);
+ }
+ cpu_mutex_lock(cpu);
+ ret = cc->has_work(cpu);
+ cpu_mutex_unlock(cpu);
+ return ret;
}
/**
--
2.17.1
- [Qemu-devel] [PATCH v6 34/73] exec: use cpu_reset_interrupt, (continued)
- [Qemu-devel] [PATCH v6 34/73] exec: use cpu_reset_interrupt, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 42/73] i386/whpx-all: convert to cpu_interrupt_request, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 45/73] sh4: convert to cpu_interrupt_request, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 31/73] cpu: convert to cpu_halted, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 40/73] i386/kvm: convert to cpu_interrupt_request, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 35/73] i386: use cpu_reset_interrupt, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 39/73] i386: convert to cpu_interrupt_request, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 46/73] cris: convert to cpu_interrupt_request, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 48/73] lm32: convert to cpu_interrupt_request, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 55/73] sparc: convert to cpu_interrupt_request, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 61/73] cpu: call .cpu_has_work with the CPU lock held,
Emilio G. Cota <=
- [Qemu-devel] [PATCH v6 37/73] openrisc: use cpu_reset_interrupt, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 51/73] nios: convert to cpu_interrupt_request, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 41/73] i386/hax-all: convert to cpu_interrupt_request, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 53/73] alpha: convert to cpu_interrupt_request, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 47/73] hppa: convert to cpu_interrupt_request, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 50/73] mips: convert to cpu_interrupt_request, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 56/73] openrisc: convert to cpu_interrupt_request, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 60/73] cpu: convert to interrupt_request, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 49/73] m68k: convert to cpu_interrupt_request, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 43/73] i386/hvf: convert to cpu_request_interrupt, Emilio G. Cota, 2019/01/29