[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 07/13] translate-all: call qemu_spin_destroy for PageDesc
From: |
Alex Bennée |
Subject: |
Re: [PATCH v2 07/13] translate-all: call qemu_spin_destroy for PageDesc |
Date: |
Mon, 08 Jun 2020 16:04:06 +0100 |
User-agent: |
mu4e 1.5.2; emacs 28.0.50 |
Robert Foley <robert.foley@linaro.org> writes:
> From: "Emilio G. Cota" <cota@braap.org>
>
> 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>
> ---
> accel/tcg/translate-all.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
> index 3708aab36b..3fb71a1503 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);
Erg that function is starting to look a bit ugly but I guess cleaning it
up with some helpers is outside the current scope.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
--
Alex Bennée
- Re: [PATCH v2 01/13] configure: add --enable-tsan flag + fiber annotations for coroutine-ucontext, (continued)
- [PATCH v2 02/13] cpu: convert queued work to a QSIMPLEQ, Robert Foley, 2020/06/05
- [PATCH v2 03/13] thread: add qemu_spin_destroy, Robert Foley, 2020/06/05
- [PATCH v2 04/13] cputlb: destroy CPUTLB with tlb_destroy, Robert Foley, 2020/06/05
- [PATCH v2 05/13] qht: call qemu_spin_destroy for head buckets, Robert Foley, 2020/06/05
- [PATCH v2 06/13] tcg: call qemu_spin_destroy for tb->jmp_lock, Robert Foley, 2020/06/05
- [PATCH v2 07/13] translate-all: call qemu_spin_destroy for PageDesc, Robert Foley, 2020/06/05
- Re: [PATCH v2 07/13] translate-all: call qemu_spin_destroy for PageDesc,
Alex Bennée <=
- [PATCH v2 08/13] thread: add tsan annotations to QemuSpin, Robert Foley, 2020/06/05
- [PATCH v2 09/13] tests/docker: Added docker build support for TSan., Robert Foley, 2020/06/05
- [PATCH v2 10/13] include/qemu: Added tsan.h for annotations., Robert Foley, 2020/06/05
- [PATCH v2 11/13] util: Added tsan annotate for thread name., Robert Foley, 2020/06/05
- [PATCH v2 12/13] docs: Added details on TSan to testing.rst, Robert Foley, 2020/06/05
- [PATCH v2 13/13] tests: Disable select tests under TSan, which hit TSan issue., Robert Foley, 2020/06/05