qemu/accel/tcg
Peter Maydell 34d49937e4 accel/tcg: Handle atomic accesses to notdirty memory correctly
To do a write to memory that is marked as notdirty, we need
to invalidate any TBs we have cached for that memory, and
update the cpu physical memory dirty flags for VGA and migration.
The slowpath code in notdirty_mem_write() does all this correctly,
but the new atomic handling code in atomic_mmu_lookup() doesn't
do anything at all, it just clears the dirty bit in the TLB.

The effect of this bug is that if the first write to a notdirty
page for which we have cached TBs is by a guest atomic access,
we fail to invalidate the TBs and subsequently will execute
incorrect code. This can be seen by trying to run 'javac' on AArch64.

Use the new notdirty_call_before() and notdirty_call_after()
functions to correctly handle the update to notdirty memory
in the atomic codepath.

Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 1511201308-23580-3-git-send-email-peter.maydell@linaro.org
2017-11-21 12:09:25 +00:00
..
Makefile.objs accel/tcg: move tcg-runtime to accel/tcg/ 2017-09-17 06:52:19 -07:00
atomic_template.h accel/tcg: Handle atomic accesses to notdirty memory correctly 2017-11-21 12:09:25 +00:00
cpu-exec-common.c tcg: make tcg_allowed global 2017-07-04 16:01:16 +02:00
cpu-exec.c Revert "cpu-exec: don't overwrite exception_index" 2017-11-20 10:58:27 +00:00
cputlb.c accel/tcg: Handle atomic accesses to notdirty memory correctly 2017-11-21 12:09:25 +00:00
softmmu_template.h accel/tcg: allow to invalidate a write TLB entry immediately 2017-10-20 13:32:10 +02:00
tcg-all.c tcg: make tcg_allowed global 2017-07-04 16:01:16 +02:00
tcg-runtime.c tcg: define tcg_init_ctx and make tcg_ctx a pointer 2017-10-24 13:53:42 -07:00
tcg-runtime.h tcg: remove addr argument from lookup_tb_ptr 2017-10-10 07:37:10 -07:00
trace-events trace-events: fix code style: print 0x before hex numbers 2017-08-01 12:13:07 +01:00
translate-all.c accel/tcg/translate-all: expand cpu_restore_state addr check 2017-11-13 13:55:27 +00:00
translate-all.h tcg: move tcg backend files into accel/tcg/ 2017-06-15 11:04:06 +02:00
translator.c tcg: convert tb->cflags reads to tb_cflags(tb) 2017-10-24 13:53:41 -07:00
user-exec-stub.c accel/tcg: move user-exec to accel/tcg/ 2017-09-17 06:52:19 -07:00
user-exec.c accel/tcg: Handle atomic accesses to notdirty memory correctly 2017-11-21 12:09:25 +00:00