Closed weiqi-chen closed 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)
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.
That solution looks good to me, and it works here. Thanks. I just pushed the fix to the repo.
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:
PC:
On my Raspberry pi
Here is part of
dmesg
output:Here is my PC
dmesg
output:before plug in the usb wireless adaptor:
after plug-in the usb wireless adaptor
and unplug it
And It sill here.
And I can't run
lsusb
because it stucked and never return.