s390/cio: silence lockdep warning
authorSebastian Ott <sebott@linux.vnet.ibm.com>
Tue, 3 Jun 2014 13:03:09 +0000 (15:03 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Tue, 10 Jun 2014 08:48:28 +0000 (10:48 +0200)
commitdbe33fc9ad0cd965afe71cd6fca9539afd704e38
tree6cb08c65ffcf5a10779719b4f6e8c4b7490b0c82
parentf8b13505607823bb9a212eb9410669ecf2bc2615
s390/cio: silence lockdep warning

On systems where a ccw based console device is used a lockdep false alarm
could be triggered when a device driver calls printk while holding a
subchannels lock (e.g. in it's irq handler). Since this is valid behavior
fix this by introducing a separate lock class for the console subchannels
lock.

The lockdep warning was revealed by "printk: enable interrupts before calling
console_trylock_for_printk()" which changed console_unlock() to be called with
lockdep enabled.

[ INFO: possible recursive locking detected ]
3.15.0-rc5-next-20140520 #1 Not tainted
---------------------------------------------
ccwgroup/2239 is trying to acquire lock:
(&(sch->lock)->rlock){-.-...}, at: [<0000000000642a52>] raw3215_write+0x52/0x200

but task is already holding lock:
(&(sch->lock)->rlock){-.-...}, at: [<00000000005fd160>] do_cio_interrupt+0x60/0x108

other info that might help us debug this:
Possible unsafe locking scenario:

CPU0
----
lock(&(sch->lock)->rlock);
lock(&(sch->lock)->rlock);

*** DEADLOCK ***

May be due to missing lock nesting notation

8 locks held by ccwgroup/2239:

stack backtrace:
CPU: 3 PID: 2239 Comm: ccwgroup Not tainted 3.15.0-rc5-next-20140520 #1
0000000036fab518 0000000036fab528 0000000000000002 0000000000000000
0000000036fab5b8 0000000036fab530 0000000036fab530 00000000001116e8
0000000000000000 0000000000986ec4 00000000009701b6 000000000000000b
0000000036fab578 0000000036fab518 0000000000000000 0000000000000000
0000000000000000 00000000001116e8 0000000036fab518 0000000036fab578
Call Trace:
([<0000000000111626>] show_trace+0x14e/0x158)
[<000000000011169a>] show_stack+0x6a/0xe8
[<00000000007c6e72>] dump_stack+0x82/0xb0
[<00000000001a95f2>] validate_chain.isra.37+0xa4a/0xbb0
[<00000000001acaca>] __lock_acquire+0x4da/0xcd0
[<00000000001ada1a>] lock_acquire+0xba/0x218
[<00000000007cd634>] _raw_spin_lock_irqsave+0x6c/0xb8
[<0000000000642a52>] raw3215_write+0x52/0x200
[<0000000000643d16>] con3215_write+0x76/0xf8
[<00000000001bd87a>] call_console_drivers.constprop.25+0xfa/0x210
[<00000000001be0b0>] console_unlock+0x3e0/0x4e8
[<00000000001be450>] vprintk_emit+0x298/0x6e0
[<00000000005aa210>] dev_vprintk_emit+0xe0/0x1a8
[<00000000005aa320>] dev_printk_emit+0x48/0x50
[<00000000005aa390>] __dev_printk+0x68/0xb0
[<00000000005aa7c2>] _dev_info+0x62/0x70
[<0000000000657bf0>] qeth_l2_send_setmac_cb+0xd0/0x190
[<0000000000651a1e>] qeth_send_control_data_cb+0x3a6/0x6a8
[<0000000000655546>] qeth_irq+0x1a6/0xac0
[<000000000060a0ac>] ccw_device_call_handler+0xa4/0xc0
[<0000000000608b62>] ccw_device_irq+0x5a/0x190
[<00000000005fd1ca>] do_cio_interrupt+0xca/0x108
[<00000000001c0a2e>] handle_irq_event_percpu+0x5e/0x378
[<00000000001c46fc>] handle_percpu_irq+0x6c/0x98
[<00000000001c0066>] generic_handle_irq+0x46/0x68
[<000000000010b5b6>] do_IRQ+0x5e/0x88
[<00000000007cf304>] io_call+0x6/0x20
[<000000000064c63a>] qeth_send_control_data+0x322/0x570
([<000000000064c50e>] qeth_send_control_data+0x1f6/0x570)
[<0000000000651db2>] qeth_send_ipa_cmd+0x92/0x120
[<000000000065b310>] __qeth_l2_set_online+0x170/0xaa8
[<000000000060ebb6>] ccwgroup_set_online+0x56/0x90
[<000000000060ef96>] ccwgroup_online_store+0xd6/0xe0
[<000000000033d11a>] kernfs_fop_write+0x10a/0x188
[<00000000002bbd00>] vfs_write+0x98/0x1c0
[<00000000002bc8a0>] SyS_write+0x60/0xd0
[<00000000007cee3a>] sysc_nr_ok+0x22/0x28
[<000003fffd0c3f28>] 0x3fffd0c3f28

Reported-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
drivers/s390/cio/cio.c