Commit 3f640eb8 authored by Emilio G. Cota's avatar Emilio G. Cota Committed by Alex Bennée
Browse files

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: default avatarEmilio G. Cota <cota@braap.org>
Signed-off-by: default avatarRobert Foley <robert.foley@linaro.org>
Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
Signed-off-by: default avatarAlex Bennée <alex.bennee@linaro.org>
Message-Id: <20200609200738.445-8-robert.foley@linaro.org>
Message-Id: <20200612190237.30436-11-alex.bennee@linaro.org>
parent 938e897a
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -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;
        }