mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
qom: convert the CPU list to RCU
Iterating over the list without using atomics is undefined behaviour, since the list can be modified concurrently by other threads (e.g. every time a new thread is created in user-mode). Fix it by implementing the CPU list as an RCU QTAILQ. This requires a little bit of extra work to traverse list in reverse order (see previous patch), but other than that the conversion is trivial. Signed-off-by: Emilio G. Cota <cota@braap.org> Message-Id: <20180819091335.22863-12-cota@braap.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
04d595b300
commit
068a5ea02f
6 changed files with 11 additions and 12 deletions
|
@ -1096,7 +1096,7 @@ void s390_set_qemu_cpu_model(uint16_t type, uint8_t gen, uint8_t ec_ga,
|
|||
const S390CPUDef *def = s390_find_cpu_def(type, gen, ec_ga, NULL);
|
||||
|
||||
g_assert(def);
|
||||
g_assert(QTAILQ_EMPTY(&cpus));
|
||||
g_assert(QTAILQ_EMPTY_RCU(&cpus));
|
||||
|
||||
/* TCG emulates some features that can usually not be enabled with
|
||||
* the emulated machine generation. Make sure they can be enabled
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue