Re: [PATCH] KVM: PPC: Book3S HV: Fix refcounting of hugepages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08.05.2012, at 12:24, Paul Mackerras wrote:

> From: David Gibson <david@xxxxxxxxxxxxxxxxxxxxx>
> 
> 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@xxxxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Paul Mackerras <paulus@xxxxxxxxx>

Acked-by: Alexander Graf <agraf@xxxxxxx>

Avi, could you please make sure this makes the next 3.4-rc or -stable?


Thanks!

Alex

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux