linux/arch/unicore32/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
..
alignment.c arch/unicore32/mm/alignment.c: include "asm/pgtable.h" to avoid compiling error 2014-06-20 08:22:38 +08:00
cache-ucv2.S unicore32 core architecture: mm related: consistent device DMA handling 2011-03-17 09:19:09 +08:00
dma-swiotlb.c Unicore32: adapt for dma_map_ops changes 2012-03-28 16:36:39 +02:00
extable.c unicore32 core architecture: mm related: fault handling 2011-03-17 09:19:09 +08: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 Disintegrate asm/system.h for Unicore32 [based on ver #3, changed by gxt] 2012-03-28 18:30:03 +01:00
init.c mm, show_mem: remove SHOW_MEM_FILTER_PAGE_COUNT 2014-01-21 16:19:44 -08:00
ioremap.c arch/unicore32/mm/ioremap.c: return NULL on invalid pfn 2014-06-04 16:53:53 -07:00
Kconfig unicore32 core architecture: mm related: generic codes 2011-03-17 09:19:08 +08:00
Makefile unicore32: replace unicore32-specific iomap functions with generic lib implementation 2011-03-17 09:19:21 +08:00
mm.h Disintegrate asm/system.h for Unicore32 [based on ver #3, changed by gxt] 2012-03-28 18:30:03 +01:00
mmu.c reboot: unicore32: prepare reboot_mode for moving to generic kernel code 2013-07-09 10:33:29 -07:00
pgd.c mm: fix false-positive warning on exit due mm_nr_pmds(mm) 2015-02-11 17:06:04 -08:00
proc-macros.S unicore32 core architecture: processor and system headers 2011-03-17 09:19:06 +08:00
proc-syms.c arch: unicore32: ksyms: export '__cpuc_coherent_kern_range' to avoid compiling failure 2014-06-20 08:22:41 +08:00
proc-ucv2.S unicore32 core architecture: processor and system headers 2011-03-17 09:19:06 +08:00
tlb-ucv2.S unicore32 core architecture: mm related: consistent device DMA handling 2011-03-17 09:19:09 +08:00