qemu/plugins
Pierrick Bouvier 278035fc81 plugins: fix race condition with scoreboards
A deadlock can be created if a new vcpu (a) triggers a scoreboard
reallocation, and another vcpu (b) wants to create a new scoreboard at
the same time.

In this case, (a) holds the plugin lock, and starts an exclusive
section, waiting for (b). But at the same time, (b) is waiting for
plugin lock.

The solution is to drop the lock before entering the exclusive section.

This bug can be easily reproduced by creating a callback for any tb
exec, that allocates a new scoreboard. In this case, as soon as we reach
more than 16 vcpus, the deadlock occurs.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2344
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-Id: <20240812220748.95167-2-pierrick.bouvier@linaro.org>
[AJB: tweak var position to meet coding style]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20240813202329.1237572-22-alex.bennee@linaro.org>
2024-08-16 14:13:07 +01:00
..
api.c plugins: add migration blocker 2024-06-24 10:15:10 +01:00
core.c plugins: fix race condition with scoreboards 2024-08-16 14:13:07 +01:00
loader.c plugin/loader: handle basic help query 2024-07-30 11:44:21 +01:00
meson.build buildsys: Fix building without plugins on Darwin 2024-08-16 14:04:19 +01:00
plugin.h plugins: remove op from qemu_plugin_inline_cb 2024-05-16 08:55:23 +01:00
qemu-plugins.symbols plugins: add time control API 2024-06-24 10:15:04 +01:00