Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932578AbbHJSiy (ORCPT ); Mon, 10 Aug 2015 14:38:54 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:18727 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932271AbbHJSiw (ORCPT ); Mon, 10 Aug 2015 14:38:52 -0400 Message-ID: <55C8EFB4.5070008@oracle.com> Date: Mon, 10 Aug 2015 14:38:44 -0400 From: Boris Ostrovsky User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Julien Grall , xen-devel@lists.xenproject.org CC: linux-kernel@vger.kernel.org, Konrad Rzeszutek Wilk , David Vrabel , Wei Liu Subject: Re: [PATCH] xen/xenbus: Don't leak memory when unmapping the ring on HVM backend References: <1439230238-6413-1-git-send-email-julien.grall@citrix.com> In-Reply-To: <1439230238-6413-1-git-send-email-julien.grall@citrix.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1813 Lines: 49 On 08/10/2015 02:10 PM, Julien Grall wrote: > The commit ccc9d90a9a8b5c4ad7e9708ec41f75ff9e98d61d "xenbus_client: > Extend interface to support multi-page ring" removes the call to > free_xenballooned_pages in xenbus_unmap_ring_vfree_hvm. > > This will result to not give back the pages to Linux and loose them > forever. It only happens when the backends are running in HVM domains. > > Signed-off-by: Julien Grall Reviewed-by: Boris Ostrovsky > > --- > Cc: Konrad Rzeszutek Wilk > Cc: Boris Ostrovsky > Cc: David Vrabel > Cc: Wei Liu > > Appeared in Linux 4.1. HVM backend, which is always the case on ARM, will > leak every mapped ring (i.e ~12KB per domain with 1 disk and 1 vif). > --- > drivers/xen/xenbus/xenbus_client.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c > index 9ad3272..e303535 100644 > --- a/drivers/xen/xenbus/xenbus_client.c > +++ b/drivers/xen/xenbus/xenbus_client.c > @@ -814,8 +814,10 @@ static int xenbus_unmap_ring_vfree_hvm(struct xenbus_device *dev, void *vaddr) > > rv = xenbus_unmap_ring(dev, node->handles, node->nr_handles, > addrs); > - if (!rv) > + if (!rv) { > vunmap(vaddr); > + free_xenballooned_pages(node->nr_handles, node->hvm.pages); > + } > else > WARN(1, "Leaking %p, size %u page(s)\n", vaddr, > node->nr_handles); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/