linux/arch/powerpc/kvm
David Gibson de6c0b02d4 KVM: PPC: Book3S HV: Fix refcounting of hugepages
The H_REGISTER_VPA hcall implementation in HV Power KVM needs to pin some
guest memory pages into host memory so that they can be safely accessed
from usermode.  It does this used get_user_pages_fast().  When the VPA is
unregistered, or the VCPUs are cleaned up, these pages are released using
put_page().

However, the get_user_pages() is invoked on the specific memory are of the
VPA which could lie within hugepages.  In case the pinned page is huge,
we explicitly find the head page of the compound page before calling
put_page() on it.

At least with the latest kernel, this is not correct.  put_page() already
handles finding the correct head page of a compound, and also deals with
various counts on the individual tail page which are important for
transparent huge pages.  We don't support transparent hugepages on Power,
but even so, bypassing this count maintenance can lead (when the VM ends)
to a hugepage being released back to the pool with a non-zero mapcount on
one of the tail pages.  This can then lead to a bad_page() when the page
is released from the hugepage pool.

This removes the explicit compound_head() call to correct this bug.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Avi Kivity <avi@redhat.com>
2012-05-08 17:54:08 +03:00
..
44x.c powerpc: include export.h for files using EXPORT_SYMBOL/THIS_MODULE 2011-10-31 19:30:38 -04:00
44x_emulate.c KVM: PPC: fix exit accounting for SPRs, tlbwe, tlbsx 2011-05-22 08:47:47 -04:00
44x_tlb.c KVM: PPC: e500: Add shadow PID support 2011-07-12 13:16:39 +03:00
44x_tlb.h KVM: ppc: rename 44x MMU functions used in booke.c 2009-03-24 11:02:56 +02:00
book3s.c KVM: PPC: Book3s HV: Implement get_dirty_log using hardware changed bit 2012-03-05 14:52:39 +02:00
book3s_32_mmu.c KVM: PPC: Put segment registers in shared page 2010-10-24 10:52:11 +02:00
book3s_32_mmu_host.c KVM: PPC: Use get/set for to_svcpu to help preemption 2012-03-05 14:52:30 +02:00
book3s_32_sr.S KVM: PPC: book3s_pr: Simplify transitions between virtual and real mode 2011-09-25 19:52:29 +03:00
book3s_64_mmu.c KVM: PPC: Interpret SDR1 as HVA in PAPR mode 2011-09-25 19:52:21 +03:00
book3s_64_mmu_host.c KVM: PPC: Use get/set for to_svcpu to help preemption 2012-03-05 14:52:30 +02:00
book3s_64_mmu_hv.c KVM: PPC: Book3S HV: Fix refcounting of hugepages 2012-05-08 17:54:08 +03:00
book3s_64_slb.S KVM: PPC: book3s_pr: Simplify transitions between virtual and real mode 2011-09-25 19:52:29 +03:00
book3s_64_vio_hv.c KVM: PPC: Accelerate H_PUT_TCE by implementing it in real mode 2011-07-12 13:16:56 +03:00
book3s_emulate.c powerpc/kvm: Fallout from system.h disintegration 2012-04-02 14:00:04 +10:00
book3s_exports.c powerpc: various straight conversions from module.h --> export.h 2011-10-31 19:30:44 -04:00
book3s_hv.c KVM: PPC: Book3S HV: Fix refcounting of hugepages 2012-05-08 17:54:08 +03:00
book3s_hv_builtin.c KVM: PPC: Book3S HV: Fix kvm_alloc_linear in case where no linears exist 2012-04-03 16:42:22 +10:00
book3s_hv_interrupts.S KVM: PPC: Book3S HV: Save and restore CR in __kvmppc_vcore_entry 2012-04-03 16:42:30 +10:00
book3s_hv_rm_mmu.c KVM: Move gfn_to_memslot() to kvm_host.h 2012-03-05 14:57:22 +02:00
book3s_hv_rmhandlers.S KVM: PPC: Allow for read-only pages backing a Book3S HV guest 2012-03-05 14:52:38 +02:00
book3s_interrupts.S KVM: PPC: Save/Restore CR over vcpu_run 2012-04-03 16:42:34 +10:00
book3s_mmu_hpte.c KVM: PPC: Move fields between struct kvm_vcpu_arch and kvmppc_vcpu_book3s 2011-07-12 13:16:46 +03:00
book3s_paired_singles.c powerpc/kvm: Fallout from system.h disintegration 2012-04-02 14:00:04 +10:00
book3s_pr.c KVM: PPC: Book3S: PR: Fix preemption 2012-04-03 16:42:39 +10:00
book3s_pr_papr.c KVM: PPC: Add PAPR hypercall code for PR mode 2011-09-25 19:52:24 +03:00
book3s_rmhandlers.S KVM: PPC: book3s_pr: Simplify transitions between virtual and real mode 2011-09-25 19:52:29 +03:00
book3s_segment.S KVM: PPC: book3s_pr: Simplify transitions between virtual and real mode 2011-09-25 19:52:29 +03:00
booke.c KVM: PPC: Move kvm_vcpu_ioctl_[gs]et_one_reg down to platform-specific code 2012-03-05 14:52:41 +02:00
booke.h KVM: PPC: booke: Improve timer register emulation 2012-03-05 14:52:27 +02:00
booke_emulate.c KVM: PPC: booke: Improve timer register emulation 2012-03-05 14:52:27 +02:00
booke_interrupts.S KVM: PPC: Save/Restore CR over vcpu_run 2012-04-03 16:42:34 +10:00
e500.c KVM: PPC: E500: Fail init when not on e500v2 2012-03-05 14:57:23 +02:00
e500_emulate.c KVM: PPC: Paravirtualize SPRG4-7, ESR, PIR, MASn 2012-03-05 14:52:26 +02:00
e500_tlb.c KVM: PPC: booke: Add booke206 TLB trace 2012-03-05 14:52:40 +02:00
e500_tlb.h KVM: PPC: Paravirtualize SPRG4-7, ESR, PIR, MASn 2012-03-05 14:52:26 +02:00
emulate.c KVM: PPC: booke: Improve timer register emulation 2012-03-05 14:52:27 +02:00
fpu.S powerpc: Remove fpscr use from [kvm_]cvt_{fd,df} 2010-09-02 14:07:32 +10:00
Kconfig KVM: PPC: Implement MMU notifiers for Book3S HV guests 2012-03-05 14:52:38 +02:00
Makefile KVM: PPC: Assemble book3s{,_hv}_rmhandlers.S separately 2011-09-25 19:52:28 +03:00
powerpc.c KVM: Introduce kvm_memory_slot::arch and move lpage_info into it 2012-03-08 14:10:22 +02:00
timing.c KVM: PPC: fix partial application of "exit timing in ticks" 2011-07-12 13:16:28 +03:00
timing.h KVM: powerpc: Fix BUILD_BUG_ON condition 2009-12-03 09:32:22 +02:00
trace.h KVM: PPC: booke: Add booke206 TLB trace 2012-03-05 14:52:40 +02:00