linux/arch/arm64/mm
David Hildenbrand 70ffdb9393 mm/fault, arch: Use pagefault_disable() to check for disabled pagefaults in the handler
Introduce faulthandler_disabled() and use it to check for irq context and
disabled pagefaults (via pagefault_disable()) in the pagefault handlers.

Please note that we keep the in_atomic() checks in place - to detect
whether in irq context (in which case preemption is always properly
disabled).

In contrast, preempt_disable() should never be used to disable pagefaults.
With !CONFIG_PREEMPT_COUNT, preempt_disable() doesn't modify the preempt
counter, and therefore the result of in_atomic() differs.
We validate that condition by using might_fault() checks when calling
might_sleep().

Therefore, add a comment to faulthandler_disabled(), describing why this
is needed.

faulthandler_disabled() and pagefault_disable() are defined in
linux/uaccess.h, so let's properly add that include to all relevant files.

This patch is based on a patch from Thomas Gleixner.

Reviewed-and-tested-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: David.Laight@ACULAB.COM
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: airlied@linux.ie
Cc: akpm@linux-foundation.org
Cc: benh@kernel.crashing.org
Cc: bigeasy@linutronix.de
Cc: borntraeger@de.ibm.com
Cc: daniel.vetter@intel.com
Cc: heiko.carstens@de.ibm.com
Cc: herbert@gondor.apana.org.au
Cc: hocko@suse.cz
Cc: hughd@google.com
Cc: mst@redhat.com
Cc: paulus@samba.org
Cc: ralf@linux-mips.org
Cc: schwidefsky@de.ibm.com
Cc: yang.shi@windriver.com
Link: http://lkml.kernel.org/r/1431359540-32227-7-git-send-email-dahi@linux.vnet.ibm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2015-05-19 08:39:15 +02:00
..
cache.S arm64: compat: align cacheflush syscall with arch/arm 2014-12-01 13:31:12 +00:00
context.c arm64: Process management 2012-09-17 13:41:58 +01:00
copypage.c arm64: export __cpu_{clear,copy}_user_page functions 2014-07-08 17:30:51 +01:00
dma-mapping.c arm64: add missing PAGE_ALIGN() to __dma_free() 2015-04-29 17:39:39 +01:00
dump.c arm64: mm: Fix build error with CONFIG_SPARSEMEM_VMEMMAP disabled 2015-05-05 12:22:17 +01:00
extable.c arm64: MMU fault handling and page table management 2012-09-17 13:41:57 +01:00
fault.c mm/fault, arch: Use pagefault_disable() to check for disabled pagefaults in the handler 2015-05-19 08:39:15 +02:00
flush.c arm64: mm: enable RCU fast_gup 2014-10-09 22:26:01 -04:00
hugetlbpage.c mm/hugetlb: reduce arch dependent code around follow_huge_* 2015-02-11 17:06:01 -08:00
init.c arm64: add support for memtest 2015-04-14 16:49:06 -07:00
ioremap.c arm64: add ioremap physical address information 2015-01-23 15:29:06 +00:00
Makefile arm64: add support to dump the kernel page tables 2014-11-26 17:19:18 +00:00
mm.h arm64: add better page protections to arm64 2015-01-22 14:54:29 +00:00
mmap.c mm: expose arch_mmap_rnd when available 2015-04-14 16:49:05 -07:00
mmu.c arm64 updates for 4.1: 2015-04-16 13:58:29 -05:00
pageattr.c arm64: mm: unexport set_memory_ro and set_memory_rw 2015-03-19 10:43:56 +00:00
pgd.c arm64: pgalloc: consistently use PGALLOC_GFP 2014-11-20 12:05:18 +00:00
proc-macros.S arm64: mm: increase VA range of identity map 2015-03-23 11:35:29 +00:00
proc.S arm64: mm: increase VA range of identity map 2015-03-23 11:35:29 +00:00