core/cpu-common: initialise plugin state before thread creation
authorAlex Bennée <alex.bennee@linaro.org>
Thu, 30 May 2024 19:42:50 +0000 (20:42 +0100)
committerPhilippe Mathieu-Daudé <philmd@linaro.org>
Tue, 4 Jun 2024 08:02:39 +0000 (10:02 +0200)
commit638181a180bd4815eb4db64cfc50092cc3e5035e
treea7972a7cc42fc4a707be27571a68a294cf8d7953
parent2fa16246dd89b1a4500a89c105795814e7cbe7de
core/cpu-common: initialise plugin state before thread creation

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.

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@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-ID: <20240530194250.1801701-6-alex.bennee@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
hw/core/cpu-common.c