kernel-ark/arch/mips/mm
David Daney ac53c4fca4 MIPS: Avoid mcheck by flushing page range in huge_ptep_set_access_flags()
Problem:

1) Huge page mapping of anonymous memory is initially invalid.  Will be
   faulted in by copy-on-write mechanism.

2) Userspace attempts store at the end of the huge mapping.

3) TLB Refill exception handler fill TLB with a normal (4K sized)
   invalid page at the end of the huge mapping virtual address range.

4) Userspace restarted, and re-attempts the store at the end of the
   huge mapping.

5) Page from #3 is invalid, we get a fault and go to the hugepage
   fault handler.  This tries to map a huge page and calls
   huge_ptep_set_access_flags() to install the mapping.

6) We just call the generic ptep_set_access_flags() to set up the page
   tables, but the flush there assumes a normal (4K sized) page and
   only tries to flush the first part of the huge page virtual address
   out of the TLB, since the existing entry from step #3 doesn't
   conflict, nothing is flushed.

7) We attempt to load the mapping into the TLB, but because it
   conflicts with the entry from step #3, we get a Machine Check
   exception.

The fix: Flush the entire rage covered by the huge page in
huge_ptep_set_access_flags(), and remove the optimization in
local_flush_tlb_range() so that the flush actually does the correct
thing.

Signed-off-by: David Daney <david.daney@cavium.com>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Cc: Hillf Danton <dhillf@gmail.com>
Patchwork: https://patchwork.linux-mips.org/patch/4661/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
(cherry picked from commit dd617f258cc39d36be26afee9912624a2d23112c)
2012-12-04 16:57:54 +01:00
..
c-octeon.c MIPS: Octeon: Use board_cache_error_setup for cache error handler setup. 2012-05-16 23:34:33 +02:00
c-r3k.c Disintegrate asm/system.h for MIPS 2012-03-28 18:30:02 +01:00
c-r4k.c MIPS: Add support for the 1074K core. 2012-09-13 15:21:47 -05:00
c-tx39.c Disintegrate asm/system.h for MIPS 2012-03-28 18:30:02 +01:00
cache.c MIPS: Replace 'kernel_uses_smartmips_rixi' with 'cpu_has_rixi'. 2012-09-13 17:00:34 -05:00
cerr-sb1.c
cex-gen.S
cex-oct.S
cex-sb1.S Fix common misspellings 2011-03-31 11:26:23 -03:00
dma-default.c MIPS: adapt for dma_map_ops changes 2012-03-28 16:36:32 +02:00
extable.c
fault.c Merge branch 'akpm' (Andrew's patch-bomb) 2012-10-09 16:23:15 +09:00
gup.c MIPS: mm: Add compound tail page _mapcount when mapped 2012-08-27 16:10:21 +02:00
highmem.c highmem: kill all __kmap_atomic() 2012-03-20 21:48:30 +08:00
hugetlbpage.c
init.c MIPS: Align swapper_pg_dir to 64K for better TLB Refill code. 2012-10-11 11:02:40 +02:00
ioremap.c
Makefile MIPS: introduce CPU_R4K_CACHE_TLB 2012-08-22 23:46:38 +02:00
mmap.c MIPS: Trivial style cleanups in mmap.c 2011-09-17 02:37:04 +02:00
page-funcs.S MIPS: Refactor 'clear_page' and 'copy_page' functions. 2012-07-19 11:23:43 +02:00
page.c MIPS: Refactor 'clear_page' and 'copy_page' functions. 2012-07-19 11:23:43 +02:00
pgtable-32.c MIPS: Limit fixrange_init() to the FIXMAP region 2011-07-25 17:26:54 +01:00
pgtable-64.c MIPS: Optimize pgd_init and pmd_init 2012-10-11 11:04:35 +02:00
sc-ip22.c Disintegrate asm/system.h for MIPS 2012-03-28 18:30:02 +01:00
sc-mips.c Disintegrate asm/system.h for MIPS 2012-03-28 18:30:02 +01:00
sc-r5k.c Disintegrate asm/system.h for MIPS 2012-03-28 18:30:02 +01:00
sc-rm7k.c
tlb-r3k.c Disintegrate asm/system.h for MIPS 2012-03-28 18:30:02 +01:00
tlb-r4k.c MIPS: Avoid mcheck by flushing page range in huge_ptep_set_access_flags() 2012-12-04 16:57:54 +01:00
tlb-r8k.c Disintegrate asm/system.h for MIPS 2012-03-28 18:30:02 +01:00
tlbex-fault.S
tlbex.c MIPS: R5000: Fix TLB hazard handling. 2012-10-16 22:22:23 +02:00
uasm.c MIPS: uasm: Add INS and EXT instructions. 2012-09-13 15:43:53 -05:00