WARNING - OLD ARCHIVES

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/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [Linux PATCH] Make hugepages work in current git tree

To: Jeremy Fitzhardinge <jeremy@xxxxxxxx>,Jan Beulich <JBeulich@xxxxxxxxxx>
Subject: [Xen-devel] [Linux PATCH] Make hugepages work in current git tree
From: Dave McCracken <dcm@xxxxxxxx>
Date: Wed, 28 Apr 2010 09:08:25 -0500
Cc: Xen Developers List <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 28 Apr 2010 07:09:14 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:from:to:cc:date :message-id:subject; bh=lxKd5U8oqlVxfM5ezz7SZsZfASZw5T9BBXF3kLuoGTI=; b=CdIXUwhe2Sl1YmZ0lPuD/4NRTiANe0wev8RjxjKdd1BQFyF8AMTmSZCxjXX1mX759p 4O6DBz6YPZ8+bf/Ky1eAyDPqPRVq3+FjYdke/HcixCNJzHsL9zvxo0yppwgBEfSJcZ2G kQKJcqnJaxO04EgJ493azCZy7JmMVXOnyGQiY=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:cc:date:message-id:subject; b=had5ooOBPjAG52rPvt5ibWMnbCVj3+KofZmt+iMLVBJmZNUqdlvHI6yaC+wvvhKqkq 6wcDlLDxzA4K8aoHJb4/hR/7OwJn89ji/0IpEauizPxBZ52saRph1GfNb5UYkhB5jmDv C6PHcZ4FeXDhD4SBZIhNduqFeEJp5hY3ib2bI=
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
Somewhere in the move to the paravirt way of doing things hugepages
stopped working.  This patch fixes hugepages.

Signed-off-by: Dave McCracken <dave.mccracken@xxxxxxxxxx>

--------

--- 2.6-xen/arch/x86/include/asm/hugetlb.h      2009-10-29 17:48:21.000000000 
-0500
+++ 2.6-xen-huge/arch/x86/include/asm/hugetlb.h 2010-04-21 09:50:40.000000000 
-0500
@@ -36,16 +36,24 @@ static inline void hugetlb_free_pgd_rang
        free_pgd_range(tlb, addr, end, floor, ceiling);
 }
 
+static inline pte_t huge_ptep_get(pte_t *ptep)
+{
+       return *ptep;
+}
+
 static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
                                   pte_t *ptep, pte_t pte)
 {
-       set_pte_at(mm, addr, ptep, pte);
+       set_pmd((pmd_t *)ptep, __pmd(pte_val(pte)));
 }
 
 static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
                                            unsigned long addr, pte_t *ptep)
 {
-       return ptep_get_and_clear(mm, addr, ptep);
+       pte_t pte = huge_ptep_get(ptep);
+
+       set_huge_pte_at(mm, addr, ptep, __pte(0));
+       return pte;
 }
 
 static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
@@ -66,19 +74,25 @@ static inline pte_t huge_pte_wrprotect(p
 static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
                                           unsigned long addr, pte_t *ptep)
 {
-       ptep_set_wrprotect(mm, addr, ptep);
+       pte_t pte = huge_ptep_get(ptep);
+
+       pte = pte_wrprotect(pte);
+       set_huge_pte_at(mm, addr, ptep, pte);
 }
 
 static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,
                                             unsigned long addr, pte_t *ptep,
                                             pte_t pte, int dirty)
 {
-       return ptep_set_access_flags(vma, addr, ptep, pte, dirty);
-}
+       pte_t oldpte = huge_ptep_get(ptep);
+       int changed = !pte_same(oldpte, pte);
 
-static inline pte_t huge_ptep_get(pte_t *ptep)
-{
-       return *ptep;
+       if (changed && dirty) {
+               set_huge_pte_at(vma->vm_mm, addr, ptep, pte);
+               flush_tlb_page(vma, addr);
+       }
+
+       return changed;
 }
 
 static inline int arch_prepare_hugepage(struct page *page)

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel