summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmilio G. Cota2020-06-12 21:02:29 +0200
committerAlex Bennée2020-06-16 15:49:05 +0200
commit3f640eb8812f92dfcc4947fc1e7cd9004456d58a (patch)
treec86051f145f90c460ce8b0a3091b21f0aad61218
parenttcg: call qemu_spin_destroy for tb->jmp_lock (diff)
downloadqemu-3f640eb8812f92dfcc4947fc1e7cd9004456d58a.tar.gz
qemu-3f640eb8812f92dfcc4947fc1e7cd9004456d58a.tar.xz
qemu-3f640eb8812f92dfcc4947fc1e7cd9004456d58a.zip
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>
-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 c937210e21..c3d37058a1 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;
}