From 011928c72ffc642bf0e50779efa9af0ff9df58fc Mon Sep 17 00:00:00 2001 From: Russell King Date: Fri, 26 Sep 2003 00:40:06 +0100 Subject: [PATCH] [ARM] Fix page table spinlocking 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 | 23 ++++++++++++++--------- arch/arm/mm/minicache.c | 4 ++++ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/arch/arm/mm/consistent.c b/arch/arm/mm/consistent.c index 2db4fb564f36..65f1f2286925 100644 --- a/arch/arm/mm/consistent.c +++ b/arch/arm/mm/consistent.c @@ -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); diff --git a/arch/arm/mm/minicache.c b/arch/arm/mm/minicache.c index 0ef53e8e4ec0..2ba23566a095 100644 --- a/arch/arm/mm/minicache.c +++ b/arch/arm/mm/minicache.c @@ -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; } -- 2.47.3