From: Sergey Fedorov <address@hidden>
First, ensure atomicity of CPU's 'tb_jmp_cache' access by:
* using atomic_read() to look up a TB when not holding 'tb_lock';
* using atomic_write() to remove a TB from each CPU's local cache on
TB invalidation.
Second, add some memory barriers to ensure we don't put the TB being
invalidated back to CPU's 'tb_jmp_cache'. If we fail to look up a TB in
CPU's local cache because it is being invalidated by some other thread
then it must not be found in the shared TB hash table. Otherwise we'd
put it back to CPU's local cache.
Note that this patch does *not* make CPU's TLB invalidation safe if it
is done from some other thread while the CPU is in its execution loop.
Signed-off-by: Sergey Fedorov <address@hidden>
Signed-off-by: Sergey Fedorov <address@hidden>
[AJB: fixed missing atomic set, tweak title]
Signed-off-by: Alex Bennée <address@hidden>
---
AJB:
- tweak title
- fixed missing set of tb_jmp_cache
---
cpu-exec.c | 9 +++++++--
translate-all.c | 7 ++++++-
2 files changed, 13 insertions(+), 3 deletions(-)