diff options
author | KONRAD Frederic <fred.konrad@greensocs.com> | 2017-02-23 18:29:18 +0000 |
---|---|---|
committer | Alex Bennée <alex.bennee@linaro.org> | 2017-02-24 10:32:46 +0000 |
commit | e3b9ca810980851f93f5719a7df2044c9435f003 (patch) | |
tree | 599b323ab84d00be942903cbfebd37885966744e /include | |
parent | 857baec1d9e80947f0c1007c3a3d2331d62b4b53 (diff) | |
download | qemu-e3b9ca810980851f93f5719a7df2044c9435f003.zip qemu-e3b9ca810980851f93f5719a7df2044c9435f003.tar.gz qemu-e3b9ca810980851f93f5719a7df2044c9435f003.tar.bz2 |
cputlb: introduce tlb_flush_* async work.
Some architectures allow to flush the tlb of other VCPUs. This is not a problem
when we have only one thread for all VCPUs but it definitely needs to be an
asynchronous work when we are in true multithreaded work.
We take the tb_lock() when doing this to avoid racing with other threads
which may be invalidating TB's at the same time. The alternative would
be to use proper atomic primitives to clear the tlb entries en-mass.
This patch doesn't do anything to protect other cputlb function being
called in MTTCG mode making cross vCPU changes.
Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
[AJB: remove need for g_malloc on defer, make check fixes, tb_lock]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/exec/exec-all.h | 1 | ||||
-rw-r--r-- | include/qom/cpu.h | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 82f0e12..c694e34 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -158,6 +158,7 @@ void tlb_set_page(CPUState *cpu, target_ulong vaddr, void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr); void probe_write(CPUArchState *env, target_ulong addr, int mmu_idx, uintptr_t retaddr); +void tlb_flush_page_all(target_ulong addr); #else static inline void tlb_flush_page(CPUState *cpu, target_ulong addr) { diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 10db89b..e80bf7a 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -402,6 +402,12 @@ struct CPUState { bool hax_vcpu_dirty; struct hax_vcpu_state *hax_vcpu; + + /* The pending_tlb_flush flag is set and cleared atomically to + * avoid potential races. The aim of the flag is to avoid + * unnecessary flushes. + */ + bool pending_tlb_flush; }; QTAILQ_HEAD(CPUTailQ, CPUState); |