mirror of
https://github.com/torvalds/linux.git
synced 2024-11-17 17:41:44 +00:00
1b400ba0cd
When we change or remove a HPT (hashed page table) entry, we can do either a global TLB invalidation (tlbie) that works across the whole machine, or a local invalidation (tlbiel) that only affects this core. Currently we do local invalidations if the VM has only one vcpu or if the guest requests it with the H_LOCAL flag, though the guest Linux kernel currently doesn't ever use H_LOCAL. Then, to cope with the possibility that vcpus moving around to different physical cores might expose stale TLB entries, there is some code in kvmppc_hv_entry to flush the whole TLB of entries for this VM if either this vcpu is now running on a different physical core from where it last ran, or if this physical core last ran a different vcpu. There are a number of problems on POWER7 with this as it stands: - The TLB invalidation is done per thread, whereas it only needs to be done per core, since the TLB is shared between the threads. - With the possibility of the host paging out guest pages, the use of H_LOCAL by an SMP guest is dangerous since the guest could possibly retain and use a stale TLB entry pointing to a page that had been removed from the guest. - The TLB invalidations that we do when a vcpu moves from one physical core to another are unnecessary in the case of an SMP guest that isn't using H_LOCAL. - The optimization of using local invalidations rather than global should apply to guests with one virtual core, not just one vcpu. (None of this applies on PPC970, since there we always have to invalidate the whole TLB when entering and leaving the guest, and we can't support paging out guest memory.) To fix these problems and simplify the code, we now maintain a simple cpumask of which cpus need to flush the TLB on entry to the guest. (This is indexed by cpu, though we only ever use the bits for thread 0 of each core.) Whenever we do a local TLB invalidation, we set the bits for every cpu except the bit for thread 0 of the core that we're currently running on. Whenever we enter a guest, we test and clear the bit for our core, and flush the TLB if it was set. On initial startup of the VM, and when resetting the HPT, we set all the bits in the need_tlb_flush cpumask, since any core could potentially have stale TLB entries from the previous VM to use the same LPID, or the previous contents of the HPT. Then, we maintain a count of the number of online virtual cores, and use that when deciding whether to use a local invalidation rather than the number of online vcpus. The code to make that decision is extracted out into a new function, global_invalidates(). For multi-core guests on POWER7 (i.e. when we are using mmu notifiers), we now never do local invalidations regardless of the H_LOCAL flag. Signed-off-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Alexander Graf <agraf@suse.de> |
||
---|---|---|
.. | ||
44x_emulate.c | ||
44x_tlb.c | ||
44x_tlb.h | ||
44x.c | ||
book3s_32_mmu_host.c | ||
book3s_32_mmu.c | ||
book3s_32_sr.S | ||
book3s_64_mmu_host.c | ||
book3s_64_mmu_hv.c | ||
book3s_64_mmu.c | ||
book3s_64_slb.S | ||
book3s_64_vio_hv.c | ||
book3s_64_vio.c | ||
book3s_emulate.c | ||
book3s_exports.c | ||
book3s_hv_builtin.c | ||
book3s_hv_interrupts.S | ||
book3s_hv_rm_mmu.c | ||
book3s_hv_rmhandlers.S | ||
book3s_hv.c | ||
book3s_interrupts.S | ||
book3s_mmu_hpte.c | ||
book3s_paired_singles.c | ||
book3s_pr_papr.c | ||
book3s_pr.c | ||
book3s_rmhandlers.S | ||
book3s_segment.S | ||
book3s.c | ||
booke_emulate.c | ||
booke_interrupts.S | ||
booke.c | ||
booke.h | ||
bookehv_interrupts.S | ||
e500_emulate.c | ||
e500_tlb.c | ||
e500.c | ||
e500.h | ||
e500mc.c | ||
emulate.c | ||
fpu.S | ||
Kconfig | ||
Makefile | ||
powerpc.c | ||
timing.c | ||
timing.h | ||
trace.h |