lwfinger / rtl8723bu

Driver for RTL8723BU
284 stars 144 forks source link

Can't unplug the wireless adaptor #34

Closed weiqi-chen closed 7 years ago

weiqi-chen commented 8 years ago

Hello,

Thank you for developing and maintaining the driver of the USB wireless adaptor.

I tried my wireless adaptor with raspberry pi 2b (Ubuntu 16.10 armhf installed) And of course, I can use it as AP and connect other wireless network.

But I found it's strange after I un-pluged it. I can still see the interface from ifconfig.

And I tried my wireless adaptor with my PC (Ubuntu 16.04 amd64 installed) And I can reproduce this problem too.

I use the newest code to compile the driver module,

And here is my other information:

Raspberry pi:

$ uname -a
Linux RaspberryPi-2 4.6.1-v7+ #6 SMP Sat Aug 27 16:57:43 CST 2016 armv7l armv7l armv7l GNU/Linux
$lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu Yakkety Yak (development branch)
Release:    16.10
Codename:   yakkety

PC:

$ uname -a
Linux B85i-Ubuntu 4.4.0-34-generic #53-Ubuntu SMP Wed Jul 27 16:06:39 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.1 LTS
Release:    16.04
Codename:   xenial

On my Raspberry pi

Here is part of dmesg output:

[  848.043406] RTL871X: rtw_ndev_init(wlan0)
[  848.045656] usbcore: registered new interface driver rtl8723bu
[  848.045677] RTL871X: module init ret=0
[  848.079239] rtl8723bu 1-1.4:1.2 wlx40a5ef0ea956: renamed from wlan0
[  848.951553] RTL871X: RTW_ADAPTIVITY_EN_AUTO, chplan:0x20, Regulation:0,0
[  848.951589] RTL871X: RTW_ADAPTIVITY_MODE_NORMAL
[  849.538021] IPv6: ADDRCONF(NETDEV_UP): wlx40a5ef0ea956: link is not ready
[  851.532426] RTL871X: nolinked power save enter
[  854.776184] usb 1-1.4: USB disconnect, device number 5
[ 1080.610323] INFO: task kworker/0:1:36 blocked for more than 120 seconds.
[ 1080.617266]       Tainted: G           O    4.6.1-v7+ #6
[ 1080.622785] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[ 1080.630916] kworker/0:1     D 806d04cc     0    36      2 0x00000000
[ 1080.630966] Workqueue: usb_hub_wq hub_event
[ 1080.631007] [<806d04cc>] (__schedule) from [<806d0a4c>] (schedule+0x50/0xa8)
[ 1080.631214] [<806d0a4c>] (schedule) from [<7f1bcb74>] (wiphy_unregister+0x1e4/0x31c [cfg80211])
[ 1080.631641] [<7f1bcb74>] (wiphy_unregister [cfg80211]) from [<7f2d751c>] (rtw_wdev_unregister+0x54/0x58 [8723bu])
[ 1080.631975] [<7f2d751c>] (rtw_wdev_unregister [8723bu]) from [<7f2c3f70>] (rtw_unregister_netdevs+0x48/0x74 [8723bu])
[ 1080.632294] [<7f2c3f70>] (rtw_unregister_netdevs [8723bu]) from [<7f2c5524>] (rtw_dev_remove+0x2c/0x84 [8723bu])
[ 1080.632468] [<7f2c5524>] (rtw_dev_remove [8723bu]) from [<8052ddb4>] (usb_unbind_interface+0x8c/0x298)
[ 1080.632498] [<8052ddb4>] (usb_unbind_interface) from [<804bb828>] (__device_release_driver+0x98/0x12c)
[ 1080.632525] [<804bb828>] (__device_release_driver) from [<804bb8e8>] (device_release_driver+0x2c/0x38)
[ 1080.632551] [<804bb8e8>] (device_release_driver) from [<804bafd8>] (bus_remove_device+0xe8/0x114)
[ 1080.632575] [<804bafd8>] (bus_remove_device) from [<804b7c34>] (device_del+0x11c/0x220)
[ 1080.632598] [<804b7c34>] (device_del) from [<8052b3d8>] (usb_disable_device+0xb0/0x1f4)
[ 1080.632623] [<8052b3d8>] (usb_disable_device) from [<80522634>] (usb_disconnect+0x84/0x238)
[ 1080.632650] [<80522634>] (usb_disconnect) from [<80524164>] (hub_event+0x60c/0x10d0)
[ 1080.632679] [<80524164>] (hub_event) from [<80135fbc>] (process_one_work+0x170/0x508)
[ 1080.632707] [<80135fbc>] (process_one_work) from [<801363b4>] (worker_thread+0x60/0x5c8)
[ 1080.632732] [<801363b4>] (worker_thread) from [<8013c3f8>] (kthread+0xec/0x104)
[ 1080.632758] [<8013c3f8>] (kthread) from [<80107f68>] (ret_from_fork+0x14/0x2c)
[ 1200.630311] INFO: task kworker/0:1:36 blocked for more than 120 seconds.
[ 1200.637232]       Tainted: G           O    4.6.1-v7+ #6
[ 1200.642753] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[ 1200.650857] kworker/0:1     D 806d04cc     0    36      2 0x00000000
[ 1200.650906] Workqueue: usb_hub_wq hub_event
[ 1200.650950] [<806d04cc>] (__schedule) from [<806d0a4c>] (schedule+0x50/0xa8)
[ 1200.651137] [<806d0a4c>] (schedule) from [<7f1bcb74>] (wiphy_unregister+0x1e4/0x31c [cfg80211])
[ 1200.651542] [<7f1bcb74>] (wiphy_unregister [cfg80211]) from [<7f2d751c>] (rtw_wdev_unregister+0x54/0x58 [8723bu])
[ 1200.651868] [<7f2d751c>] (rtw_wdev_unregister [8723bu]) from [<7f2c3f70>] (rtw_unregister_netdevs+0x48/0x74 [8723bu])
[ 1200.652186] [<7f2c3f70>] (rtw_unregister_netdevs [8723bu]) from [<7f2c5524>] (rtw_dev_remove+0x2c/0x84 [8723bu])
[ 1200.652360] [<7f2c5524>] (rtw_dev_remove [8723bu]) from [<8052ddb4>] (usb_unbind_interface+0x8c/0x298)
[ 1200.652390] [<8052ddb4>] (usb_unbind_interface) from [<804bb828>] (__device_release_driver+0x98/0x12c)
[ 1200.652418] [<804bb828>] (__device_release_driver) from [<804bb8e8>] (device_release_driver+0x2c/0x38)
[ 1200.652443] [<804bb8e8>] (device_release_driver) from [<804bafd8>] (bus_remove_device+0xe8/0x114)
[ 1200.652467] [<804bafd8>] (bus_remove_device) from [<804b7c34>] (device_del+0x11c/0x220)
[ 1200.652490] [<804b7c34>] (device_del) from [<8052b3d8>] (usb_disable_device+0xb0/0x1f4)
[ 1200.652515] [<8052b3d8>] (usb_disable_device) from [<80522634>] (usb_disconnect+0x84/0x238)
[ 1200.652543] [<80522634>] (usb_disconnect) from [<80524164>] (hub_event+0x60c/0x10d0)
[ 1200.652571] [<80524164>] (hub_event) from [<80135fbc>] (process_one_work+0x170/0x508)
[ 1200.652603] [<80135fbc>] (process_one_work) from [<801363b4>] (worker_thread+0x60/0x5c8)
[ 1200.652628] [<801363b4>] (worker_thread) from [<8013c3f8>] (kthread+0xec/0x104)
[ 1200.652653] [<8013c3f8>] (kthread) from [<80107f68>] (ret_from_fork+0x14/0x2c)

Here is my PC

dmesg output:

[10055.252990] usb 3-2: new high-speed USB device number 5 using xhci_hcd
[10055.381542] usb 3-2: New USB device found, idVendor=0bda, idProduct=b720
[10055.381543] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[10055.381545] usb 3-2: Product: 802.11n WLAN Adapter
[10055.381546] usb 3-2: Manufacturer: Realtek
[10055.381546] usb 3-2: SerialNumber: 00e04c000001
[10055.384307] Bluetooth: hci1: rtl: examining hci_ver=06 hci_rev=000b lmp_ver=06 lmp_subver=8723
[10055.384309] Bluetooth: hci1: rtl: loading rtl_bt/rtl8723b_fw.bin
[10055.405310] Bluetooth: hci1: rom_version status=0 version=1
[10121.730759] usb 3-2: USB disconnect, device number 5
[10186.315341] usb 3-2: new high-speed USB device number 6 using xhci_hcd
[10186.443902] usb 3-2: New USB device found, idVendor=0bda, idProduct=b720
[10186.443904] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[10186.443905] usb 3-2: Product: 802.11n WLAN Adapter
[10186.443905] usb 3-2: Manufacturer: Realtek
[10186.443906] usb 3-2: SerialNumber: 00e04c000001
[10186.445565] Bluetooth: hci1: rtl: examining hci_ver=06 hci_rev=000b lmp_ver=06 lmp_subver=8723
[10186.445567] Bluetooth: hci1: rtl: loading rtl_bt/rtl8723b_fw.bin
[10186.446550] Bluetooth: hci1: rom_version status=0 version=1
[10186.466834] RTL871X: module init start
[10186.466836] RTL871X: rtl8723bu v4.3.6.11_12942.20141204_BTCOEX20140507-4E40
[10186.466836] RTL871X: rtl8723bu BT-Coex version = BTCOEX20140507-4E40
[10186.514998] RTL871X: rtw_ndev_init(wlan0)
[10186.515220] usbcore: registered new interface driver rtl8723bu
[10186.515222] RTL871X: module init ret=0
[10186.530003] rtl8723bu 3-2:1.2 wlx40a5ef0ea956: renamed from wlan0
[10186.558590] IPv6: ADDRCONF(NETDEV_UP): wlx40a5ef0ea956: link is not ready
[10187.177361] RTL871X: RTW_ADAPTIVITY_EN_AUTO, chplan:0x20, Regulation:0,0
[10187.177363] RTL871X: RTW_ADAPTIVITY_MODE_NORMAL
[10188.024267] IPv6: ADDRCONF(NETDEV_UP): wlx40a5ef0ea956: link is not ready
[10188.057265] IPv6: ADDRCONF(NETDEV_UP): wlx40a5ef0ea956: link is not ready
[10190.764671] RTL871X: nolinked power save enter
[10192.329645] RTL871X: RTW_ADAPTIVITY_EN_AUTO, chplan:0x20, Regulation:0,0
[10192.329650] RTL871X: RTW_ADAPTIVITY_MODE_NORMAL
[10192.920649] RTL871X: nolinked power save leave
[10194.740650] RTL871X: nolinked power save enter
[10215.331593] RTL871X: RTW_ADAPTIVITY_EN_AUTO, chplan:0x20, Regulation:0,0
[10215.331597] RTL871X: RTW_ADAPTIVITY_MODE_NORMAL
[10215.902435] RTL871X: nolinked power save leave
[10217.722281] RTL871X: nolinked power save enter
[10227.888129] usb 3-2: USB disconnect, device number 6
[10247.767524] RTL871X: nolinked power save leave
[10290.774405] RTL871X: nolinked power save leave
[10343.775589] RTL871X: nolinked power save leave
[10406.777445] RTL871X: nolinked power save leave
[10440.858406] INFO: task kworker/4:0:29 blocked for more than 120 seconds.
[10440.858409]       Tainted: G           OE   4.4.0-34-generic #53-Ubuntu
[10440.858410] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[10440.858411] kworker/4:0     D ffff88021481fa48     0    29      2 0x00000000
[10440.858417] Workqueue: usb_hub_wq hub_event
[10440.858418]  ffff88021481fa48 0000000182000185 ffff8801f3838dc0 ffff880214f86e00
[10440.858419]  ffff880214820000 ffff8800ce8a2800 0000000000000001 ffff8800ce8a2890
[10440.858420]  ffff8801c6710000 ffff88021481fa60 ffffffff81829e15 ffff8800ce8a2ac0
[10440.858421] Call Trace:
[10440.858426]  [<ffffffff81829e15>] schedule+0x35/0x80
[10440.858446]  [<ffffffffc0496cd9>] wiphy_unregister+0x259/0x360 [cfg80211]
[10440.858448]  [<ffffffff810c3ca0>] ? wake_atomic_t_function+0x60/0x60
[10440.858464]  [<ffffffffc091a235>] rtw_wdev_unregister+0x4b/0x51 [8723bu]
[10440.858473]  [<ffffffffc09066ea>] rtw_unregister_netdevs+0x47/0x7a [8723bu]
[10440.858483]  [<ffffffffc0907b24>] rtw_dev_remove+0x25/0x77 [8723bu]
[10440.858484]  [<ffffffff8161d146>] usb_unbind_interface+0x86/0x280
[10440.858486]  [<ffffffff81553a11>] __device_release_driver+0xa1/0x150
[10440.858487]  [<ffffffff81553ae3>] device_release_driver+0x23/0x30
[10440.858488]  [<ffffffff81553131>] bus_remove_device+0x101/0x170
[10440.858489]  [<ffffffff8154f289>] device_del+0x139/0x260
[10440.858491]  [<ffffffff81621a6f>] ? usb_remove_ep_devs+0x1f/0x30
[10440.858492]  [<ffffffff8161a909>] usb_disable_device+0x89/0x270
[10440.858493]  [<ffffffff81610242>] usb_disconnect+0x92/0x280
[10440.858494]  [<ffffffff81611e12>] hub_port_connect+0x82/0x9c0
[10440.858496]  [<ffffffff81612e21>] hub_event+0x6d1/0xb10
[10440.858497]  [<ffffffff810b9415>] ? put_prev_entity+0x35/0x7d0
[10440.858499]  [<ffffffff8109a2c5>] process_one_work+0x165/0x480
[10440.858500]  [<ffffffff8109a62b>] worker_thread+0x4b/0x4c0
[10440.858501]  [<ffffffff8109a5e0>] ? process_one_work+0x480/0x480
[10440.858502]  [<ffffffff810a0808>] kthread+0xd8/0xf0
[10440.858503]  [<ffffffff810a0730>] ? kthread_create_on_node+0x1e0/0x1e0
[10440.858504]  [<ffffffff8182e28f>] ret_from_fork+0x3f/0x70
[10440.858505]  [<ffffffff810a0730>] ? kthread_create_on_node+0x1e0/0x1e0
[10440.858548] INFO: task colord-sane:8779 blocked for more than 120 seconds.
[10440.858549]       Tainted: G           OE   4.4.0-34-generic #53-Ubuntu
[10440.858550] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[10440.858550] colord-sane     D ffff8801f1d33d78     0  8779   3116 0x00000000
[10440.858552]  ffff8801f1d33d78 ffff8800abe8b700 ffff8802152b6040 ffff8800abe8b700
[10440.858553]  ffff8801f1d34000 ffff8800d63050fc ffff8800abe8b700 00000000ffffffff
[10440.858554]  ffff8800d6305100 ffff8801f1d33d90 ffffffff81829e15 ffff8800d63050f8
[10440.858555] Call Trace:
[10440.858557]  [<ffffffff81829e15>] schedule+0x35/0x80
[10440.858558]  [<ffffffff8182a0be>] schedule_preempt_disabled+0xe/0x10
[10440.858559]  [<ffffffff8182bcf9>] __mutex_lock_slowpath+0xb9/0x130
[10440.858560]  [<ffffffff8182bd8f>] mutex_lock+0x1f/0x30
[10440.858561]  [<ffffffff81620f07>] read_descriptors+0x37/0x100
[10440.858564]  [<ffffffff8128cfda>] sysfs_kf_bin_read+0x4a/0x70
[10440.858565]  [<ffffffff8128c54b>] kernfs_fop_read+0xab/0x160
[10440.858568]  [<ffffffff8120cc48>] __vfs_read+0x18/0x40
[10440.858569]  [<ffffffff8120d216>] vfs_read+0x86/0x130
[10440.858570]  [<ffffffff8120df65>] SyS_read+0x55/0xc0
[10440.858571]  [<ffffffff8182def2>] entry_SYSCALL_64_fastpath+0x16/0x71
[10469.786138] RTL871X: nolinked power save leave
[10532.786640] RTL871X: nolinked power save leave
[10560.867058] INFO: task kworker/4:0:29 blocked for more than 120 seconds.
[10560.867060]       Tainted: G           OE   4.4.0-34-generic #53-Ubuntu
[10560.867061] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[10560.867062] kworker/4:0     D ffff88021481fa48     0    29      2 0x00000000
[10560.867068] Workqueue: usb_hub_wq hub_event
[10560.867069]  ffff88021481fa48 0000000182000185 ffff8801f3838dc0 ffff880214f86e00
[10560.867070]  ffff880214820000 ffff8800ce8a2800 0000000000000001 ffff8800ce8a2890
[10560.867071]  ffff8801c6710000 ffff88021481fa60 ffffffff81829e15 ffff8800ce8a2ac0
[10560.867072] Call Trace:
[10560.867076]  [<ffffffff81829e15>] schedule+0x35/0x80
[10560.867096]  [<ffffffffc0496cd9>] wiphy_unregister+0x259/0x360 [cfg80211]
[10560.867098]  [<ffffffff810c3ca0>] ? wake_atomic_t_function+0x60/0x60
[10560.867112]  [<ffffffffc091a235>] rtw_wdev_unregister+0x4b/0x51 [8723bu]
[10560.867121]  [<ffffffffc09066ea>] rtw_unregister_netdevs+0x47/0x7a [8723bu]
[10560.867130]  [<ffffffffc0907b24>] rtw_dev_remove+0x25/0x77 [8723bu]
[10560.867131]  [<ffffffff8161d146>] usb_unbind_interface+0x86/0x280
[10560.867133]  [<ffffffff81553a11>] __device_release_driver+0xa1/0x150
[10560.867134]  [<ffffffff81553ae3>] device_release_driver+0x23/0x30
[10560.867135]  [<ffffffff81553131>] bus_remove_device+0x101/0x170
[10560.867137]  [<ffffffff8154f289>] device_del+0x139/0x260
[10560.867138]  [<ffffffff81621a6f>] ? usb_remove_ep_devs+0x1f/0x30
[10560.867140]  [<ffffffff8161a909>] usb_disable_device+0x89/0x270
[10560.867141]  [<ffffffff81610242>] usb_disconnect+0x92/0x280
[10560.867142]  [<ffffffff81611e12>] hub_port_connect+0x82/0x9c0
[10560.867143]  [<ffffffff81612e21>] hub_event+0x6d1/0xb10
[10560.867144]  [<ffffffff810b9415>] ? put_prev_entity+0x35/0x7d0
[10560.867146]  [<ffffffff8109a2c5>] process_one_work+0x165/0x480
[10560.867147]  [<ffffffff8109a62b>] worker_thread+0x4b/0x4c0
[10560.867148]  [<ffffffff8109a5e0>] ? process_one_work+0x480/0x480
[10560.867149]  [<ffffffff810a0808>] kthread+0xd8/0xf0
[10560.867150]  [<ffffffff810a0730>] ? kthread_create_on_node+0x1e0/0x1e0
[10560.867151]  [<ffffffff8182e28f>] ret_from_fork+0x3f/0x70
[10560.867152]  [<ffffffff810a0730>] ? kthread_create_on_node+0x1e0/0x1e0
[10560.867198] INFO: task colord-sane:8779 blocked for more than 120 seconds.
[10560.867199]       Tainted: G           OE   4.4.0-34-generic #53-Ubuntu
[10560.867200] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[10560.867200] colord-sane     D ffff8801f1d33d78     0  8779   3116 0x00000000
[10560.867201]  ffff8801f1d33d78 ffff8800abe8b700 ffff8802152b6040 ffff8800abe8b700
[10560.867202]  ffff8801f1d34000 ffff8800d63050fc ffff8800abe8b700 00000000ffffffff
[10560.867203]  ffff8800d6305100 ffff8801f1d33d90 ffffffff81829e15 ffff8800d63050f8
[10560.867204] Call Trace:
[10560.867206]  [<ffffffff81829e15>] schedule+0x35/0x80
[10560.867207]  [<ffffffff8182a0be>] schedule_preempt_disabled+0xe/0x10
[10560.867208]  [<ffffffff8182bcf9>] __mutex_lock_slowpath+0xb9/0x130
[10560.867209]  [<ffffffff8182bd8f>] mutex_lock+0x1f/0x30
[10560.867210]  [<ffffffff81620f07>] read_descriptors+0x37/0x100
[10560.867213]  [<ffffffff8128cfda>] sysfs_kf_bin_read+0x4a/0x70
[10560.867214]  [<ffffffff8128c54b>] kernfs_fop_read+0xab/0x160
[10560.867216]  [<ffffffff8120cc48>] __vfs_read+0x18/0x40
[10560.867217]  [<ffffffff8120d216>] vfs_read+0x86/0x130
[10560.867218]  [<ffffffff8120df65>] SyS_read+0x55/0xc0
[10560.867219]  [<ffffffff8182def2>] entry_SYSCALL_64_fastpath+0x16/0x71
[10560.867221] INFO: task lsusb:8802 blocked for more than 120 seconds.
[10560.867222]       Tainted: G           OE   4.4.0-34-generic #53-Ubuntu
[10560.867222] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[10560.867222] lsusb           D ffff880086ccbd78     0  8802   7166 0x00000004
[10560.867223]  ffff880086ccbd78 ffff8801b4cad280 ffff8802152b3700 ffff8801b4cad280
[10560.867224]  ffff880086ccc000 ffff8800d63050fc ffff8801b4cad280 00000000ffffffff
[10560.867225]  ffff8800d6305100 ffff880086ccbd90 ffffffff81829e15 ffff8800d63050f8
[10560.867226] Call Trace:
[10560.867228]  [<ffffffff81829e15>] schedule+0x35/0x80
[10560.867229]  [<ffffffff8182a0be>] schedule_preempt_disabled+0xe/0x10
[10560.867229]  [<ffffffff8182bcf9>] __mutex_lock_slowpath+0xb9/0x130
[10560.867230]  [<ffffffff8182bd8f>] mutex_lock+0x1f/0x30
[10560.867231]  [<ffffffff81620f07>] read_descriptors+0x37/0x100
[10560.867233]  [<ffffffff8128cfda>] sysfs_kf_bin_read+0x4a/0x70
[10560.867234]  [<ffffffff8128c54b>] kernfs_fop_read+0xab/0x160
[10560.867235]  [<ffffffff8120cc48>] __vfs_read+0x18/0x40
[10560.867236]  [<ffffffff8120d216>] vfs_read+0x86/0x130
[10560.867237]  [<ffffffff8120df65>] SyS_read+0x55/0xc0
[10560.867238]  [<ffffffff8182def2>] entry_SYSCALL_64_fastpath+0x16/0x71
[10595.793254] RTL871X: nolinked power save leave
[10658.797213] RTL871X: nolinked power save leave
[10680.875593] INFO: task kworker/4:0:29 blocked for more than 120 seconds.
[10680.875602]       Tainted: G           OE   4.4.0-34-generic #53-Ubuntu
[10680.875604] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[10680.875608] kworker/4:0     D ffff88021481fa48     0    29      2 0x00000000
[10680.875625] Workqueue: usb_hub_wq hub_event
[10680.875629]  ffff88021481fa48 0000000182000185 ffff8801f3838dc0 ffff880214f86e00
[10680.875634]  ffff880214820000 ffff8800ce8a2800 0000000000000001 ffff8800ce8a2890
[10680.875639]  ffff8801c6710000 ffff88021481fa60 ffffffff81829e15 ffff8800ce8a2ac0
[10680.875644] Call Trace:
[10680.875658]  [<ffffffff81829e15>] schedule+0x35/0x80
[10680.875703]  [<ffffffffc0496cd9>] wiphy_unregister+0x259/0x360 [cfg80211]
[10680.875712]  [<ffffffff810c3ca0>] ? wake_atomic_t_function+0x60/0x60
[10680.875763]  [<ffffffffc091a235>] rtw_wdev_unregister+0x4b/0x51 [8723bu]
[10680.875807]  [<ffffffffc09066ea>] rtw_unregister_netdevs+0x47/0x7a [8723bu]
[10680.875850]  [<ffffffffc0907b24>] rtw_dev_remove+0x25/0x77 [8723bu]
[10680.875856]  [<ffffffff8161d146>] usb_unbind_interface+0x86/0x280
[10680.875863]  [<ffffffff81553a11>] __device_release_driver+0xa1/0x150
[10680.875868]  [<ffffffff81553ae3>] device_release_driver+0x23/0x30
[10680.875872]  [<ffffffff81553131>] bus_remove_device+0x101/0x170
[10680.875877]  [<ffffffff8154f289>] device_del+0x139/0x260
[10680.875882]  [<ffffffff81621a6f>] ? usb_remove_ep_devs+0x1f/0x30
[10680.875889]  [<ffffffff8161a909>] usb_disable_device+0x89/0x270
[10680.875894]  [<ffffffff81610242>] usb_disconnect+0x92/0x280
[10680.875899]  [<ffffffff81611e12>] hub_port_connect+0x82/0x9c0
[10680.875905]  [<ffffffff81612e21>] hub_event+0x6d1/0xb10
[10680.875909]  [<ffffffff810b9415>] ? put_prev_entity+0x35/0x7d0
[10680.875916]  [<ffffffff8109a2c5>] process_one_work+0x165/0x480
[10680.875921]  [<ffffffff8109a62b>] worker_thread+0x4b/0x4c0
[10680.875926]  [<ffffffff8109a5e0>] ? process_one_work+0x480/0x480
[10680.875931]  [<ffffffff810a0808>] kthread+0xd8/0xf0
[10680.875935]  [<ffffffff810a0730>] ? kthread_create_on_node+0x1e0/0x1e0
[10680.875940]  [<ffffffff8182e28f>] ret_from_fork+0x3f/0x70
[10680.875944]  [<ffffffff810a0730>] ? kthread_create_on_node+0x1e0/0x1e0
[10680.876030] INFO: task colord-sane:8779 blocked for more than 120 seconds.
[10680.876034]       Tainted: G           OE   4.4.0-34-generic #53-Ubuntu
[10680.876036] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[10680.876039] colord-sane     D ffff8801f1d33d78     0  8779   3116 0x00000000
[10680.876044]  ffff8801f1d33d78 ffff8800abe8b700 ffff8802152b6040 ffff8800abe8b700
[10680.876049]  ffff8801f1d34000 ffff8800d63050fc ffff8800abe8b700 00000000ffffffff
[10680.876054]  ffff8800d6305100 ffff8801f1d33d90 ffffffff81829e15 ffff8800d63050f8
[10680.876059] Call Trace:
[10680.876066]  [<ffffffff81829e15>] schedule+0x35/0x80
[10680.876072]  [<ffffffff8182a0be>] schedule_preempt_disabled+0xe/0x10
[10680.876076]  [<ffffffff8182bcf9>] __mutex_lock_slowpath+0xb9/0x130
[10680.876080]  [<ffffffff8182bd8f>] mutex_lock+0x1f/0x30
[10680.876085]  [<ffffffff81620f07>] read_descriptors+0x37/0x100
[10680.876094]  [<ffffffff8128cfda>] sysfs_kf_bin_read+0x4a/0x70
[10680.876099]  [<ffffffff8128c54b>] kernfs_fop_read+0xab/0x160
[10680.876107]  [<ffffffff8120cc48>] __vfs_read+0x18/0x40
[10680.876112]  [<ffffffff8120d216>] vfs_read+0x86/0x130
[10680.876118]  [<ffffffff8120df65>] SyS_read+0x55/0xc0
[10680.876123]  [<ffffffff8182def2>] entry_SYSCALL_64_fastpath+0x16/0x71
[10680.876129] INFO: task lsusb:8802 blocked for more than 120 seconds.
[10680.876132]       Tainted: G           OE   4.4.0-34-generic #53-Ubuntu
[10680.876134] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[10680.876136] lsusb           D ffff880086ccbd78     0  8802   7166 0x00000004
[10680.876141]  ffff880086ccbd78 ffff8801b4cad280 ffff8802152b3700 ffff8801b4cad280
[10680.876146]  ffff880086ccc000 ffff8800d63050fc ffff8801b4cad280 00000000ffffffff
[10680.876150]  ffff8800d6305100 ffff880086ccbd90 ffffffff81829e15 ffff8800d63050f8
[10680.876155] Call Trace:
[10680.876161]  [<ffffffff81829e15>] schedule+0x35/0x80
[10680.876166]  [<ffffffff8182a0be>] schedule_preempt_disabled+0xe/0x10
[10680.876170]  [<ffffffff8182bcf9>] __mutex_lock_slowpath+0xb9/0x130
[10680.876174]  [<ffffffff8182bd8f>] mutex_lock+0x1f/0x30
[10680.876179]  [<ffffffff81620f07>] read_descriptors+0x37/0x100
[10680.876185]  [<ffffffff8128cfda>] sysfs_kf_bin_read+0x4a/0x70
[10680.876190]  [<ffffffff8128c54b>] kernfs_fop_read+0xab/0x160
[10680.876196]  [<ffffffff8120cc48>] __vfs_read+0x18/0x40
[10680.876200]  [<ffffffff8120d216>] vfs_read+0x86/0x130
[10680.876206]  [<ffffffff8120df65>] SyS_read+0x55/0xc0
[10680.876211]  [<ffffffff8182def2>] entry_SYSCALL_64_fastpath+0x16/0x71
[10721.804852] RTL871X: nolinked power save leave
[10784.804330] RTL871X: nolinked power save leave
[10800.883911] INFO: task kworker/4:0:29 blocked for more than 120 seconds.
[10800.883913]       Tainted: G           OE   4.4.0-34-generic #53-Ubuntu
[10800.883914] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[10800.883915] kworker/4:0     D ffff88021481fa48     0    29      2 0x00000000
[10800.883921] Workqueue: usb_hub_wq hub_event
[10800.883922]  ffff88021481fa48 0000000182000185 ffff8801f3838dc0 ffff880214f86e00
[10800.883923]  ffff880214820000 ffff8800ce8a2800 0000000000000001 ffff8800ce8a2890
[10800.883924]  ffff8801c6710000 ffff88021481fa60 ffffffff81829e15 ffff8800ce8a2ac0
[10800.883926] Call Trace:
[10800.883930]  [<ffffffff81829e15>] schedule+0x35/0x80
[10800.883949]  [<ffffffffc0496cd9>] wiphy_unregister+0x259/0x360 [cfg80211]
[10800.883952]  [<ffffffff810c3ca0>] ? wake_atomic_t_function+0x60/0x60
[10800.883967]  [<ffffffffc091a235>] rtw_wdev_unregister+0x4b/0x51 [8723bu]
[10800.883976]  [<ffffffffc09066ea>] rtw_unregister_netdevs+0x47/0x7a [8723bu]
[10800.883985]  [<ffffffffc0907b24>] rtw_dev_remove+0x25/0x77 [8723bu]
[10800.883986]  [<ffffffff8161d146>] usb_unbind_interface+0x86/0x280
[10800.883988]  [<ffffffff81553a11>] __device_release_driver+0xa1/0x150
[10800.883989]  [<ffffffff81553ae3>] device_release_driver+0x23/0x30
[10800.883990]  [<ffffffff81553131>] bus_remove_device+0x101/0x170
[10800.883991]  [<ffffffff8154f289>] device_del+0x139/0x260
[10800.883992]  [<ffffffff81621a6f>] ? usb_remove_ep_devs+0x1f/0x30
[10800.883994]  [<ffffffff8161a909>] usb_disable_device+0x89/0x270
[10800.883995]  [<ffffffff81610242>] usb_disconnect+0x92/0x280
[10800.883996]  [<ffffffff81611e12>] hub_port_connect+0x82/0x9c0
[10800.883997]  [<ffffffff81612e21>] hub_event+0x6d1/0xb10
[10800.883998]  [<ffffffff810b9415>] ? put_prev_entity+0x35/0x7d0
[10800.884000]  [<ffffffff8109a2c5>] process_one_work+0x165/0x480
[10800.884001]  [<ffffffff8109a62b>] worker_thread+0x4b/0x4c0
[10800.884002]  [<ffffffff8109a5e0>] ? process_one_work+0x480/0x480
[10800.884003]  [<ffffffff810a0808>] kthread+0xd8/0xf0
[10800.884004]  [<ffffffff810a0730>] ? kthread_create_on_node+0x1e0/0x1e0
[10800.884005]  [<ffffffff8182e28f>] ret_from_fork+0x3f/0x70
[10800.884006]  [<ffffffff810a0730>] ? kthread_create_on_node+0x1e0/0x1e0
[10800.884044] INFO: task colord-sane:8779 blocked for more than 120 seconds.
[10800.884045]       Tainted: G           OE   4.4.0-34-generic #53-Ubuntu
[10800.884045] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[10800.884046] colord-sane     D ffff8801f1d33d78     0  8779   3116 0x00000000
[10800.884047]  ffff8801f1d33d78 ffff8800abe8b700 ffff8802152b6040 ffff8800abe8b700
[10800.884048]  ffff8801f1d34000 ffff8800d63050fc ffff8800abe8b700 00000000ffffffff
[10800.884049]  ffff8800d6305100 ffff8801f1d33d90 ffffffff81829e15 ffff8800d63050f8
[10800.884050] Call Trace:
[10800.884052]  [<ffffffff81829e15>] schedule+0x35/0x80
[10800.884053]  [<ffffffff8182a0be>] schedule_preempt_disabled+0xe/0x10
[10800.884054]  [<ffffffff8182bcf9>] __mutex_lock_slowpath+0xb9/0x130
[10800.884055]  [<ffffffff8182bd8f>] mutex_lock+0x1f/0x30
[10800.884056]  [<ffffffff81620f07>] read_descriptors+0x37/0x100
[10800.884058]  [<ffffffff8128cfda>] sysfs_kf_bin_read+0x4a/0x70
[10800.884059]  [<ffffffff8128c54b>] kernfs_fop_read+0xab/0x160
[10800.884062]  [<ffffffff8120cc48>] __vfs_read+0x18/0x40
[10800.884063]  [<ffffffff8120d216>] vfs_read+0x86/0x130
[10800.884064]  [<ffffffff8120df65>] SyS_read+0x55/0xc0
[10800.884066]  [<ffffffff8182def2>] entry_SYSCALL_64_fastpath+0x16/0x71
[10847.810604] RTL871X: nolinked power save leave
[10910.812713] RTL871X: nolinked power save leave
[10973.820691] RTL871X: nolinked power save leave
[11036.822200] RTL871X: nolinked power save leave
[11099.828881] RTL871X: nolinked power save leave

before plug in the usb wireless adaptor:

enp2s0    Link encap:Ethernet  HWaddr d8:cb:8a:13:83:7b  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:1509 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1509 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:120409 (120.4 KB)  TX bytes:120409 (120.4 KB)

wlp3s0    Link encap:Ethernet  HWaddr 80:19:34:55:a8:48  
          inet addr:192.168.0.100  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::9d58:aa6:315b:c1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:49831 errors:0 dropped:0 overruns:0 frame:0
          TX packets:39772 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:24738371 (24.7 MB)  TX bytes:6800837 (6.8 MB)

after plug-in the usb wireless adaptor

ifconfig
enp2s0    Link encap:Ethernet  HWaddr d8:cb:8a:13:83:7b  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:1510 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1510 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:120438 (120.4 KB)  TX bytes:120438 (120.4 KB)

wlp3s0    Link encap:Ethernet  HWaddr 80:19:34:55:a8:48  
          inet addr:192.168.0.100  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::9d58:aa6:315b:c1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:49856 errors:0 dropped:0 overruns:0 frame:0
          TX packets:39810 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:24740834 (24.7 MB)  TX bytes:6806956 (6.8 MB)

wlx40a5ef0ea956 Link encap:Ethernet  HWaddr 40:a5:ef:0e:a9:56  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:1 errors:0 dropped:1 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

and unplug it

enp2s0    Link encap:Ethernet  HWaddr d8:cb:8a:13:83:7b  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:1514 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1514 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:120702 (120.7 KB)  TX bytes:120702 (120.7 KB)

wlp3s0    Link encap:Ethernet  HWaddr 80:19:34:55:a8:48  
          inet addr:192.168.0.100  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::9d58:aa6:315b:c1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:49923 errors:0 dropped:0 overruns:0 frame:0
          TX packets:39878 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:24758761 (24.7 MB)  TX bytes:6822221 (6.8 MB)

wlx40a5ef0ea956 Link encap:Ethernet  HWaddr 40:a5:ef:0e:a9:56  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:5 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

And It sill here.

And I can't run lsusb because it stucked and never return.

weiqi-chen commented 7 years ago

I found another information:

If I unplug the usb wireless adaptor , I can still see the wlan0 device . And It will not "disappear" until I ifconfig wlan0 down it.

( Actually, it's name is wlx40a5ef0ea956, But I used wlan0 here. )

I add more debug printk info kernel code:

    struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
    printk(KERN_DEBUG"%s: Before wait_event.\n", __func__);
    wait_event(rdev->dev_wait, ({  
        int __count;
        rtnl_lock();
        __count = rdev->opencount;
        rtnl_unlock();
        __count == 0; }));
    printk(KERN_DEBUG"%s: After wait_event.\n", __func__);

    if (rdev->rfkill)
        rfkill_unregister(rdev->rfkill);

    rtnl_lock();
    nl80211_notify_wiphy(rdev, NL80211_CMD_DEL_WIPHY);
    rdev->wiphy.registered = false;

    WARN_ON(!list_empty(&rdev->wdev_list));

And Here is my kernel output:

You can find another issue here, WARN_ON(!list_empty(&rdev->wdev_list)) was triggered too.

[   45.810164] usb 1-1.2: new high-speed USB device number 4 using dwc_otg
[   45.931544] usb 1-1.2: New USB device found, idVendor=0bda, idProduct=b720
[   45.938661] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   45.946281] usb 1-1.2: Product: 802.11n WLAN Adapter
[   45.951493] usb 1-1.2: Manufacturer: Realtek
[   45.955934] usb 1-1.2: SerialNumber: 00e04c000001
[   46.041035] Bluetooth: Core ver 2.21
[   46.046129] NET: Registered protocol family 31
[   46.050885] Bluetooth: HCI device and connection manager initialized
[   46.060329] Bluetooth: HCI socket layer initialized
[   46.065460] Bluetooth: L2CAP socket layer initialized
[   46.072831] Bluetooth: SCO socket layer initialized
[   46.111516] usbcore: registered new interface driver btusb
[   46.124081] Bluetooth: hci0: rtl: examining hci_ver=06 hci_rev=000b lmp_ver=06 lmp_subver=8723
[   46.133178] Bluetooth: hci0: rtl: loading rtl_bt/rtl8723b_fw.bin
[   46.180666] Bluetooth: hci0: rom_version status=0 version=1
[   47.134102] RTL871X: module init start
[   47.138045] RTL871X: rtl8723bu v4.3.6.11_12942.20141204_BTCOEX20140507-4E40
[   47.145334] RTL871X: rtl8723bu BT-Coex version = BTCOEX20140507-4E40
[   47.327179] RTL871X: rtw_ndev_init(wlan0)
[   47.335274] usbcore: registered new interface driver rtl8723bu
[   47.341433] RTL871X: module init ret=0
[   47.381483] rtl8723bu 1-1.2:1.2 wlx40a5ef0ea956: renamed from wlan0
[   48.987896] IPv6: ADDRCONF(NETDEV_UP): wlx40a5ef0ea956: link is not ready
[   50.982217] RTL871X: nolinked power save enter
[   67.811953] usb 1-1.2: USB disconnect, device number 4
[   67.826015] wiphy_unregister: Before wait_event.          ##If I don't run 'ifconfig down', the log output will stuck at here.
[   76.662864] RTL871X: nolinked power save leave
[   76.671136] wiphy_unregister: After wait_event.
[   76.681550] ------------[ cut here ]------------
[   76.690348] WARNING: CPU: 0 PID: 36 at net/wireless/core.c:796 wiphy_unregister+0x340/0x344 [cfg80211]
[   76.704279] CPU: 0 PID: 36 Comm: kworker/0:1 Tainted: G           O    4.6.1-v7+ #7
[   76.715545] Hardware name: BCM2709
[   76.722781] [<80110b04>] (unwind_backtrace) from [<8010c43c>] (show_stack+0x20/0x24)
[   76.734494] [<8010c43c>] (show_stack) from [<80432eec>] (dump_stack+0xc8/0x10c)
[   76.745503] [<80432eec>] (dump_stack) from [<8011de24>] (__warn+0xf8/0x110)
[   76.756103] [<8011de24>] (__warn) from [<8011df0c>] (warn_slowpath_null+0x30/0x38)
[   76.767564] [<8011df0c>] (warn_slowpath_null) from [<7f1a5cd0>] (wiphy_unregister+0x340/0x344 [cfg802)
[   76.781389] [<7f1a5cd0>] (wiphy_unregister [cfg80211]) from [<7f2c051c>] (rtw_wdev_unregister+0x54/0x)
[   76.799533] [<7f2c051c>] (rtw_wdev_unregister [8723bu]) from [<7f2acf70>] (rtw_unregister_netdevs+0x4)
[   76.818542] [<7f2acf70>] (rtw_unregister_netdevs [8723bu]) from [<7f2ae524>] (rtw_dev_remove+0x2c/0x8)
[   76.837585] [<7f2ae524>] (rtw_dev_remove [8723bu]) from [<8052ddb4>] (usb_unbind_interface+0x8c/0x298)
[   76.851602] [<8052ddb4>] (usb_unbind_interface) from [<804bb828>] (__device_release_driver+0x98/0x12c)
[   76.865646] [<804bb828>] (__device_release_driver) from [<804bb8e8>] (device_release_driver+0x2c/0x38)
[   76.879677] [<804bb8e8>] (device_release_driver) from [<804bafd8>] (bus_remove_device+0xe8/0x114)
[   76.893271] [<804bafd8>] (bus_remove_device) from [<804b7c34>] (device_del+0x11c/0x220)
[   76.905888] [<804b7c34>] (device_del) from [<8052b3d8>] (usb_disable_device+0xb0/0x1f4)
[   76.918626] [<8052b3d8>] (usb_disable_device) from [<80522634>] (usb_disconnect+0x84/0x238)
[   76.931734] [<80522634>] (usb_disconnect) from [<80524164>] (hub_event+0x60c/0x10d0)
[   76.944241] [<80524164>] (hub_event) from [<80135fbc>] (process_one_work+0x170/0x508)
[   76.956330] [<80135fbc>] (process_one_work) from [<801363b4>] (worker_thread+0x60/0x5c8)
[   76.968870] [<801363b4>] (worker_thread) from [<8013c3f8>] (kthread+0xec/0x104)
[   76.980644] [<8013c3f8>] (kthread) from [<80107f68>] (ret_from_fork+0x14/0x2c)
[   76.992406] ---[ end trace 359dd6b8c5834803 ]---
[   77.100328] RTL871X: rtw_ndev_uninit(wlx40a5ef0ea956)
[   77.190608] RTL871X: rtw_cmd_thread: DriverStopped(1) SurpriseRemoved(1) break at line 452
[   77.203302] RTL871X: rtw_dev_unload: driver in IPS-FWLPS

If I don't run 'ifconfig down' and just wait. The kernel will found an issue, and report. Because it has kernel "thread" stuck at wait_event() from wiphy_unregister().

[   22.750293] usb 1-1.2: new high-speed USB device number 4 using dwc_otg
[   22.871716] usb 1-1.2: New USB device found, idVendor=0bda, idProduct=b720
[   22.878834] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   22.886449] usb 1-1.2: Product: 802.11n WLAN Adapter
[   22.891652] usb 1-1.2: Manufacturer: Realtek
[   22.896088] usb 1-1.2: SerialNumber: 00e04c000001
[   22.994566] Bluetooth: Core ver 2.21
[   22.998549] NET: Registered protocol family 31
[   23.003397] Bluetooth: HCI device and connection manager initialized
[   23.010328] Bluetooth: HCI socket layer initialized
[   23.015472] Bluetooth: L2CAP socket layer initialized
[   23.021844] Bluetooth: SCO socket layer initialized
[   23.053050] usbcore: registered new interface driver btusb
[   23.064529] Bluetooth: hci0: rtl: examining hci_ver=06 hci_rev=000b lmp_ver=06 lmp_subver=8723
[   23.074119] Bluetooth: hci0: rtl: loading rtl_bt/rtl8723b_fw.bin
[   23.124897] Bluetooth: hci0: rom_version status=0 version=1
[   24.074146] RTL871X: module init start
[   24.078086] RTL871X: rtl8723bu v4.3.6.11_12942.20141204_BTCOEX20140507-4E40
[   24.085451] RTL871X: rtl8723bu BT-Coex version = BTCOEX20140507-4E40
[   24.270385] RTL871X: rtw_ndev_init(wlan0)
[   24.277380] usbcore: registered new interface driver rtl8723bu
[   24.283531] RTL871X: module init ret=0
[   24.323846] rtl8723bu 1-1.2:1.2 wlx40a5ef0ea956: renamed from wlan0
[   25.904652] IPv6: ADDRCONF(NETDEV_UP): wlx40a5ef0ea956: link is not ready
[   27.902335] RTL871X: nolinked power save enter
[   37.624133] usb 1-1.2: USB disconnect, device number 4
[   37.635215] wiphy_unregister: Before wait_event.
[  240.610366] INFO: task kworker/0:3:737 blocked for more than 120 seconds.
[  240.620689]       Tainted: G           O    4.6.1-v7+ #7
[  240.629415] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  240.640872] kworker/0:3     D 806d04cc     0   737      2 0x00000000
[  240.650961] Workqueue: usb_hub_wq hub_event
[  240.658717] [<806d04cc>] (__schedule) from [<806d0a4c>] (schedule+0x50/0xa8)
[  240.669575] [<806d0a4c>] (schedule) from [<7f1aeb9c>] (wiphy_unregister+0x20c/0x344 [cfg80211])
[  240.682516] [<7f1aeb9c>] (wiphy_unregister [cfg80211]) from [<7f2c951c>] (rtw_wdev_unregister+0x54/0x)
[  240.700641] [<7f2c951c>] (rtw_wdev_unregister [8723bu]) from [<7f2b5f70>] (rtw_unregister_netdevs+0x4)
[  240.719705] [<7f2b5f70>] (rtw_unregister_netdevs [8723bu]) from [<7f2b7524>] (rtw_dev_remove+0x2c/0x8)
[  240.738505] [<7f2b7524>] (rtw_dev_remove [8723bu]) from [<8052ddb4>] (usb_unbind_interface+0x8c/0x298)
[  240.752406] [<8052ddb4>] (usb_unbind_interface) from [<804bb828>] (__device_release_driver+0x98/0x12c)
[  240.766404] [<804bb828>] (__device_release_driver) from [<804bb8e8>] (device_release_driver+0x2c/0x38)
[  240.780493] [<804bb8e8>] (device_release_driver) from [<804bafd8>] (bus_remove_device+0xe8/0x114)
[  240.794185] [<804bafd8>] (bus_remove_device) from [<804b7c34>] (device_del+0x11c/0x220)
[  240.807054] [<804b7c34>] (device_del) from [<8052b3d8>] (usb_disable_device+0xb0/0x1f4)
[  240.819795] [<8052b3d8>] (usb_disable_device) from [<80522634>] (usb_disconnect+0x84/0x238)
[  240.832996] [<80522634>] (usb_disconnect) from [<80524164>] (hub_event+0x60c/0x10d0)
[  240.845575] [<80524164>] (hub_event) from [<80135fbc>] (process_one_work+0x170/0x508)
[  240.858257] [<80135fbc>] (process_one_work) from [<801363b4>] (worker_thread+0x60/0x5c8)
[  240.871224] [<801363b4>] (worker_thread) from [<8013c3f8>] (kthread+0xec/0x104)
[  240.883375] [<8013c3f8>] (kthread) from [<80107f68>] (ret_from_fork+0x14/0x2c)
[  360.890366] INFO: task kworker/0:3:737 blocked for more than 120 seconds.
[  360.902080]       Tainted: G           O    4.6.1-v7+ #7
[  360.912250] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  360.925012] kworker/0:3     D 806d04cc     0   737      2 0x00000000
[  360.936265] Workqueue: usb_hub_wq hub_event
[  360.945331] [<806d04cc>] (__schedule) from [<806d0a4c>] (schedule+0x50/0xa8)
[  360.957413] [<806d0a4c>] (schedule) from [<7f1aeb9c>] (wiphy_unregister+0x20c/0x344 [cfg80211])
[  360.971493] [<7f1aeb9c>] (wiphy_unregister [cfg80211]) from [<7f2c951c>] (rtw_wdev_unregister+0x54/0x)
[  360.991670] [<7f2c951c>] (rtw_wdev_unregister [8723bu]) from [<7f2b5f70>] (rtw_unregister_netdevs+0x4)
[  361.012268] [<7f2b5f70>] (rtw_unregister_netdevs [8723bu]) from [<7f2b7524>] (rtw_dev_remove+0x2c/0x8)
[  361.032296] [<7f2b7524>] (rtw_dev_remove [8723bu]) from [<8052ddb4>] (usb_unbind_interface+0x8c/0x298)
[  361.046662] [<8052ddb4>] (usb_unbind_interface) from [<804bb828>] (__device_release_driver+0x98/0x12c)
[  361.060964] [<804bb828>] (__device_release_driver) from [<804bb8e8>] (device_release_driver+0x2c/0x38)
[  361.075209] [<804bb8e8>] (device_release_driver) from [<804bafd8>] (bus_remove_device+0xe8/0x114)
[  361.088993] [<804bafd8>] (bus_remove_device) from [<804b7c34>] (device_del+0x11c/0x220)
[  361.102000] [<804b7c34>] (device_del) from [<8052b3d8>] (usb_disable_device+0xb0/0x1f4)
[  361.114984] [<8052b3d8>] (usb_disable_device) from [<80522634>] (usb_disconnect+0x84/0x238)
[  361.128344] [<80522634>] (usb_disconnect) from [<80524164>] (hub_event+0x60c/0x10d0)
[  361.140990] [<80524164>] (hub_event) from [<80135fbc>] (process_one_work+0x170/0x508)
[  361.153790] [<80135fbc>] (process_one_work) from [<801363b4>] (worker_thread+0x60/0x5c8)
[  361.166859] [<801363b4>] (worker_thread) from [<8013c3f8>] (kthread+0xec/0x104)
[  361.179157] [<8013c3f8>] (kthread) from [<80107f68>] (ret_from_fork+0x14/0x2c)
weiqi-chen commented 7 years ago

I found a solution !!

diff --git a/os_dep/os_intfs.c b/os_dep/os_intfs.c
index ddcc66f..a77d4bb 100644
--- a/os_dep/os_intfs.c
+++ b/os_dep/os_intfs.c
@@ -829,14 +829,15 @@ void rtw_unregister_netdevs(struct dvobj_priv *dvobj)

                pnetdev = padapter->pnetdev;

-#ifdef CONFIG_IOCTL_CFG80211
-               rtw_wdev_unregister(padapter->rtw_wdev);
-#endif
-
                if((padapter->DriverState != DRIVER_DISAPPEAR) && pnetdev) {

                        unregister_netdev(pnetdev); //will call netdev_close()
                }
+
+#ifdef CONFIG_IOCTL_CFG80211
+               rtw_wdev_unregister(padapter->rtw_wdev);
+#endif
+
        }
 }

Should call unregister_netdev() first remove the network device, then call wiphy_unregister() remove the wireless stuff.

I don't know whether I did it right.

Now, I can unplug or rmmod it smoothly, It works well.

lwfinger commented 7 years ago

That solution looks good to me, and it works here. Thanks. I just pushed the fix to the repo.