[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 03/50] cpu: introduce cpu_in_exclusive_work_conte
From: |
Alex Bennée |
Subject: |
[Qemu-devel] [PATCH v3 03/50] cpu: introduce cpu_in_exclusive_work_context() |
Date: |
Fri, 14 Jun 2019 18:11:13 +0100 |
From: "Emilio G. Cota" <address@hidden>
Suggested-by: Alex Bennée <address@hidden>
Reviewed-by: Alex Bennée <address@hidden>
Signed-off-by: Emilio G. Cota <address@hidden>
---
cpus-common.c | 2 ++
include/qom/cpu.h | 13 +++++++++++++
2 files changed, 15 insertions(+)
diff --git a/cpus-common.c b/cpus-common.c
index 3ca58c64e8..960058457a 100644
--- a/cpus-common.c
+++ b/cpus-common.c
@@ -335,7 +335,9 @@ void process_queued_cpu_work(CPUState *cpu)
*/
qemu_mutex_unlock_iothread();
start_exclusive();
+ cpu->in_exclusive_work_context = true;
wi->func(cpu, wi->data);
+ cpu->in_exclusive_work_context = false;
end_exclusive();
qemu_mutex_lock_iothread();
} else {
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 5ee0046b62..08481ad304 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -373,6 +373,7 @@ struct CPUState {
bool unplug;
bool crash_occurred;
bool exit_request;
+ bool in_exclusive_work_context;
uint32_t cflags_next_tb;
/* updates protected by BQL */
uint32_t interrupt_request;
@@ -785,6 +786,18 @@ void async_run_on_cpu(CPUState *cpu, run_on_cpu_func func,
run_on_cpu_data data)
*/
void async_safe_run_on_cpu(CPUState *cpu, run_on_cpu_func func,
run_on_cpu_data data);
+/**
+ * cpu_in_exclusive_work_context()
+ * @cpu: The vCPU to check
+ *
+ * Returns true if @cpu is an exclusive work context, which has
+ * previously been queued via async_safe_run_on_cpu().
+ */
+static inline bool cpu_in_exclusive_work_context(const CPUState *cpu)
+{
+ return cpu->in_exclusive_work_context;
+}
+
/**
* qemu_get_cpu:
* @index: The CPUState@cpu_index value of the CPU to obtain.
--
2.20.1
- [Qemu-devel] [PATCH v3 00/50] tcg plugin support, Alex Bennée, 2019/06/14
- [Qemu-devel] [PATCH v3 04/50] translate-all: use cpu_in_exclusive_work_context() in tb_flush, Alex Bennée, 2019/06/14
- [Qemu-devel] [PATCH v3 06/50] configure: add --enable-plugins (MOVE TO END), Alex Bennée, 2019/06/14
- [Qemu-devel] [PATCH v3 03/50] cpu: introduce cpu_in_exclusive_work_context(),
Alex Bennée <=
- [Qemu-devel] [PATCH v3 05/50] docs/devel: add plugins.rst design document, Alex Bennée, 2019/06/14
- [Qemu-devel] [PATCH v3 12/50] cputlb: introduce get_page_addr_code_hostp, Alex Bennée, 2019/06/14
- [Qemu-devel] [PATCH v3 14/50] tcg: add tcg_gen_st_ptr, Alex Bennée, 2019/06/14
- [Qemu-devel] [PATCH v3 10/50] queue: add QTAILQ_REMOVE_SEVERAL, Alex Bennée, 2019/06/14
- [Qemu-devel] [PATCH v3 07/50] plugin: add user-facing API, Alex Bennée, 2019/06/14