From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932951AbbESPXO (ORCPT ); Tue, 19 May 2015 11:23:14 -0400 Received: from smtp02.citrix.com ([66.165.176.63]:52300 "EHLO SMTP02.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932354AbbESPXM (ORCPT ); Tue, 19 May 2015 11:23:12 -0400 X-IronPort-AV: E=Sophos;i="5.13,458,1427760000"; d="scan'208";a="266535511" Message-ID: <555B5557.2090405@citrix.com> Date: Tue, 19 May 2015 16:23:03 +0100 From: David Vrabel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.4.0 MIME-Version: 1.0 To: Julien Grall , CC: Wei Liu , , , , , David Vrabel , "Boris Ostrovsky" , Subject: Re: [Xen-devel] [RFC 15/23] xen/balloon: Don't rely on the page granularity is the same for Xen and Linux References: <1431622863-28575-1-git-send-email-julien.grall@citrix.com> <1431622863-28575-16-git-send-email-julien.grall@citrix.com> In-Reply-To: <1431622863-28575-16-git-send-email-julien.grall@citrix.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 8bit X-DLP: MIA2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14/05/15 18:00, Julien Grall wrote: > For ARM64 guests, Linux is able to support either 64K or 4K page > granularity. Although, the hypercall interface is always based on 4K > page granularity. > > With 64K page granuliarty, a single page will be spread over multiple > Xen frame. > > When a driver request/free a balloon page, the balloon driver will have > to split the Linux page in 4K chunk before asking Xen to add/remove the > frame from the guest. > > Note that this can work on any page granularity assuming it's a multiple > of 4K. [...] > --- a/drivers/xen/balloon.c > +++ b/drivers/xen/balloon.c > @@ -91,7 +91,7 @@ struct balloon_stats balloon_stats; > EXPORT_SYMBOL_GPL(balloon_stats); > > /* We increase/decrease in batches which fit in a page */ > -static xen_pfn_t frame_list[PAGE_SIZE / sizeof(unsigned long)]; > +static xen_pfn_t frame_list[XEN_PAGE_SIZE / sizeof(unsigned long)]; PAGE_SIZE is appropriate here, since this is a guest-side array. > + if (!(i % XEN_PFN_PER_PAGE)) { Ick. Can you refactor this into a loop per page calling a function that loops per MFN. Also similar tests elsewhere. David From mboxrd@z Thu Jan 1 00:00:00 1970 From: david.vrabel@citrix.com (David Vrabel) Date: Tue, 19 May 2015 16:23:03 +0100 Subject: [Xen-devel] [RFC 15/23] xen/balloon: Don't rely on the page granularity is the same for Xen and Linux In-Reply-To: <1431622863-28575-16-git-send-email-julien.grall@citrix.com> References: <1431622863-28575-1-git-send-email-julien.grall@citrix.com> <1431622863-28575-16-git-send-email-julien.grall@citrix.com> Message-ID: <555B5557.2090405@citrix.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On 14/05/15 18:00, Julien Grall wrote: > For ARM64 guests, Linux is able to support either 64K or 4K page > granularity. Although, the hypercall interface is always based on 4K > page granularity. > > With 64K page granuliarty, a single page will be spread over multiple > Xen frame. > > When a driver request/free a balloon page, the balloon driver will have > to split the Linux page in 4K chunk before asking Xen to add/remove the > frame from the guest. > > Note that this can work on any page granularity assuming it's a multiple > of 4K. [...] > --- a/drivers/xen/balloon.c > +++ b/drivers/xen/balloon.c > @@ -91,7 +91,7 @@ struct balloon_stats balloon_stats; > EXPORT_SYMBOL_GPL(balloon_stats); > > /* We increase/decrease in batches which fit in a page */ > -static xen_pfn_t frame_list[PAGE_SIZE / sizeof(unsigned long)]; > +static xen_pfn_t frame_list[XEN_PAGE_SIZE / sizeof(unsigned long)]; PAGE_SIZE is appropriate here, since this is a guest-side array. > + if (!(i % XEN_PFN_PER_PAGE)) { Ick. Can you refactor this into a loop per page calling a function that loops per MFN. Also similar tests elsewhere. David