Commit 55e4283c authored by Christian Borntraeger's avatar Christian Borntraeger Committed by Martin Schwidefsky

KVM: s390/mm: Fix page table locking vs. split pmd lock

commit ec66ad66 (s390/mm: enable
split page table lock for PMD level) activated the split pmd lock
for s390. Turns out that we missed one place: We also have to take
the pmd lock instead of the page table lock when we reallocate the
page tables (==> changing entries in the PMD) during sie enablement.

Cc: stable@vger.kernel.org # 3.15+
Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent a94fa154
...@@ -1279,6 +1279,7 @@ static unsigned long page_table_realloc_pmd(struct mmu_gather *tlb, ...@@ -1279,6 +1279,7 @@ static unsigned long page_table_realloc_pmd(struct mmu_gather *tlb,
{ {
unsigned long next, *table, *new; unsigned long next, *table, *new;
struct page *page; struct page *page;
spinlock_t *ptl;
pmd_t *pmd; pmd_t *pmd;
pmd = pmd_offset(pud, addr); pmd = pmd_offset(pud, addr);
...@@ -1296,7 +1297,7 @@ static unsigned long page_table_realloc_pmd(struct mmu_gather *tlb, ...@@ -1296,7 +1297,7 @@ static unsigned long page_table_realloc_pmd(struct mmu_gather *tlb,
if (!new) if (!new)
return -ENOMEM; return -ENOMEM;
spin_lock(&mm->page_table_lock); ptl = pmd_lock(mm, pmd);
if (likely((unsigned long *) pmd_deref(*pmd) == table)) { if (likely((unsigned long *) pmd_deref(*pmd) == table)) {
/* Nuke pmd entry pointing to the "short" page table */ /* Nuke pmd entry pointing to the "short" page table */
pmdp_flush_lazy(mm, addr, pmd); pmdp_flush_lazy(mm, addr, pmd);
...@@ -1310,7 +1311,7 @@ static unsigned long page_table_realloc_pmd(struct mmu_gather *tlb, ...@@ -1310,7 +1311,7 @@ static unsigned long page_table_realloc_pmd(struct mmu_gather *tlb,
page_table_free_rcu(tlb, table); page_table_free_rcu(tlb, table);
new = NULL; new = NULL;
} }
spin_unlock(&mm->page_table_lock); spin_unlock(ptl);
if (new) { if (new) {
page_table_free_pgste(new); page_table_free_pgste(new);
goto again; goto again;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment