unicorn/qemu/accel/tcg
Emilio G. Cota fc30b3d5cf
translate-all: exit from tb_phys_invalidate if qht_remove fails
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.

Backports commit cc689485ee3e9dca05765326ee8fd619a6ec48f0 from qemu
2018-03-15 15:51:58 -04:00
..
atomic_template.h accel/tcg: move atomic_template.h to accel/tcg/ 2018-03-13 12:28:50 -04:00
cpu-exec-common.c tcg: move tcg backend files into accel/tcg/ 2018-03-13 11:48:15 -04:00
cpu-exec.c tcg: take tb_ctx out of TCGContext 2018-03-14 09:18:12 -04:00
cputlb.c tcg: move tcg backend files into accel/tcg/ 2018-03-13 11:48:15 -04:00
Makefile.objs tcg: move tcg backend files into accel/tcg/ 2018-03-13 11:48:15 -04:00
softmmu_template.h accel/tcg: move softmmu_template.h to accel/tcg/ 2018-03-13 12:27:04 -04:00
tcg-runtime-gvec.c tcg: move tcg backend files into accel/tcg/ 2018-03-13 11:48:15 -04:00
tcg-runtime.c tcg: define CF_PARALLEL and use it for TB hashing along with CF_COUNT_MASK 2018-03-13 14:32:43 -04:00
tcg-runtime.h tcg: move tcg backend files into accel/tcg/ 2018-03-13 11:48:15 -04:00
translate-all.c translate-all: exit from tb_phys_invalidate if qht_remove fails 2018-03-15 15:51:58 -04:00
translate-all.h tcg: move tcg backend files into accel/tcg/ 2018-03-13 11:48:15 -04:00
translate-common.c tcg: move tcg backend files into accel/tcg/ 2018-03-13 11:48:15 -04:00
translator.c tcg: convert tb->cflags reads to tb_cflags(tb) 2018-03-13 14:57:51 -04:00