On 31/5/24 10:47, Alex Bennée wrote:
Philippe Mathieu-Daudé <philmd@xxxxxxxxxx> writes:
On 30/5/24 21:42, Alex Bennée wrote:
Originally I tried to move where vCPU thread initialisation to later
in realize. However pulling that thread (sic) got gnarly really
quickly. It turns out some steps of CPU realization need values that
can only be determined from the running vCPU thread.
FYI:
https://lore.kernel.org/qemu-devel/20240528145953.65398-6-philmd@xxxxxxxxxx/
But this still has it in realize which would still race as the threads
are started before we call the common realize functions.
However having moved enough out of the thread creation we can now
queue work before the thread starts (at least for TCG guests) and
avoid the race between vcpu_init and other vcpu states a plugin might
subscribe to.
Signed-off-by: Alex Bennée <alex.bennee@xxxxxxxxxx>
---
hw/core/cpu-common.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@xxxxxxxxxx>