[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 17/27] cpu: call plugin init hook asynchronously
From: |
Alex Bennée |
Subject: |
[PATCH v2 17/27] cpu: call plugin init hook asynchronously |
Date: |
Fri, 23 Feb 2024 16:21:52 +0000 |
From: Pierrick Bouvier <pierrick.bouvier@linaro.org>
This ensures we run during a cpu_exec, which allows to call start/end
exclusive from this init hook (needed for new scoreboard API introduced
later).
async work is run before any tb is translated/executed, so we can
guarantee plugin init will be called before any other hook.
The previous change made sure that any idle/resume cb call will not be
done before initializing plugin for a given vcpu.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-Id: <20240213094009.150349-5-pierrick.bouvier@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
hw/core/cpu-common.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c
index fe16d0d9df8..68786360ea5 100644
--- a/hw/core/cpu-common.c
+++ b/hw/core/cpu-common.c
@@ -194,6 +194,11 @@ static void cpu_common_parse_features(const char
*typename, char *features,
}
}
+static void qemu_plugin_vcpu_init__async(CPUState *cpu, run_on_cpu_data unused)
+{
+ qemu_plugin_vcpu_init_hook(cpu);
+}
+
static void cpu_common_realizefn(DeviceState *dev, Error **errp)
{
CPUState *cpu = CPU(dev);
@@ -217,9 +222,9 @@ static void cpu_common_realizefn(DeviceState *dev, Error
**errp)
cpu_resume(cpu);
}
- /* Plugin initialization must wait until the cpu is fully realized. */
+ /* Plugin initialization must wait until the cpu start executing code */
if (tcg_enabled()) {
- qemu_plugin_vcpu_init_hook(cpu);
+ async_run_on_cpu(cpu, qemu_plugin_vcpu_init__async, RUN_ON_CPU_NULL);
}
/* NOTE: latest generic point where the cpu is fully realized */
--
2.39.2
- [PATCH v2 00/27] maintainer updates for 9.0 pre-PR (tests, plugin register support), Alex Bennée, 2024/02/23
- [PATCH v2 02/27] tests/tcg: bump TCG test timeout to 120s, Alex Bennée, 2024/02/23
- [PATCH v2 07/27] gdbstub: Use GDBFeature for GDBRegisterState, Alex Bennée, 2024/02/23
- [PATCH v2 12/27] gdbstub: Add members to identify registers to GDBFeature, Alex Bennée, 2024/02/23
- [PATCH v2 08/27] gdbstub: Change gdb_get_reg_cb and gdb_set_reg_cb, Alex Bennée, 2024/02/23
- [PATCH v2 13/27] plugins: remove previous n_vcpus functions from API, Alex Bennée, 2024/02/23
- [PATCH v2 15/27] plugins: fix order of init/idle/resume callback, Alex Bennée, 2024/02/23
- [PATCH v2 11/27] hw/core/cpu: Remove gdb_get_dynamic_xml member, Alex Bennée, 2024/02/23
- [PATCH v2 17/27] cpu: call plugin init hook asynchronously,
Alex Bennée <=
- [PATCH v2 03/27] target/arm: Use GDBFeature for dynamic XML, Alex Bennée, 2024/02/23
- [PATCH v2 05/27] target/riscv: Use GDBFeature for dynamic XML, Alex Bennée, 2024/02/23
- [PATCH v2 27/27] docs/devel: plugins can trigger a tb flush, Alex Bennée, 2024/02/23
- [PATCH v2 04/27] target/ppc: Use GDBFeature for dynamic XML, Alex Bennée, 2024/02/23
- [PATCH v2 06/27] gdbstub: Use GDBFeature for gdb_register_coprocessor, Alex Bennée, 2024/02/23
- [PATCH v2 14/27] plugins: add qemu_plugin_num_vcpus function, Alex Bennée, 2024/02/23
- [PATCH v2 22/27] tests/tcg: expand insn test case to exercise register API, Alex Bennée, 2024/02/23
- [PATCH v2 19/27] gdbstub: expose api to find registers, Alex Bennée, 2024/02/23
- [PATCH v2 25/27] docs/devel: lift example and plugin API sections up, Alex Bennée, 2024/02/23
- [PATCH v2 23/27] contrib/plugins: fix imatch, Alex Bennée, 2024/02/23