[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] translate-all: exit from tb_phys_invalidate if
From: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] [PATCH] translate-all: exit from tb_phys_invalidate if qht_remove fails |
Date: |
Thu, 19 Oct 2017 19:20:56 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 |
On 10/19/2017 01:31 PM, Emilio G. Cota wrote:
> Two or more threads might race while invalidating the same TB. We currently
> do not check for this at all despite taking tb_lock, which means we would
> wrongly invalidate the same TB more than once. This bug has actually been
> hit by users: I recently saw a report on IRC, although I have yet to see
> the corresponding test case.
>
> Fix this by using qht_remove as the synchronization point; if it fails,
> that means the TB has already been invalidated, and therefore there
> is nothing left to do in tb_phys_invalidate.
>
> Note that this solution works now that we still have tb_lock, and will
> continue working once we remove tb_lock.
>
> Signed-off-by: Emilio G. Cota <address@hidden>
>
> ---
> This patch applies on top of the "[PATCH v6 00/50] tcg tb_lock removal"
> series:
> https://lists.gnu.org/archive/html/qemu-devel/2017-10/msg03612.html
> ---
> accel/tcg/translate-all.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Applied, thanks.
r~