x86/mm: Fix pgd_lock deadlock
It's forbidden to take the page_table_lock with the irq disabled or if there's contention the IPIs (for tlb flushes) sent with the page_table_lock held will never run leading to a deadlock. Nobody takes the pgd_lock from irq context so the _irqsave can be removed. Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> Acked-by: Rik van Riel <riel@redhat.com> Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: <stable@kernel.org> LKML-Reference: <201102162345.p1GNjMjm021738@imap1.linux-foundation.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
committed by
Ingo Molnar
parent
f86268549f
commit
a79e53d856
@@ -121,14 +121,12 @@ static void pgd_ctor(struct mm_struct *mm, pgd_t *pgd)
|
||||
|
||||
static void pgd_dtor(pgd_t *pgd)
|
||||
{
|
||||
unsigned long flags; /* can be called from interrupt context */
|
||||
|
||||
if (SHARED_KERNEL_PMD)
|
||||
return;
|
||||
|
||||
spin_lock_irqsave(&pgd_lock, flags);
|
||||
spin_lock(&pgd_lock);
|
||||
pgd_list_del(pgd);
|
||||
spin_unlock_irqrestore(&pgd_lock, flags);
|
||||
spin_unlock(&pgd_lock);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -260,7 +258,6 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
|
||||
{
|
||||
pgd_t *pgd;
|
||||
pmd_t *pmds[PREALLOCATED_PMDS];
|
||||
unsigned long flags;
|
||||
|
||||
pgd = (pgd_t *)__get_free_page(PGALLOC_GFP);
|
||||
|
||||
@@ -280,12 +277,12 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
|
||||
* respect to anything walking the pgd_list, so that they
|
||||
* never see a partially populated pgd.
|
||||
*/
|
||||
spin_lock_irqsave(&pgd_lock, flags);
|
||||
spin_lock(&pgd_lock);
|
||||
|
||||
pgd_ctor(mm, pgd);
|
||||
pgd_prepopulate_pmd(mm, pgd, pmds);
|
||||
|
||||
spin_unlock_irqrestore(&pgd_lock, flags);
|
||||
spin_unlock(&pgd_lock);
|
||||
|
||||
return pgd;
|
||||
|
||||
|
Reference in New Issue
Block a user