linux/arch/cris/include/asm
Rabin Vincent 7f0144e777 CRIS: fix switch_mm() lockdep splat
With lockdep support implemented on CRISv32, we get the following splat.
switch_mm() can be called both from the scheduler() (with interrupts
disabled) and from flush_old_exec (via activate_mm()), with interrupts
enabled.  Fix it by disabling interrupts in activate_mm(), similar to
powerpc and hexagon.

 t======================================================
 [ INFO: HARDIRQ-safe -> HARDIRQ-unsafe lock order detected ]
 3.19.0-08802-g20bc9f1-dirty #323 Not tainted
 ------------------------------------------------------
 init/1 [HC0[0]:SC0[0]:HE0:SE1] is trying to acquire:
  (mmu_context_lock){+.+...}, at: [<c0009290>] switch_mm+0x22/0xc6

 and this task is already holding:
  (&rq->lock){-.-.-.}, at: [<c01a0756>] __schedule+0x5e/0x648
 which would create a new lock dependency:
  (&rq->lock){-.-.-.} -> (mmu_context_lock){+.+...}

 but this new dependency connects a HARDIRQ-irq-safe lock:
  (&rq->lock){-.-.-.}
 ... which became HARDIRQ-irq-safe at:
   [<c002b03c>] scheduler_tick+0x28/0x5e
   [<c0007c6c>] timer_interrupt+0x4e/0x6a
   [<c0043ac4>] handle_irq_event_percpu+0x54/0x13c
   [<c004343c>] generic_handle_irq+0x2a/0x36

 to a HARDIRQ-irq-unsafe lock:
  (mmu_context_lock){+.+...}
 ... which became HARDIRQ-irq-unsafe at:
 ...  [<c0039e60>] __lock_acquire+0x8f8/0x1d9c
   [<c0009290>] switch_mm+0x22/0xc6
   [<c009c260>] flush_old_exec+0x500/0x5d4
   [<c00da4c6>] load_elf_phdrs+0x7a/0x84
   [<c00dbdb0>] load_elf_binary+0x21c/0x13b4
   [<c009cdb6>] do_execve+0x22/0x2c
   [<c001dcf2>] ____call_usermodehelper+0x0/0x154
   [<c000581e>] ret_from_kernel_thread+0xe/0x14

 other info that might help us debug this:

  Possible interrupt unsafe locking scenario:

        CPU0                    CPU1
        ----                    ----
   lock(mmu_context_lock);
                                local_irq_disable();
                                lock(&rq->lock);
                                lock(mmu_context_lock);
   <Interrupt>
     lock(&rq->lock);

  *** DEADLOCK ***

 1 lock held by init/1:
  #0:  (&rq->lock){-.-.-.}, at: [<c01a0756>] __schedule+0x5e/0x648

 Call Trace:
 [<c019fe9e>] printk+0x0/0x4e
 [<c00368f8>] print_shortest_lock_dependencies+0x0/0x15c
 [<c0048628>] print_stack_trace+0x0/0x88
 [<c0038912>] __lock_is_held+0x3e/0x5e
 [<c003b894>] lock_acquire+0x8a/0xcc
 [<c01a50c4>] _raw_spin_lock+0x44/0x7a
 [<c0009290>] switch_mm+0x22/0xc6
 [<c01a06f8>] __schedule+0x0/0x648
 [<c01a0d76>] schedule+0x36/0x7c
 [<c0037d04>] trace_hardirqs_on+0x0/0x1e
 [<c0004e18>] do_work_pending+0x30/0xd4
 [<c000591a>] _work_pending+0xe/0x12

Signed-off-by: Rabin Vincent <rabin@rab.in>
Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>
2015-09-05 00:56:50 +02:00
..
asm-offsets.h kbuild: move asm-offsets.h to include/generated 2009-12-12 13:08:14 +01:00
axisflashmap.h
bitops.h CRIS: use generic atomic bitops 2015-03-25 10:55:35 +01:00
bug.h
bugs.h
cache.h
cacheflush.h block: add helpers to run flush_dcache_page() against a bio and a request's pages 2009-11-26 09:16:19 +01:00
checksum.h
current.h
delay.h
dma-mapping.h remove <asm/scatterlist.h> 2015-05-05 13:35:39 -06:00
dma.h
eshlibld.h
etraxi2c.h
fasttimer.h
fb.h
ftrace.h tracing: make CALLER_ADDRx overwriteable 2009-03-02 16:49:37 -05:00
hw_irq.h
io.h cris: io: implement dummy relaxed accessor macros for writes 2014-10-20 18:49:17 +01:00
irq.h
irqflags.h Fix IRQ flag handling naming 2010-10-07 14:08:55 +01:00
Kbuild CRIS: UAPI: use generic types.h 2015-09-05 00:56:48 +02:00
mmu_context.h CRIS: fix switch_mm() lockdep splat 2015-09-05 00:56:50 +02:00
mmu.h
mutex.h
page.h mm/CRIS: clean up unused VALID_PAGE() 2013-07-03 16:07:39 -07:00
pci.h remove <asm/scatterlist.h> 2015-05-05 13:35:39 -06:00
pgalloc.h cris: handle pgtable_page_ctor() fail 2013-11-15 09:32:17 +09:00
pgtable.h mm: make FIRST_USER_ADDRESS unsigned long on all archs 2015-02-11 17:06:03 -08:00
processor.h arch, locking: Ciao arch_mutex_cpu_relax() 2014-07-17 12:32:47 +02:00
ptrace.h Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal 2012-12-20 18:05:28 -08:00
segment.h
serial.h cris: add arch/cris/include/asm/serial.h 2011-08-25 16:25:35 -07:00
shmparam.h
signal.h cris: switch to generic old sigaction() 2013-02-03 18:15:53 -05:00
stacktrace.h CRIS: add STACKTRACE_SUPPORT 2015-09-05 00:56:50 +02:00
string.h CRISv32: Add arch optimized strcmp. 2009-06-10 15:21:03 +02:00
swab.h UAPI: (Scripted) Disintegrate arch/cris/include/asm 2012-10-09 09:46:45 +01:00
switch_to.h Disintegrate asm/system.h for CRIS 2012-03-28 18:30:02 +01:00
termios.h UAPI: (Scripted) Disintegrate arch/cris/include/asm 2012-10-09 09:46:45 +01:00
thread_info.h arch: Remove exec_domain from remaining archs 2015-04-12 21:03:30 +02:00
timex.h
tlb.h
tlbflush.h CRIS: remove SMP code 2015-03-25 10:55:10 +01:00
uaccess.h CRIS: Whitespace cleanup 2015-02-14 18:54:12 +01:00
ucontext.h
unaligned.h
unistd.h CRIS: Wire up missing syscalls 2015-09-05 00:33:25 +02:00
user.h