]> git.neil.brown.name Git - history.git/commitdiff
[ARM] Fix page table spinlocking
authorRussell King <rmk@flint.arm.linux.org.uk>
Thu, 25 Sep 2003 23:40:06 +0000 (00:40 +0100)
committerRussell King <rmk@flint.arm.linux.org.uk>
Thu, 25 Sep 2003 23:40:06 +0000 (00:40 +0100)
Patch from Kevin Welton.

The initialisation routines in consistent.c and minicache.c both fail
to put a spinlock in init_mm.page_table_lock when they should do.

arch/arm/mm/consistent.c
arch/arm/mm/minicache.c

index 2db4fb564f363efa0c7f9b2049ee1a86ec846f04..65f1f228692589e48db31ef0ec80f75e97cef500 100644 (file)
@@ -321,28 +321,33 @@ static int __init consistent_init(void)
        pgd_t *pgd;
        pmd_t *pmd;
        pte_t *pte;
+       int ret = 0;
+
+       spin_lock(&init_mm.page_table_lock);
 
        do {
                pgd = pgd_offset(&init_mm, CONSISTENT_BASE);
                pmd = pmd_alloc(&init_mm, pgd, CONSISTENT_BASE);
                if (!pmd) {
-                       printk(KERN_ERR "consistent_init: out of pmd tables\n");
-                       return -ENOMEM;
-               }
-               if (!pmd_none(*pmd)) {
-                       printk(KERN_ERR "consistent_init: PMD already allocated\n");
-                       return -EINVAL;
+                       printk(KERN_ERR "consistent_init: no pmd tables\n");
+                       ret = -ENOMEM;
+                       break;
                }
+               WARN_ON(!pmd_none(*pmd));
+
                pte = pte_alloc_kernel(&init_mm, pmd, CONSISTENT_BASE);
                if (!pte) {
-                       printk(KERN_ERR "consistent_init: out of pte tables\n");
-                       return -ENOMEM;
+                       printk(KERN_ERR "consistent_init: no pte tables\n");
+                       ret = -ENOMEM;
+                       break;
                }
 
                consistent_pte = pte;
        } while (0);
 
-       return 0;
+       spin_unlock(&init_mm.page_table_lock);
+
+       return ret;
 }
 
 core_initcall(consistent_init);
index 0ef53e8e4ec0a57d7e3872259622e3d679cede03..2ba23566a095c3ebaafa57dc3006fe2e2f0b86c7 100644 (file)
@@ -56,6 +56,8 @@ static int __init minicache_init(void)
        pgd_t *pgd;
        pmd_t *pmd;
 
+       spin_lock(&init_mm.page_table_lock);
+
        pgd = pgd_offset_k(minicache_address);
        pmd = pmd_alloc(&init_mm, pgd, minicache_address);
        if (!pmd)
@@ -64,6 +66,8 @@ static int __init minicache_init(void)
        if (!minicache_pte)
                BUG();
 
+       spin_unlock(&init_mm.page_table_lock);
+
        return 0;
 }