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-changelog

[Xen-changelog] All page directory pages have to be pinned before/during

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] All page directory pages have to be pinned before/during relocation, so
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Wed, 01 Jun 2005 16:40:26 +0000
Delivery-date: Thu, 02 Jun 2005 09:02:07 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
ChangeSet 1.1629.1.1, 2005/06/01 17:40:26+01:00, cl349@xxxxxxxxxxxxxxxxxxxx

        All page directory pages have to be pinned before/during relocation, so
        that the entries they contain can be canonicalised during relocation.
        mmu_context.h, mmu.h, pgtable.c, ldt.c, reboot.c:
          Pin all unpinned in-use pgd's before relocation.
        reboot.c:
          Flush the pgd cache before relocation.
        Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>



 arch/xen/i386/kernel/ldt.c             |    9 +++++++++
 arch/xen/i386/mm/pgtable.c             |   16 ++++++++++++++++
 arch/xen/kernel/reboot.c               |    3 +++
 include/asm-xen/asm-i386/mmu.h         |    4 ++++
 include/asm-xen/asm-i386/mmu_context.h |    1 +
 5 files changed, 33 insertions(+)


diff -Nru a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/ldt.c 
b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/ldt.c
--- a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/ldt.c        2005-06-02 
05:03:00 -04:00
+++ b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/ldt.c        2005-06-02 
05:03:00 -04:00
@@ -18,6 +18,7 @@
 #include <asm/system.h>
 #include <asm/ldt.h>
 #include <asm/desc.h>
+#include <asm/mmu_context.h>
 
 #ifdef CONFIG_SMP /* avoids "defined but not used" warnig */
 static void flush_ldt(void *null)
@@ -108,6 +109,11 @@
                retval = copy_ldt(&mm->context, &old_mm->context);
                up(&old_mm->context.sem);
        }
+       if (retval == 0) {
+               spin_lock(&mm_unpinned_lock);
+               list_add(&mm->context.unpinned, &mm_unpinned);
+               spin_unlock(&mm_unpinned_lock);
+       }
        return retval;
 }
 
@@ -128,6 +134,9 @@
                        kfree(mm->context.ldt);
                mm->context.size = 0;
        }
+       spin_lock(&mm_unpinned_lock);
+       list_del(&mm->context.unpinned);
+       spin_unlock(&mm_unpinned_lock);
 }
 
 static int read_ldt(void __user * ptr, unsigned long bytecount)
diff -Nru a/linux-2.6.11-xen-sparse/arch/xen/i386/mm/pgtable.c 
b/linux-2.6.11-xen-sparse/arch/xen/i386/mm/pgtable.c
--- a/linux-2.6.11-xen-sparse/arch/xen/i386/mm/pgtable.c        2005-06-02 
05:03:00 -04:00
+++ b/linux-2.6.11-xen-sparse/arch/xen/i386/mm/pgtable.c        2005-06-02 
05:03:00 -04:00
@@ -408,6 +408,9 @@
 }
 #endif /* CONFIG_XEN_SHADOW_MODE */
 
+LIST_HEAD(mm_unpinned);
+DEFINE_SPINLOCK(mm_unpinned_lock);
+
 static inline void mm_walk_set_prot(void *pt, pgprot_t flags)
 {
        struct page *page = virt_to_page(pt);
@@ -461,6 +464,9 @@
         pfn_pte(virt_to_phys(mm->pgd)>>PAGE_SHIFT, PAGE_KERNEL_RO), 0);
     xen_pgd_pin(__pa(mm->pgd));
     mm->context.pinned = 1;
+    spin_lock(&mm_unpinned_lock);
+    list_del(&mm->context.unpinned);
+    spin_unlock(&mm_unpinned_lock);
 
     spin_unlock(&mm->page_table_lock);
 }
@@ -475,8 +481,18 @@
         pfn_pte(virt_to_phys(mm->pgd)>>PAGE_SHIFT, PAGE_KERNEL), 0);
     mm_walk(mm, PAGE_KERNEL);
     mm->context.pinned = 0;
+    spin_lock(&mm_unpinned_lock);
+    list_add(&mm->context.unpinned, &mm_unpinned);
+    spin_unlock(&mm_unpinned_lock);
 
     spin_unlock(&mm->page_table_lock);
+}
+
+void mm_pin_all(void)
+{
+    while (!list_empty(&mm_unpinned))  
+       mm_pin(list_entry(mm_unpinned.next, struct mm_struct,
+                         context.unpinned));
 }
 
 void _arch_exit_mmap(struct mm_struct *mm)
diff -Nru a/linux-2.6.11-xen-sparse/arch/xen/kernel/reboot.c 
b/linux-2.6.11-xen-sparse/arch/xen/kernel/reboot.c
--- a/linux-2.6.11-xen-sparse/arch/xen/kernel/reboot.c  2005-06-02 05:03:00 
-04:00
+++ b/linux-2.6.11-xen-sparse/arch/xen/kernel/reboot.c  2005-06-02 05:03:00 
-04:00
@@ -103,6 +103,9 @@
 
     __cli();
 
+    mm_pin_all();
+    kmem_cache_shrink(pgd_cache);
+
     netif_suspend();
 
     blkdev_suspend();
diff -Nru a/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/mmu.h 
b/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/mmu.h
--- a/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/mmu.h    2005-06-02 
05:03:00 -04:00
+++ b/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/mmu.h    2005-06-02 
05:03:00 -04:00
@@ -13,7 +13,11 @@
        struct semaphore sem;
        void *ldt;
        unsigned pinned:1;
+       struct list_head unpinned;
 } mm_context_t;
+
+extern struct list_head mm_unpinned;
+extern spinlock_t mm_unpinned_lock;
 
 /* mm/memory.c:exit_mmap hook */
 extern void _arch_exit_mmap(struct mm_struct *mm);
diff -Nru a/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/mmu_context.h 
b/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/mmu_context.h
--- a/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/mmu_context.h    
2005-06-02 05:03:00 -04:00
+++ b/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/mmu_context.h    
2005-06-02 05:03:00 -04:00
@@ -43,6 +43,7 @@
 
 extern void mm_pin(struct mm_struct *mm);
 extern void mm_unpin(struct mm_struct *mm);
+void mm_pin_all(void);
 
 static inline void switch_mm(struct mm_struct *prev,
                             struct mm_struct *next,

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] All page directory pages have to be pinned before/during relocation, so, BitKeeper Bot <=