aboutsummaryrefslogtreecommitdiff
path: root/accel
diff options
context:
space:
mode:
authorEmilio G. Cota <cota@braap.org>2020-06-12 20:02:29 +0100
committerAlex Bennée <alex.bennee@linaro.org>2020-06-16 14:49:05 +0100
commit3f640eb8812f92dfcc4947fc1e7cd9004456d58a (patch)
treec86051f145f90c460ce8b0a3091b21f0aad61218 /accel
parent938e897a6615b63093881e8b58206f6f69212abe (diff)
downloadqemu-3f640eb8812f92dfcc4947fc1e7cd9004456d58a.zip
qemu-3f640eb8812f92dfcc4947fc1e7cd9004456d58a.tar.gz
qemu-3f640eb8812f92dfcc4947fc1e7cd9004456d58a.tar.bz2
translate-all: call qemu_spin_destroy for PageDesc
The radix tree is append-only, but we can fail to insert a PageDesc if the insertion races with another thread. Signed-off-by: Emilio G. Cota <cota@braap.org> Signed-off-by: Robert Foley <robert.foley@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20200609200738.445-8-robert.foley@linaro.org> Message-Id: <20200612190237.30436-11-alex.bennee@linaro.org>
Diffstat (limited to 'accel')
-rw-r--r--accel/tcg/translate-all.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index c937210..c3d3705 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -547,6 +547,15 @@ static PageDesc *page_find_alloc(tb_page_addr_t index, int alloc)
#endif
existing = atomic_cmpxchg(lp, NULL, pd);
if (unlikely(existing)) {
+#ifndef CONFIG_USER_ONLY
+ {
+ int i;
+
+ for (i = 0; i < V_L2_SIZE; i++) {
+ qemu_spin_destroy(&pd[i].lock);
+ }
+ }
+#endif
g_free(pd);
pd = existing;
}