[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC v3 47/56] cpu: call .cpu_has_work with the CPU lock he
From: |
Emilio G. Cota |
Subject: |
[Qemu-devel] [RFC v3 47/56] cpu: call .cpu_has_work with the CPU lock held |
Date: |
Thu, 18 Oct 2018 21:06:16 -0400 |
Signed-off-by: Emilio G. Cota <address@hidden>
---
include/qom/cpu.h | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index cd66b8828a..ca7d92c360 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -784,9 +784,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] [RFC v3 34/56] hppa: convert to cpu_interrupt_request, (continued)
- [Qemu-devel] [RFC v3 34/56] hppa: convert to cpu_interrupt_request, Emilio G. Cota, 2018/10/18
- [Qemu-devel] [RFC v3 40/56] alpha: convert to cpu_interrupt_request, Emilio G. Cota, 2018/10/18
- [Qemu-devel] [RFC v3 44/56] unicore32: convert to cpu_interrupt_request, Emilio G. Cota, 2018/10/18
- [Qemu-devel] [RFC v3 17/56] s390x: convert to cpu_halted, Emilio G. Cota, 2018/10/18
- [Qemu-devel] [RFC v3 35/56] lm32: convert to cpu_interrupt_request, Emilio G. Cota, 2018/10/18
- [Qemu-devel] [RFC v3 47/56] cpu: call .cpu_has_work with the CPU lock held,
Emilio G. Cota <=
- [Qemu-devel] [RFC v3 43/56] openrisc: convert to cpu_interrupt_request, Emilio G. Cota, 2018/10/18
- [Qemu-devel] [RFC v3 37/56] mips: convert to cpu_interrupt_request, Emilio G. Cota, 2018/10/18
- [Qemu-devel] [RFC v3 42/56] sparc: convert to cpu_interrupt_request, Emilio G. Cota, 2018/10/18
- [Qemu-devel] [RFC v3 30/56] i386: convert to cpu_interrupt_request, Emilio G. Cota, 2018/10/18