This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [Xen-devel] PATCH: Hugepage support for Domains booting with 4KB pag

To: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Subject: Re: [Xen-devel] PATCH: Hugepage support for Domains booting with 4KB pages
From: Keshav Darak <keshav_darak@xxxxxxxxx>
Date: Tue, 22 Mar 2011 11:05:14 -0700 (PDT)
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Tue, 22 Mar 2011 11:06:12 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1300817114; bh=+hztCtaGEXq7C6UssMnNrYuTsGEjstovOFNONRBwoQk=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding; b=11GCWhkc7M52XlVz0ZRtLdCqq9hpRSlW78Rg69lagYEZovrnVfnF1dMIVJG20xm04JpPHUCvFech1hhazQYzjr1ABWo3WJFVpVawazREB+Xt1bx5zHBHeEzyy33OzqGGdBetwx/DIi9HB8JG2Km209PlFgLiXvr69ZdpDSwxXnc=
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding; b=kG8IXIzDYWPSTCogZmLktyAkQWyasyPJG3JQ0KyWwmVziLQX3HqYyHquaKutybvOWaPMaS+HCpBylI3/Arp145EW+iyaUTKMN4HFR7dQ+jY7U9AMIRn1k8fvjXGbCu05GYvsme7UZ3TO9n/f6PRuMpMg6cITCxk74vDh3JIqCDo=;
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx

Thanks for reviewing the patch.

>> We have implemented hugepage support for guests in following manner
>> In
>>  our implementation we added a parameter hugepage_num which is specified
>>  in the config file 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 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 

>There is bootup option for normal Linux kernels to set that up. Was
>that something you could use?

ya, it can be used too, to allocate the hugepages.

>> static inline int arch_prepare_hugepage(struct page *page)
>> {
>>index f46c340..00c489a 100644
>>--- a/arch/x86/mm/hugetlbpage.c
>>+++ b/arch/x86/mm/hugetlbpage.c
>>@@ -147,8 +147,7 @@ pte_t *huge_pte_alloc(struct mm_struct *mm,
>>             pte = (pte_t *) pmd_alloc(mm, pud, addr);
>>         }
>>     }
>>-    BUG_ON(pte && !pte_none(*pte) && !pte_huge(*pte));
>>+    BUG_ON(pte && !pte_none(*pte) && !((*pte).pte & (_AT(pteval_t, 1)<<7)));

>Ugh. That is horrible.

>why can't you use 'pte_huge' ? Is it b/c of this
> * (We should never see kernel mappings with _PAGE_PSE set,
> * but we could see hugetlbfs mappings, I think.).
> */

Here actually we don't known the exact reason, but when pte_huge was used the 
BUG_ON was called even though the PSE bit was set, so we had to rewrite the 
BUG_ON testing the 7th bit.there could be better ways to do it, But we couldn't 
find the exact reasons why was it(pte_huge) returning 0 even when the pte was a 

we will try to resolve other issues with the patch as soon as possible. 

Keshav Darak
Kaustubh Kabra
Ashwin Vasani
Aditya Gadre

Xen-devel mailing list