]> git.baikalelectronics.ru Git - kernel.git/commit
ioremap: Update pgtable free interfaces with addr
authorChintan Pandya <cpandya@codeaurora.org>
Wed, 27 Jun 2018 14:13:47 +0000 (08:13 -0600)
committerThomas Gleixner <tglx@linutronix.de>
Wed, 4 Jul 2018 19:37:08 +0000 (21:37 +0200)
commit6c2e37cbcf27dc46c62fbd8e0b4508db9db6e0a9
tree972fe9d837f28bdafa492a09f2fafd0f54b1cde0
parent55ea8c08933f60fb802b9705c8a4ca7623e6684a
ioremap: Update pgtable free interfaces with addr

The following kernel panic was observed on ARM64 platform due to a stale
TLB entry.

 1. ioremap with 4K size, a valid pte page table is set.
 2. iounmap it, its pte entry is set to 0.
 3. ioremap the same address with 2M size, update its pmd entry with
    a new value.
 4. CPU may hit an exception because the old pmd entry is still in TLB,
    which leads to a kernel panic.

Commit 8a66778a8bfa ("mm/vmalloc: add interfaces to free unmapped page
table") has addressed this panic by falling to pte mappings in the above
case on ARM64.

To support pmd mappings in all cases, TLB purge needs to be performed
in this case on ARM64.

Add a new arg, 'addr', to pud_free_pmd_page() and pmd_free_pte_page()
so that TLB purge can be added later in seprate patches.

[toshi.kani@hpe.com: merge changes, rewrite patch description]
Fixes: b15082d1cbed ("x86/mm: implement free pmd/pte page interfaces")
Signed-off-by: Chintan Pandya <cpandya@codeaurora.org>
Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: mhocko@suse.com
Cc: akpm@linux-foundation.org
Cc: hpa@zytor.com
Cc: linux-mm@kvack.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: Will Deacon <will.deacon@arm.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: stable@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: <stable@vger.kernel.org>
Link: https://lkml.kernel.org/r/20180627141348.21777-3-toshi.kani@hpe.com
arch/arm64/mm/mmu.c
arch/x86/mm/pgtable.c
include/asm-generic/pgtable.h
lib/ioremap.c