From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] KVM: PPC: Book3S HV: Fix refcounting of hugepages Date: Tue, 08 May 2012 17:54:33 +0300 Message-ID: <4FA933A9.8010502@redhat.com> References: <20120508102408.GB6745@bloggs.ozlabs.ibm.com> <59AC9683-912F-49C6-983E-1CE34E23BC5E@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Paul Mackerras , kvm-ppc@vger.kernel.org, kvm@vger.kernel.org To: Alexander Graf Return-path: In-Reply-To: <59AC9683-912F-49C6-983E-1CE34E23BC5E@suse.de> Sender: kvm-ppc-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 05/08/2012 04:10 PM, Alexander Graf wrote: > On 08.05.2012, at 12:24, Paul Mackerras wrote: > > > From: David Gibson > > > > 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 > > Signed-off-by: Paul Mackerras > > Acked-by: Alexander Graf > > Avi, could you please make sure this makes the next 3.4-rc or -stable? > > Sure, applied to master, will push tomorrow. -- error compiling committee.c: too many arguments to function