linux/drivers/s390/net
Thomas Richter 1aec42bcc0 390/qeth: Fix locking warning during qeth device setup
Do not wait for channel command buffers in IPA commands.
The potential wait could be done while holding a spin lock and causes
in recent kernels such a bug if kernel lock debugging is enabled:

kernel: BUG: sleeping function called from invalid context at drivers/s390/net/qeth_core_main.c:
794
kernel: in_atomic(): 1, irqs_disabled(): 0, pid: 2031, name: NetworkManager
kernel: 2 locks held by NetworkManager/2031:
kernel:  #0:  (rtnl_mutex){+.+.+.}, at: [<00000000006e0d7a>] rtnetlink_rcv+0x32/0x50
kernel:  #1:  (_xmit_ETHER){+.....}, at: [<00000000006cfe90>] dev_set_rx_mode+0x30/0x50
kernel: CPU: 0 PID: 2031 Comm: NetworkManager Not tainted 3.18.0-rc5-next-20141124 #1
kernel:        00000000275fb1f0 00000000275fb280 0000000000000002 0000000000000000
               00000000275fb320 00000000275fb298 00000000275fb298 00000000007e326a
               0000000000000000 000000000099ce2c 00000000009b4988 000000000000000b
               00000000275fb2e0 00000000275fb280 0000000000000000 0000000000000000
               0000000000000000 00000000001129c8 00000000275fb280 00000000275fb2e0
kernel: Call Trace:
kernel: ([<00000000001128b0>] show_trace+0xf8/0x158)
kernel:  [<000000000011297a>] show_stack+0x6a/0xe8
kernel:  [<00000000007e995a>] dump_stack+0x82/0xb0
kernel:  [<000000000017d668>] ___might_sleep+0x170/0x228
kernel:  [<000003ff80026f0e>] qeth_wait_for_buffer+0x36/0xd0 [qeth]
kernel:  [<000003ff80026fe2>] qeth_get_ipacmd_buffer+0x3a/0xc0 [qeth]
kernel:  [<000003ff80105078>] qeth_l3_send_setdelmc+0x58/0xf8 [qeth_l3]
kernel:  [<000003ff8010b1fe>] qeth_l3_set_ip_addr_list+0x2c6/0x848 [qeth_l3]
kernel:  [<000003ff8010bbb4>] qeth_l3_set_multicast_list+0x434/0xc48 [qeth_l3]
kernel:  [<00000000006cfe9a>] dev_set_rx_mode+0x3a/0x50
kernel:  [<00000000006cff90>] __dev_open+0xe0/0x140
kernel:  [<00000000006d02a0>] __dev_change_flags+0xa0/0x178
kernel:  [<00000000006d03a8>] dev_change_flags+0x30/0x70
kernel:  [<00000000006e14ee>] do_setlink+0x346/0x9a0
...

The device driver has plenty of command buffers available
per channel for channel command communication.
In the extremely rare case when there is no command buffer
available, return a NULL pointer and issue a warning
in the kernel log. The caller handles the case when
a NULL pointer is encountered and returns an error.

In the case the wait for command buffer is possible
(because no lock is held as in the OSN case), still wait
until a channel command buffer is available.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
Reviewed-by: Eugene Crosser <Eugene.Crosser@ru.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-01-25 23:38:16 -08:00
..
Kconfig qeth: s390 ethernet device driver dependency 2014-10-26 22:21:39 -04:00
Makefile qeth: bridgeport support - basic control 2014-01-15 14:48:01 -08:00
claw.c sched, cleanup, treewide: Remove set_current_state(TASK_RUNNING) after schedule() 2014-09-19 12:35:17 +02:00
claw.h s390/s390dbf: use debug_level_enabled() where applicable 2013-10-24 17:16:54 +02:00
ctcm_dbug.c s390/s390dbf: use debug_level_enabled() where applicable 2013-10-24 17:16:54 +02:00
ctcm_dbug.h s390/comments: unify copyright messages and remove file names 2012-07-20 11:15:04 +02:00
ctcm_fsms.c drivers/s390/net: removes unnecessary semicolon 2012-09-24 15:45:17 -04:00
ctcm_fsms.h s390/comments: unify copyright messages and remove file names 2012-07-20 11:15:04 +02:00
ctcm_main.c net: set name_assign_type in alloc_netdev() 2014-07-15 16:12:48 -07:00
ctcm_main.h s390/comments: unify copyright messages and remove file names 2012-07-20 11:15:04 +02:00
ctcm_mpc.c ctcm: remove BUG_ONs 2012-11-19 14:19:00 -05:00
ctcm_mpc.h s390/comments: unify copyright messages and remove file names 2012-07-20 11:15:04 +02:00
ctcm_sysfs.c ctcm: replace sscanf by kstrto function 2014-10-26 22:21:40 -04:00
fsm.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
fsm.h atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
lcs.c lcs: replace sscanf by kstrto function 2014-10-26 22:21:39 -04:00
lcs.h s390/s390dbf: use debug_level_enabled() where applicable 2013-10-24 17:16:54 +02:00
netiucv.c net: set name_assign_type in alloc_netdev() 2014-07-15 16:12:48 -07:00
qeth_core.h qeth: qeth_core_main make local functions static 2014-10-26 22:21:39 -04:00
qeth_core_main.c 390/qeth: Fix locking warning during qeth device setup 2015-01-25 23:38:16 -08:00
qeth_core_mpc.c qeth: bridgeport support - address notifications 2014-01-15 14:48:01 -08:00
qeth_core_mpc.h qeth: Display adjacent switch attributes 2014-07-21 20:21:40 -07:00
qeth_core_sys.c qeth: Display adjacent switch attributes 2014-07-21 20:21:40 -07:00
qeth_l2.h qeth: bridgeport support - basic control 2014-01-15 14:48:01 -08:00
qeth_l2_main.c 390/qeth: Fix locking warning during qeth device setup 2015-01-25 23:38:16 -08:00
qeth_l2_sys.c qeth: don't query for info if hardware not ready. 2014-09-02 13:54:06 -07:00
qeth_l3.h qeth: make local functions static in qeth_l3 module 2014-10-26 22:21:39 -04:00
qeth_l3_main.c 390/qeth: Fix locking warning during qeth device setup 2015-01-25 23:38:16 -08:00
qeth_l3_sys.c s390: replace strict_strtoul() with kstrtoul() 2013-08-22 12:20:00 +02:00
smsgiucv.c smsgiucv: reestablish IUCV path after resume 2012-10-16 14:41:46 -04:00
smsgiucv.h s390/comments: unify copyright messages and remove file names 2012-07-20 11:15:04 +02:00
smsgiucv_app.c Driver core: driver_find() drops reference before returning 2012-01-24 16:00:34 -08:00