]> xenbits.xensource.com Git - qemu-xen.git/commit
plugins: fix race condition with scoreboards
authorPierrick Bouvier <pierrick.bouvier@linaro.org>
Tue, 13 Aug 2024 20:23:29 +0000 (21:23 +0100)
committerAlex Bennée <alex.bennee@linaro.org>
Fri, 16 Aug 2024 13:13:07 +0000 (14:13 +0100)
commit278035fc81510bd88501afb78bd5ab652beffa76
treeabcb5591152e1b3a763852a05082bafba94e571e
parent3f9f9a37ae2404c54458acadb516f0eda7cd2c15
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>
plugins/core.c