From: Keshav Darak Subject: Re: PATCH: Hugepage support for Domains booting with 4KB pages Date: Tue, 22 Mar 2011 05:36:33 -0700 (PDT) Message-ID: <205767.82133.qm@web59601.mail.ac4.yahoo.com> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1976949764==" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com, Keir Fraser Cc: jeremy@goop.org List-Id: xen-devel@lists.xenproject.org --===============1976949764== Content-Type: multipart/alternative; boundary="0-246639749-1300797393=:82133" --0-246639749-1300797393=:82133 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Keir, =A0=A0=A0 We are aware of it and we have to use 'opt_allow_superpages' bool= ean flag in our implementation too. But when we use superpages flag in doma= in configuration file, entire domain boots on hugepages (superpages).If the specified memory in 'h= ugepages' for the domain is not available, then the domain does not boot.= =20 =A0=A0=A0=A0 But in our implementation , we target to give only those many = hugepages ( using "hugepage_num" option in config file) to the domain that = it actually requires and hence entire domain need not be booted on hugepage= s. =A0=A0=A0=A0 This is to support domains that boot with 4 KB pages and still= can use hugepages. So, the pressure on the number of hugepages required for a domain even to boot = is reduced to a great extent.=20 --- On Mon, 3/21/11, Keir Fraser wrote: From: Keir Fraser Subject: Re: [Xen-devel] PATCH: Hugepage support for Domains booting with 4= KB pages To: "Keshav Darak" , xen-devel@lists.xensource.com Cc: jeremy@goop.org Date: Monday, March 21, 2011, 9:31 PM Keshav, There is already optional support for superpage allocations and mappings fo= r PV guests in the hypervisor and toolstack. See the opt_allow_superpages boolean flag in the hypervisor, and the 'superpages' domain config option that can be specified when creating a new domain via xend/xm. -- Keir On 21/03/2011 21:01, "Keshav Darak" wrote: > have corrected few mistakes in previously attached xen patch file. > Please review it. >=20 > --- On Sun, 3/20/11, Keshav Darak wrote: >>=20 >> From: Keshav Darak >> Subject: [Xen-devel] PATCH: Hugepage support for Domains booting with 4K= B >> pages >> To: xen-devel@lists.xensource.com >> Cc: jeremy@goop.org, keir@xen.org >> Date: Sunday, March 20, 2011, 10:34 PM >>=20 >> We have implemented hugepage support for guests in following manner >>=20 >> In our implementation we added a parameter hugepage_num which is specifi= ed in >> the config file of the DomU. It is the number of hugepages that the gues= t is >> guaranteed to receive whenever the kernel asks for hugepage by using its= boot >> time parameter or reserving after booting (eg. Using echo XX > >> /proc/sys/vm/nr_hugepages). During creation of the domain we reserve MFN= 's >> for these hugepages and store them in the list. The listhead of this lis= t is >> inside the domain structure with name "hugepage_list". When the domain i= s >> booting, at that time the memory seen by the kernel is allocated memory= =A0 less >> the amount required for hugepages. The function reserve_hugepage_range i= s >> called as a initcall. Before this function the xen_extra_mem_start point= s to >> this apparent end of the memory. In this function we reserve the PFN ran= ge >> for the hugepages which are going to be allocated by kernel by increment= ing >> the xen_extra_mem_start. We maintain these PFNs as pages in >> "xen_hugepfn_list" in the kernel. >>=20 >> Now before the kernel requests for hugepages, it makes a hypercall >> HYPERVISOR_memory_op=A0 to get count of hugepages allocated to it and >> accordingly reserves the pfn range. >> then whenever kernel requests for hugepages it again make hypercall >> HYPERVISOR_memory_op to get the preallocated hugepage and according make= s the >> p2m mapping on both sides (xen as well as kernel side) >>=20 >> The approach can be better explained using the presentation attached. >>=20 >> -- >> Keshav Darak >> Kaustubh Kabra >> Ashwin Vasani=20 >> Aditya Gadre >>=20 >>=A0=20 >>=20 >> -----Inline Attachment Follows----- >>=20 >> _______________________________________________ >> Xen-devel mailing list >> Xen-devel@lists.xensource.com >> http://lists.xensource.com/xen-devel >=20 >=20 =0A=0A=0A --0-246639749-1300797393=:82133 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable
Keir,
    We are aware of i= t and we have to use 'opt_allow_superpages' boolean flag in our implementat= ion too. But when we use superpages flag in domain configuration file,
e= ntire domain boots on hugepages (superpages).If the specified memory in 'hu= gepages' for the domain is not available, then the domain does not boot.      But in our implementation , we target to give on= ly those many hugepages ( using "hugepage_num" option in config file) to th= e domain that it actually requires and hence entire domain need not be boot= ed on hugepages.
     This is to support domains tha= t boot with 4 KB pages and still can use hugepages. So,
the pressure on = the number of hugepages required for a domain even to boot is reduced to a = great extent.
--- On Mon, 3/21/11, Keir Fraser <keir.xen@gmail.com> wrote:
<= br>From: Keir Fraser <keir.xen@gmail.com>
Subject: Re: [Xen-devel]= PATCH: Hugepage support for Domains booting with 4KB pages
To: "Keshav = Darak" <keshav_darak@yahoo.com>, xen-devel@lists.xensource.com
Cc:= jeremy@goop.org
Date: Monday, March 21, 2011, 9:31 PM

Keshav,

There is already optional support for superpa= ge allocations and mappings for
PV guests in the hypervisor and toolstac= k. See the opt_allow_superpages
boolean flag in the hypervisor, and the = 'superpages' domain config option
that can be specified when creating a = new domain via xend/xm.

-- Keir

On 21/03/2011 21:01, "Keshav= Darak" <keshav_darak@yahoo.com> wrote:

> have corrected few mistakes in previously attached xen = patch file.
> Please review it.
>
> --- On Sun, 3/20/11,= Keshav Darak <keshav_darak@yahoo.com> wrote:<= br>>>
>> From: Keshav Darak <keshav_d= arak@yahoo.com>
>> Subject: [Xen-devel] PATCH: Hugepage sup= port for Domains booting with 4KB
>> pages
>> To: xen-devel@lists.xensource.com
>> Cc:= jeremy@goop.org, keir@xen.org
>> Date: Sunday, March = 20, 2011, 10:34 PM
>>
>> We have implemented hugepage support for guest= s in following manner
>>
>> In our implementation we add= ed a parameter hugepage_num which is specified in
>> the config fi= le of the DomU. It is the number of hugepages that the guest is
>>= guaranteed to receive whenever the kernel asks for hugepage by using its b= oot
>> time parameter or reserving after booting (eg. Using echo X= X >
>> /proc/sys/vm/nr_hugepages). During creation of the domai= n we reserve MFN's
>> for these hugepages and store them in the li= st. The listhead of this list is
>> inside the domain structure wi= th name "hugepage_list". When the domain is
>> booting, at that ti= me the memory seen by the kernel is allocated memory  less
>>= the amount required for hugepages. The function reserve_hugepage_range is<= br>>> called as a initcall. Before this function the xen_extra_mem_start points to
>> this apparent end of the memory.= In this function we reserve the PFN range
>> for the hugepages wh= ich are going to be allocated by kernel by incrementing
>> the xen= _extra_mem_start. We maintain these PFNs as pages in
>> "xen_hugep= fn_list" in the kernel.
>>
>> Now before the kernel requ= ests for hugepages, it makes a hypercall
>> HYPERVISOR_memory_op&n= bsp; to get count of hugepages allocated to it and
>> accordingly = reserves the pfn range.
>> then whenever kernel requests for hugep= ages it again make hypercall
>> HYPERVISOR_memory_op to get the pr= eallocated hugepage and according makes the
>> p2m mapping on both= sides (xen as well as kernel side)
>>
>> The approach c= an be better explained using the presentation attached.
>>
>= ;> --
>> Keshav Darak
>> Kaustubh Kabra
>> Ashwin Vasani
>> Aditya Gadre
>>
= >> 
>>
>> -----Inline Attachment Follows----= -
>>
>> _______________________________________________<= br>>> Xen-devel mailing list
>> Xen-devel@lists.xensource.com </mc/compose?to=3DXen-devel@lists.xensource.com>
>> http://lists.xe= nsource.com/xen-devel
>
>


<= /td>

=0A=0A --0-246639749-1300797393=:82133-- --===============1976949764== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============1976949764==--