|
From: | Philippe Mathieu-Daudé |
Subject: | Re: [PATCH v3 03/12] plugins: Check if vCPU is realized |
Date: | Wed, 13 Sep 2023 08:17:09 +0200 |
User-agent: | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 |
On 13/9/23 00:40, Akihiko Odaki wrote:
The created member of CPUState tells if the vCPU thread is started, and will be always false for the user space emulation that manages threads independently.
Per the docstring: /** * CPUState: * @created: Indicates whether the CPU thread has been * successfully created. Each CPU DeviceClass's DeviceRealize() handler which calls qemu_init_vcpu(). Ah, what we miss is: -- >8 -- --- a/accel/tcg/user-exec-stub.c +++ b/accel/tcg/user-exec-stub.c @@ -14,6 +14,7 @@ void cpu_remove_sync(CPUState *cpu) void qemu_init_vcpu(CPUState *cpu) { + cpu->created = true; } --- Missed in commit c7f0f3b1c8 ("qtest: add test framework"). Does that help?
Use the realized member of DeviceState, which is valid for both of the system and user space emulation. Fixes: 54cb65d858 ("plugin: add core code") Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> --- plugins/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/core.c b/plugins/core.c index 3c4e26c7ed..fcd33a2bff 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -64,7 +64,7 @@ static void plugin_cpu_update__locked(gpointer k, gpointer v, gpointer udata) CPUState *cpu = container_of(k, CPUState, cpu_index); run_on_cpu_data mask = RUN_ON_CPU_HOST_ULONG(*plugin.mask);- if (cpu->created) {+ if (DEVICE(cpu)->realized) { async_run_on_cpu(cpu, plugin_cpu_update__async, mask); } else { plugin_cpu_update__async(cpu, mask);
[Prev in Thread] | Current Thread | [Next in Thread] |