On 2023/09/12 17:46, Philippe Mathieu-Daudé wrote:
Hi Akihiko,
On 12/9/23 09:12, Akihiko Odaki wrote:
The initialization and exit hooks will not affect the state of vCPU,
What about:
qemu_plugin_vcpu_init_hook()
-> plugin_cpu_update__locked()
-> plugin_cpu_update__async()
-> bitmap_copy(cpu->plugin_mask, ...)
tcg_flush_jmp_cache(cpu)
-> qatomic_set(&cpu->tb_jmp_cache->array[i].tb, ...)
?
Hi,
bitmap_copy(cpu->plugin_mask, ...) is contained in the plugin
infrastructure and shouldn't matter.
The TCG is not started filling caches so tcg_flush_jmp_cache() is
effectively nop though that is not clearly stated.
By the way, I found plugin_cpu_update__locked() will not synchronously
call plugin_cpu_update__async() after this change because cpu->created
will be always true for the system emulation. For user space emulation,
it has already been broken and it *always* synchronously calls the
function since cpu->created is not set.
I wrote a change to replace cpu->created with DEVICE(cpu)->realized and
added to the base patch series ("[PATCH v3 03/12] plugins: Check if vCPU
is realized" in "[PATCH v3 00/12] gdbstub and TCG plugin improvements").
Regards,
Akihiko Odaki