加载WiFi驱动程序会导致整个系统变得不稳定。如何调试?

加载WiFi驱动程序会导致整个系统变得不稳定。如何调试?

我不是 Linux 内核专家,但我买了这台新笔记本电脑,但它的 WiFi(RT3290LE) 无法工作。我尝试了各种来源的解决方案,但它们不起作用。所以就由我来解决吧,我之前从来没有调试过内核代码。所以就这样了。

我运行Arch linux,使用的内核是4.3.3-2-ARCH。当我加载模块时(我从尿素尿率或来自问Ubuntu),这些是 dmesg 中出现的第一行:

[   40.077355] rt3290sta: module license 'unspecified' taints kernel.
[   40.077359] Disabling lock debugging due to kernel taint
[   40.079739] register rt2860

前两行只是一个警告,但我想知道为什么它是“注册”rt2860。接下来的几行:

[   40.079912] 

               === pAd = ffffc90001c61000, size = 583104 ===

[   40.079922] <-- RTMPAllocTxRxRingMemory, Status=0
[   40.079958] <-- RTMPAllocAdapterBlock, Status=0

指示正在加载 rt2860 模块,因为函数RTMPAllocTxRxRingMemoryRTMPAllocAdapterBlock是为此模块定义的。我猜测这个模块也可以处理我的 3290LE 芯片,因为chipssrc 目录中有一个名为 .txt 文件的目录rt3290.c。从那里一切看起来都很好,直到:

[   40.079960] pAd->CSRBaseAddress =0xffffc90001400000, csr_addr=0xffffc90001400000!
[   40.079963] device_id =0x3290
[   40.079970] CacheVal-OnOff:1, bPCIclkOff:0, WlanFunCtrl:0x0
[   40.079978] ==> RTMPWlan 1, bPCIclkOff = 0, pAd->WlanFunCtrl.word = 0xff000522
[   40.079979] ==> RTMPWlan 1, bPCIclkOff = 0, WlanFunCtrl.word = 0xff000521
[   40.080127] <== RTMPWlan 1  bPCIclkOff = 0 pAd->WlanFunCtrl.word = 0xff000523
[   40.080138] NVM is EFUSE
[   40.082604] rt2860 0000:09:00.0 enp9s0f0: renamed from ra0
[   40.103558] NetworkManager[332]: segfault at 8 ip 00000000004ca126 sp 00007ffca7ec45c8 error 4 in NetworkManager[400000+1c5000]

作为 NetworkManager 报告的段错误。从那时起,一切似乎都不对劲了:

[   62.254256] IPv6: ADDRCONF(NETDEV_UP): enp9s0f0: link is not ready
[   62.254302] MACVersion=0x32900015
[   62.254304] CacheVal-OnOff:1, bPCIclkOff:0, WlanFunCtrl:0xff000523
[   62.254306] ==> RTMPWlan 1, bPCIclkOff = 0, pAd->WlanFunCtrl.word = 0xff000523
[   62.254307] ==> RTMPWlan 1, bPCIclkOff = 0, WlanFunCtrl.word = 0xff000521
[   62.254315] <== RTMPWlan 1  bPCIclkOff = 0 pAd->WlanFunCtrl.word = 0xff000523
[   62.254322] PllCtrl:0x26c5555
[   62.255651] RX DESC ffff880085128000  size = 2048
[   62.255818] RTMP_TimerListAdd: add timer obj ffffc90001182d60!
[   62.255819] RTMP_TimerListAdd: add timer obj ffffc90001182dd0!
[   62.255820] RTMP_TimerListAdd: add timer obj ffffc90001182e40!
[   62.255821] RTMP_TimerListAdd: add timer obj ffffc90001182cf0!
[   62.255822] RTMP_TimerListAdd: add timer obj ffffc90001182ba0!
[   62.255823] RTMP_TimerListAdd: add timer obj ffffc90001182c10!
[   62.255824] RTMP_TimerListAdd: add timer obj ffffc9000114cd20!
[   62.255825] RTMP_TimerListAdd: add timer obj ffffc9000114cd90!
[   62.255826] RTMP_TimerListAdd: add timer obj ffffc9000114cc38!
[   62.255827] RTMP_TimerListAdd: add timer obj ffffc9000113bb30!
[   62.255828] RTMP_TimerListAdd: add timer obj ffffc9000113bba8!
[   62.255829] RTMP_TimerListAdd: add timer obj ffffc9000114cb58!
[   62.255830] RTMP_TimerListAdd: add timer obj ffffc9000114ce20!
[   62.257657] BBP_R105: BBPR105.field.EnableSIGRemodulation = 1, BBPR105.field.MLDFor2Stream = 0
[   62.260034] no file read method
[   62.260037] Read file "/etc/Wireless/RT2860STA/RT2860STA.dat" failed(errCode=-1)!
[   62.260039] 1. Phy Mode = 0
[   62.260040] 2. Phy Mode = 0
[   62.260044] NVM is Efuse and its size =1e[1e0-1fd] 
[   62.261283] 3. Phy Mode = 0
[   62.261484] AntCfgInit: primary/secondary ant 0/1
               CacheVal-OnOff:1, bPCIclkOff:0, WlanFunCtrl:0xff000523
[   62.300528] ==> RTMPWlan 1, bPCIclkOff = 0, pAd->WlanFunCtrl.word = 0xff000533
[   62.300529] <== RTMPWlan bPCIclkOff = 0, Exit because WLAN EN is already ON 
[   62.303602] RTMPSetPhyMode: channel is out of range, use first channel=1 
[   62.303604] MCS Set = 00 00 00 00 00
[   62.303608] <==== rt28xx_init, Status=0
[   62.303663] 0x1300 = 00073200
[   62.303664] RTMPrt3xSetPCIePowerLinkCtrl.===> 1e
[   62.348650] CacheVal-OnOff:0, bPCIclkOff:1, WlanFunCtrl:0xff000533
[   62.348653] ==> RTMPWlan 0, bPCIclkOff = 1, pAd->WlanFunCtrl.word = 0xff000523
[   62.348654] Set INT_MASK_CSR = 0
[   62.348658] ==> RTMPWlan 0, bPCIclkOff = 1, WlanFunCtrl.word = 0xff000520
[   62.348661] <== RTMPWlan 0  bPCIclkOff = 1 pAd->WlanFunCtrl.word = 0xff000520
[   62.355767] CacheVal-OnOff:0, bPCIclkOff:1, WlanFunCtrl:0xff000520
[   62.355775] ==> RTMPWlan 0, bPCIclkOff = 1, pAd->WlanFunCtrl.word = 0xff000520
[   62.355775] Set INT_MASK_CSR = 0
[   62.355804] ==> RTMPWlan 0, bPCIclkOff = 1, WlanFunCtrl.word = 0xff000520
[   62.355806] <== RTMPWlan 0  bPCIclkOff = 1 pAd->WlanFunCtrl.word = 0xff000520
[   62.358438] MACVersion=0x32900015
[   62.358441] CacheVal-OnOff:1, bPCIclkOff:0, WlanFunCtrl:0xff000520
[   62.358447] ==> RTMPWlan 1, bPCIclkOff = 0, pAd->WlanFunCtrl.word = 0xff000520
[   62.358448] ==> RTMPWlan 1, bPCIclkOff = 0, WlanFunCtrl.word = 0xff000521
[   62.358585] <== RTMPWlan 1  bPCIclkOff = 0 pAd->WlanFunCtrl.word = 0xff000523
[   62.358592] PllCtrl:0x2695555
[   62.359939] RX DESC ffff880085128000  size = 2048
[   62.360119] RTMP_TimerListAdd: add timer obj ffffc90001182d60!
[   62.360120] RTMP_TimerListAdd: add timer obj ffffc90001182dd0!
[   62.360121] RTMP_TimerListAdd: add timer obj ffffc90001182e40!
[   62.360122] RTMP_TimerListAdd: add timer obj ffffc90001182cf0!
[   62.360123] RTMP_TimerListAdd: add timer obj ffffc90001182ba0!
[   62.360124] RTMP_TimerListAdd: add timer obj ffffc90001182c10!
[   62.360125] RTMP_TimerListAdd: add timer obj ffffc9000114cd20!
[   62.360126] RTMP_TimerListAdd: add timer obj ffffc9000114cd90!
[   62.360126] RTMP_TimerListAdd: add timer obj ffffc9000114cc38!
[   62.360127] RTMP_TimerListAdd: add timer obj ffffc9000113bb30!
[   62.360128] RTMP_TimerListAdd: add timer obj ffffc9000113bba8!
[   62.360129] RTMP_TimerListAdd: add timer obj ffffc9000114cb58!
[   62.360131] RTMP_TimerListAdd: add timer obj ffffc9000114ce20!
[   62.361957] BBP_R105: BBPR105.field.EnableSIGRemodulation = 1, BBPR105.field.MLDFor2Stream = 0
[   62.362678] no file read method
[   62.362679] Read file "/etc/Wireless/RT2860STA/RT2860STA.dat" failed(errCode=-1)!
[   62.362680] 1. Phy Mode = 0
[   62.362680] 2. Phy Mode = 0
[   62.362684] NVM is Efuse and its size =1e[1e0-1fd] 
[   62.363940] 3. Phy Mode = 0
[   62.364137] AntCfgInit: primary/secondary ant 0/1
               CacheVal-OnOff:1, bPCIclkOff:0, WlanFunCtrl:0xff000523
[   62.382877] ==> RTMPWlan 1, bPCIclkOff = 0, pAd->WlanFunCtrl.word = 0xff000533
[   62.382878] <== RTMPWlan bPCIclkOff = 0, Exit because WLAN EN is already ON 
[   62.385928] MCS Set = 00 00 00 00 00
[   62.385932] <==== rt28xx_init, Status=0
[   62.385987] 0x1300 = 00073200
[   62.385988] RTMPrt3xSetPCIePowerLinkCtrl.===> 1e
[   62.430888] CacheVal-OnOff:0, bPCIclkOff:1, WlanFunCtrl:0xff000533
[   62.430891] ==> RTMPWlan 0, bPCIclkOff = 1, pAd->WlanFunCtrl.word = 0xff000523
[   62.430892] Set INT_MASK_CSR = 0
[   62.430896] ==> RTMPWlan 0, bPCIclkOff = 1, WlanFunCtrl.word = 0xff000520
[   62.430899] <== RTMPWlan 0  bPCIclkOff = 1 pAd->WlanFunCtrl.word = 0xff000520
[   62.437938] CacheVal-OnOff:0, bPCIclkOff:1, WlanFunCtrl:0xff000520
[   62.437944] ==> RTMPWlan 0, bPCIclkOff = 1, pAd->WlanFunCtrl.word = 0xff000520
[   62.437945] Set INT_MASK_CSR = 0
[   62.437972] ==> RTMPWlan 0, bPCIclkOff = 1, WlanFunCtrl.word = 0xff000520
[   62.437975] <== RTMPWlan 0  bPCIclkOff = 1 pAd->WlanFunCtrl.word = 0xff000520
[   62.440460] MACVersion=0x32900015
[   62.440463] CacheVal-OnOff:1, bPCIclkOff:0, WlanFunCtrl:0xff000520
[   62.440470] ==> RTMPWlan 1, bPCIclkOff = 0, pAd->WlanFunCtrl.word = 0xff000520
[   62.440471] ==> RTMPWlan 1, bPCIclkOff = 0, WlanFunCtrl.word = 0xff000521
[   62.440606] <== RTMPWlan 1  bPCIclkOff = 0 pAd->WlanFunCtrl.word = 0xff000523
[   62.440614] PllCtrl:0x2695555
[   62.441942] RX DESC ffff880085128000  size = 2048
[   62.442166] RTMP_TimerListAdd: add timer obj ffffc90001182d60!
[   62.442168] RTMP_TimerListAdd: add timer obj ffffc90001182dd0!
[   62.442169] RTMP_TimerListAdd: add timer obj ffffc90001182e40!
[   62.442170] RTMP_TimerListAdd: add timer obj ffffc90001182cf0!
[   62.442171] RTMP_TimerListAdd: add timer obj ffffc90001182ba0!
[   62.442172] RTMP_TimerListAdd: add timer obj ffffc90001182c10!
[   62.442173] RTMP_TimerListAdd: add timer obj ffffc9000114cd20!
[   62.442174] RTMP_TimerListAdd: add timer obj ffffc9000114cd90!
[   62.442175] RTMP_TimerListAdd: add timer obj ffffc9000114cc38!
[   62.442176] RTMP_TimerListAdd: add timer obj ffffc9000113bb30!
[   62.442177] RTMP_TimerListAdd: add timer obj ffffc9000113bba8!
[   62.442178] RTMP_TimerListAdd: add timer obj ffffc9000114cb58!
[   62.442179] RTMP_TimerListAdd: add timer obj ffffc9000114ce20!
[   62.444027] BBP_R105: BBPR105.field.EnableSIGRemodulation = 1, BBPR105.field.MLDFor2Stream = 0
[   62.444745] no file read method
[   62.444746] Read file "/etc/Wireless/RT2860STA/RT2860STA.dat" failed(errCode=-1)!
[   62.444747] 1. Phy Mode = 0
[   62.444748] 2. Phy Mode = 0
[   62.444752] NVM is Efuse and its size =1e[1e0-1fd] 
[   62.445990] 3. Phy Mode = 0
[   62.446190] AntCfgInit: primary/secondary ant 0/1
               CacheVal-OnOff:1, bPCIclkOff:0, WlanFunCtrl:0xff000523
[   62.464934] ==> RTMPWlan 1, bPCIclkOff = 0, pAd->WlanFunCtrl.word = 0xff000533
[   62.464935] <== RTMPWlan bPCIclkOff = 0, Exit because WLAN EN is already ON 
[   62.467992] MCS Set = 00 00 00 00 00
[   62.467996] <==== rt28xx_init, Status=0
[   62.468051] 0x1300 = 00073200
[   62.468052] RTMPrt3xSetPCIePowerLinkCtrl.===> 1e
[   62.514023] IPv6: ADDRCONF(NETDEV_UP): enp8s0: link is not ready
[   62.524133] BUG: unable to handle kernel paging request at 00007ffcc2728510
[   62.524182] IP: [<ffffffffa07dd1d0>] rt_ioctl_siwpmksa+0x90/0x150 [rt3290sta]
[   62.524236] PGD 95a1a067 PUD 959a5067 PMD 95a20067 PTE 800000008e8c3067
[   62.524282] Oops: 0001 [#1] PREEMPT SMP 
[   62.524311] Modules linked in: cfg80211 rt3290sta(PO) fuse snd_hda_codec_hdmi joydev mousedev intel_rapl iosf_mbi x86_pkg_temp_thermal nls_iso8859_1 intel_powerclamp nls_cp437 coretemp hp_wmi sparse_keymap uvcvideo rfkill videobuf2_vmalloc vfat videobuf2_memops fat videobuf2_core iTCO_wdt iTCO_vendor_support kvm v4l2_common evdev input_leds videodev psmouse mac_hid media serio_raw pcspkr i915 rtsx_pci_ms r8169 memstick mii drm_kms_helper snd_hda_codec_realtek snd_soc_rt286 fan thermal wmi snd_soc_rl6347a i2c_hid drm snd_hda_codec_generic snd_soc_core snd_compress snd_pcm_dmaengine battery ac dw_dmac snd_soc_sst_acpi snd_hda_intel hid dw_dmac_core ac97_bus video gpio_lynxpoint intel_gtt snd_hda_codec i2c_designware_platform 8250_dw spi_pxa2xx_platform syscopyarea mei_me sysfillrect i2c_designware_core
[   62.524820]  snd_hda_core sysimgblt hp_wireless snd_hwdep fjes acpi_pad snd_pcm fb_sys_fops snd_timer button i2c_algo_bit snd lpc_ich mei soundcore i2c_i801 shpchp intel_pch_thermal processor sch_fq_codel ip_tables x_tables ext4 crc16 mbcache jbd2 jitterentropy_rng sha256_ssse3 sha256_generic hmac drbg ansi_cprng algif_skcipher af_alg dm_crypt dm_mod sd_mod rtsx_pci_sdmmc atkbd libps2 crct10dif_pclmul crc32_pclmul crc32c_intel ahci libahci aesni_intel rtsx_pci aes_x86_64 lrw gf128mul glue_helper libata ablk_helper cryptd xhci_pci ehci_pci ehci_hcd xhci_hcd usbcore scsi_mod usb_common i8042 serio sdhci_acpi sdhci led_class mmc_core
[   62.525219] CPU: 0 PID: 807 Comm: wpa_supplicant Tainted: P           O    4.3.3-2-ARCH #1
[   62.525267] Hardware name: Hewlett-Packard HP 240 G3 Notebook PC/2334, BIOS F.36 12/18/2014
[   62.525315] task: ffff8801ca4ca940 ti: ffff8800959fc000 task.ti: ffff8800959fc000
[   62.525353] RIP: 0010:[<ffffffffa07dd1d0>]  [<ffffffffa07dd1d0>] rt_ioctl_siwpmksa+0x90/0x150 [rt3290sta]
[   62.525416] RSP: 0018:ffff8800959ffc58  EFLAGS: 00010297
[   62.525447] RAX: 0000000000000000 RBX: 00007ffcc2728510 RCX: 0000000000000000
[   62.525488] RDX: 0000000000005009 RSI: 0000000000000000 RDI: ffffc90001131000
[   62.525528] RBP: ffff8800959ffca0 R08: ffff8801d51e6600 R09: 0000000000000000
[   62.525568] R10: 0000000000000036 R11: ffffffffa07dd140 R12: 0000000000000000
[   62.527329] R13: ffffc90001131000 R14: ffff8801bad07000 R15: ffffffffa07dd140
[   62.528767] FS:  00007f1a34ef57c0(0000) GS:ffff8801dec00000(0000) knlGS:0000000000000000
[   62.530182] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   62.531316] CR2: 00007ffcc2728510 CR3: 0000000098bdc000 CR4: 00000000003406f0
[   62.532354] Stack:
[   62.533356]  ffff8801d809bb80 ffffffff811ba7a2 ffff880095b1be00 ffffffff8156de65
[   62.534585]  00000000226f393b ffff8801bd92d480 0000000000000000 ffffffff81676e48
[   62.535754]  ffff8800959ffe20 ffff8800959ffd28 ffffffff8156de93 0000000000000000
[   62.536924] Call Trace:
[   62.537973]  [<ffffffff811ba7a2>] ? __kmalloc+0x212/0x270
[   62.539176]  [<ffffffff8156de65>] ? ioctl_standard_iw_point+0x105/0x340
[   62.540337]  [<ffffffff8156de93>] ioctl_standard_iw_point+0x133/0x340
[   62.541475]  [<ffffffff811f8304>] ? mntput+0x24/0x40
[   62.542573]  [<ffffffff8156e2eb>] ioctl_standard_call+0x8b/0xe0
[   62.543565]  [<ffffffff8127a0c8>] ? security_capable+0x48/0x60
[   62.544666]  [<ffffffff8156ef60>] ? iw_handler_get_private+0x60/0x60
[   62.545775]  [<ffffffff8156e260>] ? call_commit_handler.part.3+0x30/0x30
[   62.546818]  [<ffffffff8156e1f4>] wireless_process_ioctl+0x154/0x190
[   62.547797]  [<ffffffff8156e548>] wext_handle_ioctl+0x78/0xd0
[   62.548858]  [<ffffffff8149a4d9>] dev_ioctl+0x2a9/0x590
[   62.550045]  [<ffffffff81463906>] sock_ioctl+0x126/0x290
[   62.551139]  [<ffffffff8127b3fe>] ? security_file_permission+0xae/0xc0
[   62.552223]  [<ffffffff811eb5f5>] do_vfs_ioctl+0x295/0x480
[   62.553516]  [<ffffffff811d98f3>] ? vfs_read+0x83/0x120
[   62.554877]  [<ffffffff811eb859>] SyS_ioctl+0x79/0x90
[   62.556196]  [<ffffffff81583d2e>] entry_SYSCALL_64_fastpath+0x12/0x71
[   62.557486] Code: bc 9c ff ff ff eb 75 48 85 db 0f 84 9d 00 00 00 48 83 3d 33 e0 06 00 02 41 89 c4 76 0e 48 83 3d 26 f9 06 00 00 0f 84 a3 00 00 00 <8b> 03 83 f8 03 74 69 83 f8 02 74 6d 83 f8 01 0f 94 c0 0f b6 c0 
[   62.560455] RIP  [<ffffffffa07dd1d0>] rt_ioctl_siwpmksa+0x90/0x150 [rt3290sta]
[   62.562150]  RSP <ffff8800959ffc58>
[   62.563890] CR2: 00007ffcc2728510
[   62.572067] ---[ end trace 174c5d19ef38ee89 ]---
[   70.478202] RT3290_AsicTxAlcGetAutoAgcOffset: Incorrect desired TSSI or current TSSI
[   74.482274] RT3290_AsicTxAlcGetAutoAgcOffset: Incorrect desired TSSI or current TSSI
[   78.486201] RT3290_AsicTxAlcGetAutoAgcOffset: Incorrect desired TSSI or current TSSI
[   82.491242] RT3290_AsicTxAlcGetAutoAgcOffset: Incorrect desired TSSI or current TSSI

我注意到这两行在调用跟踪之前出现了三次:

[   62.260034] no file read method
[   62.260037] Read file "/etc/Wireless/RT2860STA/RT2860STA.dat" failed(errCode=-1)!

它们由 RTMPReadParametersHook() 中的以下给定代码打印(src/os/linux/rt_profile.c 的第 96 行):

retval =RtmpOSFileRead(srcf, buffer, MAX_INI_BUFFER_SIZE);
if (retval > 0)
{
    RTMPSetProfileParameters(pAd, buffer);
    retval = NDIS_STATUS_SUCCESS;
}
else
    DBGPRINT(RT_DEBUG_ERROR, ("Read file \"%s\" failed(errCode=%d)!\n", src, retval));

因为下面给出的函数返回 -1:

1049int RtmpOSFileRead(RTMP_OS_sFD osfd, char *pDataPtr, int readLen)
1050{
1051        // The object must have a read method
1052        if (osfd->f_op && osfd->f_op->read)
1053        {
1054                return osfd->f_op->read(osfd,  pDataPtr, readLen, &osfd->f_pos);
1055        }
1056        else
1057        {
1058                DBGPRINT(RT_DEBUG_ERROR, ("no file read method\n"));
1059                return -1;
1060        }
1061}

加载模块的最终结果是整个系统变得不稳定。我无法联网,没有涉及 sudo 的命令有效,我无法通过 Ctrl-C/Z 停止这些命令,并且 DE 崩溃。系统的关闭也需要永远的时间。

我该如何解决这个问题并让 WiFi 正常工作?

对于这个冗长的问题,我们深表歉意,但如有任何帮助,我们将不胜感激。没有 WiFi 我就活不下去! :-(

更新:对调用跟踪进行更多研究,以下两行:

[   40.905333] BUG: unable to handle kernel paging request at 00007ffe7426fb20
[   40.905385] IP: [<ffffffffa09ac1d0>] rt_ioctl_siwpmksa+0x90/0x150 [rt3290sta]

谷歌搜索后,提出关闭过时的错误报告。

更新2:我提交了有关 NetworkManager 崩溃的错误报告这里。正如那里所建议的,我使用调试符号重新安装了 NetworkManager 并尝试获取跟踪。所以他们修复了 NM 中的错误,但与此同时,我与开发人员进行了交谈。据他们称,ralink供应商驱动程序无法正确支持nl80211,也不支持WEXT范围,后者导致NM崩溃。据他们称,他们检查了驱动程序代码,他们说驱动程序已经无法帮助,而且代码看起来很糟糕。他还补充说,我可以尝试让 nm 忽略驱动程序,并尝试使用 iw 或 iwconfig 静态配置它。

最终结果:错误修复后,NM 忽略了驱动程序,因此当我加载驱动程序时不会立即崩溃。但是当我跑步时wifi-menu,我遇到了同样的崩溃。

答案1

sp 是一个无意义的值。

[   40.103558] NetworkManager[332]: segfault at 8 ip 00000000004ca126 sp 00007ffca7ec45c8 error 4 in NetworkManager[400000+1c5000]

因此,愚蠢的方法可能是 objdump NetworkManager 并阅读其源代码以查找 [ip = 00000000004ca126] 触发段错误的原因。

相关内容