linux-stable/arch/powerpc
Paul Mackerras d78bca7296 KVM: PPC: Book3S PR: Use mmu_notifier_retry() in kvmppc_mmu_map_page()
When the MM code is invalidating a range of pages, it calls the KVM
kvm_mmu_notifier_invalidate_range_start() notifier function, which calls
kvm_unmap_hva_range(), which arranges to flush all the existing host
HPTEs for guest pages.  However, the Linux PTEs for the range being
flushed are still valid at that point.  We are not supposed to establish
any new references to pages in the range until the ...range_end()
notifier gets called.  The PPC-specific KVM code doesn't get any
explicit notification of that; instead, we are supposed to use
mmu_notifier_retry() to test whether we are or have been inside a
range flush notifier pair while we have been getting a page and
instantiating a host HPTE for the page.

This therefore adds a call to mmu_notifier_retry inside
kvmppc_mmu_map_page().  This call is inside a region locked with
kvm->mmu_lock, which is the same lock that is called by the KVM
MMU notifier functions, thus ensuring that no new notification can
proceed while we are in the locked region.  Inside this region we
also create the host HPTE and link the corresponding hpte_cache
structure into the lists used to find it later.  We cannot allocate
the hpte_cache structure inside this locked region because that can
lead to deadlock, so we allocate it outside the region and free it
if we end up not using it.

This also moves the updates of vcpu3s->hpte_cache_count inside the
regions locked with vcpu3s->mmu_lock, and does the increment in
kvmppc_mmu_hpte_cache_map() when the pte is added to the cache
rather than when it is allocated, in order that the hpte_cache_count
is accurate.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
2013-10-17 14:49:35 +02:00
..
boot Merge remote-tracking branch 'agust/next' into next 2013-09-05 16:43:30 +10:00
configs powerpc/85xx: Add C293PCIE board support 2013-08-23 19:43:24 -05:00
crypto
include KVM: PPC: Book3S PR: Use mmu_notifier_retry() in kvmppc_mmu_map_page() 2013-10-17 14:49:35 +02:00
kernel KVM: PPC: Book3S: Move skip-interrupt handlers to common code 2013-10-17 14:49:35 +02:00
kvm KVM: PPC: Book3S PR: Use mmu_notifier_retry() in kvmppc_mmu_map_page() 2013-10-17 14:49:35 +02:00
lib powerpc: Unaligned stores and stmw are broken in emulation code 2013-08-27 14:36:08 +10:00
math-emu powerpc/math-emu: Fix load/store indexed emulation 2013-08-14 14:59:57 +10:00
mm arch: mm: pass userspace fault flag to generic fault handler 2013-09-12 15:38:01 -07:00
net ppc: bpf_jit: can call module_free() from any context 2013-05-20 14:03:50 -07:00
oprofile Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc 2013-09-06 10:49:42 -07:00
perf Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc 2013-09-06 10:49:42 -07:00
platforms powerpc: Default arch idle could cede processor on pseries 2013-09-11 11:41:54 +10:00
sysdev IOMMU Updates for Linux v3.12 2013-09-12 11:29:26 -07:00
xmon powerpc/xmon: Fix printing of set of CPUs in xmon 2013-09-05 17:29:19 +10:00
Kconfig Remove GENERIC_HARDIRQ config option 2013-09-13 15:09:52 +02:00
Kconfig.debug Merge branch 'kconfig-diet' from Dave Hansen 2013-07-04 11:25:51 -07:00
Makefile powerpc/e500: Set -mcpu flag for 32-bit e500 2013-08-20 20:49:56 -05:00
relocs_check.pl Fix warning typo "CONFIG_RELCOATABLE" 2013-05-29 15:11:30 +02:00