You are not logged in.

#1 2023-03-10 15:19:43

ThornyAnt
Member
Registered: 2023-03-10
Posts: 11

mt7921e module issue:Wifi stops working after sleep and resume[SOLVED]

Hi everyone,

The mt7921e kernel module is giving me trouble lately. Upon boot, wifi and ethernet both work fine. However, after the first sleep and resume, wifi and ethernet both stop working, with the ethernet icon turning blue.

When I try to put my computer to sleep for the second time, it fails to sleep properly and wakes up again. Shutdown also hangs, forcing me to do a force shutdown by holding the power button.

So far I've only gotten by by blacklisting mt7921e in /etc/modprobe.d, but I'm forced to only using ethernet since wifi does not work.

journalctl -b:
https://pastebin.com/b4HBDTeh

I'm using linux 6.2.2. Any help would be appreciated.

Last edited by ThornyAnt (2023-03-30 10:22:26)

Offline

#2 2023-03-10 15:55:05

seth
Member
Registered: 2012-09-03
Posts: 51,532

Re: mt7921e module issue:Wifi stops working after sleep and resume[SOLVED]

Mar 10 22:21:49 AsusOled kernel:  mt7921e_mac_reset+0xa2/0x2d0 [mt7921e 2f2e2db10637b7da96267bc81f5110c1f3b70c3a]
Mar 10 22:21:49 AsusOled kernel:  mt7921_mac_reset_work+0x97/0x180 [mt7921_common d841af8973b2639ff5e29b08e9de00be4d648c05]

and it's downhill from there.

1. You've at least NM and dhcpcd enabled, probably stop/disable dhcpcd
2. you're apparently using NM w/ iwd, did you try wpa_supplicant?
3. disable https://wiki.archlinux.org/title/Networ … domization
4. If there's a parallel windows installation, see the 3rd link below

Offline

#3 2023-03-11 03:16:55

ThornyAnt
Member
Registered: 2023-03-10
Posts: 11

Re: mt7921e module issue:Wifi stops working after sleep and resume[SOLVED]

Hi seth,
I've tried the 4 fixes you listed:
1. I've run:

systemctl disable dhcpcd.service

2. Actually I switched from wpa_supplicant to iwd for the NM backend because it was preventing me from accessing WiFi. When I switched back, the issue went from a blue ethernet symbol to a white ethernet symbol with a red "X", i.e. went from "No connections available" to inactive.
3. Set scanning randomization to "no", and wifi and ethernet randomization to "permanent".
4. I've had both hibernate and fast start disabled on my windows from the start. This time I turned off hibernate functionality completely in powershell:

powercfg /h off

None worked.

Log after the first fix: https://pastebin.com/bS5ERrJN
Log after all 4 fixes: https://pastebin.com/jmiLyMRy
Log after switching back from wpa_supplicant to iwd and retaining fixes 1, 3 and 4: https://pastebin.com/wYJMwA2D

Offline

#4 2023-03-11 08:37:04

seth
Member
Registered: 2012-09-03
Posts: 51,532

Re: mt7921e module issue:Wifi stops working after sleep and resume[SOLVED]

Mar 11 10:53:45 AsusOled kernel: pcieport 0000:00:1c.3: Data Link Layer Link Active not set in 1000 msec
Mar 11 10:53:45 AsusOled kernel: mt7921e 0000:2e:00.0: Unable to change power state from D3cold to D0, device inaccessible
Mar 11 10:53:45 AsusOled kernel: pcieport 10000:e0:1d.0: can't derive routing for PCI INT A
iommu=soft pcie_aspm=off

https://wiki.archlinux.org/title/Kernel_parameters

Offline

#5 2023-03-12 03:42:51

ThornyAnt
Member
Registered: 2023-03-10
Posts: 11

Re: mt7921e module issue:Wifi stops working after sleep and resume[SOLVED]

Hi seth,
Unfortunately changing the kernel parameters did not work.
Journal log: https://pastebin.com/SYSGf0YV

Offline

#6 2023-03-12 07:45:34

seth
Member
Registered: 2012-09-03
Posts: 51,532

Re: mt7921e module issue:Wifi stops working after sleep and resume[SOLVED]

Ftr, you're not alone: https://bugs.launchpad.net/ubuntu/+sour … ug/1975444
What if you disconnect the wifi, unload (modprobe -r) mt7921e, suspend, resume, load mt7921e and connect.
(Maybe we can workaround the condition this way)

Offline

#7 2023-03-12 16:11:45

ThornyAnt
Member
Registered: 2023-03-10
Posts: 11

Re: mt7921e module issue:Wifi stops working after sleep and resume[SOLVED]

Hi seth,
Managed to unload and load mt7921e with no problem (caused it to disappear and reappear in lsmod). However upon loading mt7921e with modprobe, I can't seem to detect any WiFi connections.

nmcli device wifi list

turns up nothing and doing

nmcli connection up

with an existing profile also failed. When I checked lspci, mt7921e was only listed under "kernel modules" and not "kernel driver in use", could that be the reason why?

Offline

#8 2023-03-12 16:32:56

seth
Member
Registered: 2012-09-03
Posts: 51,532

Re: mt7921e module issue:Wifi stops working after sleep and resume[SOLVED]

Mar 11 10:53:45 AsusOled kernel: mt7921e 0000:2e:00.0: Unable to change power state from D3cold to D0, device inaccessible

Any errors in dmes  when you're re-loading the module or when resuming (wrt 0000:2e:00.0)?
What's the state of "rfkill"?

Offline

#9 2023-03-13 15:54:54

ThornyAnt
Member
Registered: 2023-03-10
Posts: 11

Re: mt7921e module issue:Wifi stops working after sleep and resume[SOLVED]

Hi seth,
So turns out I had no problems unloading and loading the module as long as there was no suspension of the computer. Upon unloading, the wifi would be cut off, and rfkill would lose the following entry:

3 wlan      phy0           unblocked unblocked

Upon reloading, the wifi would return and rfkill would regain the entry.

The issue appears when I unload mt7921e, suspend and resume the computer, and then reload the module. The relevant dmesg log:

[  307.539305] mt7921e 0000:2e:00.0: ASIC revision: 79610010
[  307.630875] mt7921e 0000:2e:00.0: HW/SW Version: 0x8a108a10, Build Time: 20230117170855a

[  307.668110] mt7921e 0000:2e:00.0: WM Firmware Version: ____010000, Build Time: 20230117170942
[  310.018841] wlan1: authenticate with 44:94:fc:5c:65:0a
[  310.194481] wlan1: send auth to 44:94:fc:5c:65:0a (try 1/3)
[  310.198438] wlan1: authenticated
[  310.201239] wlan1: associate with 44:94:fc:5c:65:0a (try 1/3)
[  310.209613] wlan1: RX AssocResp from 44:94:fc:5c:65:0a (capab=0x411 status=0 aid=5)
[  310.239053] wlan1: associated
[  310.399196] IPv6: ADDRCONF(NETDEV_CHANGE): wlan1: link becomes ready
[  366.439131] wlan1: deauthenticating from 44:94:fc:5c:65:0a by local choice (Reason: 3=DEAUTH_LEAVING)
------"systemctl suspend"
[  403.529631] PM: suspend entry (s2idle)
[  403.531598] Filesystems sync: 0.001 seconds
[  405.167681] Freezing user space processes
[  405.169387] Freezing user space processes completed (elapsed 0.001 seconds)
[  405.169389] OOM killer disabled.
[  405.169390] Freezing remaining freezable tasks
[  405.170497] Freezing remaining freezable tasks completed (elapsed 0.001 seconds)
[  405.170498] printk: Suspending console(s) (use no_console_suspend to debug)
[  406.069700] ACPI: EC: interrupt blocked
[  415.714697] ACPI: EC: interrupt unblocked
[  417.799773] pcieport 0000:00:1c.3: Data Link Layer Link Active not set in 1000 msec
[  417.799855] pci 0000:2e:00.0: Unable to change power state from D3cold to D0, device inaccessible
[  417.866557] pcieport 10000:e0:1d.0: can't derive routing for PCI INT A
[  417.866560] nvme 10000:e1:00.0: PCI INT A: no GSI
[  417.938484] nvme nvme0: 8/0/0 default/read/poll queues
[  417.942655] nvme nvme0: Ignoring bogus Namespace Identifiers
[  418.123299] usb 3-2.3: reset full-speed USB device number 4 using xhci_hcd
[  418.203117] r8152 2-1.1:1.0 enp0s13f0u1u1: carrier on
[  418.236544] usb 3-2.3: PM: dpm_run_callback(): usb_dev_resume+0x0/0x20 returns -5
[  418.236552] usb 3-2.3: PM: failed to resume async: error -5
[  418.313397] usb 3-2.4: reset high-speed USB device number 6 using xhci_hcd
[  418.633929] mei_hdcp 0000:00:16.0-b638ab7e-94e2-4ea2-a552-d1c54b627f04: bound 0000:00:02.0 (ops i915_hdcp_component_ops [i915])
[  418.634366] OOM killer enabled.
[  418.634367] Restarting tasks ... 
[  418.634341] mei_pxp 0000:00:16.0-fbf6fcf1-96cf-4e2e-a6a6-1bab8cbe36b1: bound 0000:00:02.0 (ops i915_pxp_tee_component_ops [i915])
[  418.636370] usb 3-2.3: USB disconnect, device number 4
[  418.636425] done.
[  418.636443] random: crng reseeded on system resumption
[  418.655010] PM: suspend exit
[  418.772999] usb 3-2.3: new full-speed USB device number 11 using xhci_hcd
[  418.795147] IPv6: ADDRCONF(NETDEV_CHANGE): enp0s13f0u1u1: link becomes ready
[  418.795304] r8152 2-1.1:1.0 enp0s13f0u1u1: carrier on
[  418.873649] usb 3-2.3: config 1 has an invalid interface number: 3 but max is 2
[  418.873659] usb 3-2.3: config 1 has no interface number 2
[  418.874256] usb 3-2.3: New USB device found, idVendor=041e, idProduct=3272, bcdDevice= 1.00
[  418.874258] usb 3-2.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  418.874259] usb 3-2.3: Product: Pebble V3
[  418.874260] usb 3-2.3: Manufacturer: ACTIONS
[  418.874261] usb 3-2.3: SerialNumber: ㉕捤稰眷㕳愳㤷湲
[  418.880013] usb 3-2.3: 9:0: bogus dB values (-12800/-12700), disabling dB reporting
[  418.880684] input: ACTIONS Pebble V3 as /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2.3/3-2.3:1.3/0003:041E:3272.0007/input/input26
[  418.936449] hid-generic 0003:041E:3272.0007: input,hidraw2: USB HID v1.00 Device [ACTIONS Pebble V3] on usb-0000:00:14.0-2.3/input3
------"sudo modprobe mt7921e"
[  505.193077] mt7921e 0000:2e:00.0: Unable to change power state from D3cold to D0, device inaccessible
[  506.399067] mt7921e 0000:2e:00.0: driver own failed
[  506.399109] mt7921e: probe of 0000:2e:00.0 failed with error -5

It seems like there's no message in dmesg when the module in unloaded. As for rfkill, the entry does not reappear upon reloading the module this time. From what I can gather, even despite the module being unloaded from the kernel, the driver is still breaking during suspend as it can't be put to sleep properly. The full rfkill for reference:

ID TYPE      DEVICE              SOFT      HARD
 0 wlan      asus-wlan      unblocked unblocked
 1 bluetooth asus-bluetooth unblocked unblocked
 2 bluetooth hci0           unblocked unblocked
 3 wlan      phy0           unblocked unblocked

Offline

#10 2023-03-14 21:33:29

seth
Member
Registered: 2012-09-03
Posts: 51,532

Re: mt7921e module issue:Wifi stops working after sleep and resume[SOLVED]

The problem remains

[  505.193077] mt7921e 0000:2e:00.0: Unable to change power state from D3cold to D0, device inaccessible

The NIC dies with/during the S3 and doesn't return.

cat /sys/power/state

If you enter a lower state (eg. freeze or standby)

echo freeze > /sys/power/state

does the same thing happen?

Does the NIC show up in

cat /proc/acpi/wakeup

?

Do you have WOL enabled for the NIC? Can you enable WOL for the NIC?
(In the UEFI settings)

Offline

#11 2023-03-15 15:34:26

ThornyAnt
Member
Registered: 2023-03-10
Posts: 11

Re: mt7921e module issue:Wifi stops working after sleep and resume[SOLVED]

Hi seth,
Yes, the NIC shows up in

cat /proc/acpi/wakeup

but it is disabled. This is the full entry:

PXSX      S4    *disabled  pci:0000:2e:00.0

WOL doesn't seem to be in the UEFI settings. I followed an ASUS guide and enabled the network stack but not sure if that enables WOL.

A couple things I discovered:

cat /sys/power/state

returns

freeze mem disk

and

cat /sys/power/mem_sleep

returns

[s2idle] deep

From what I gather, does this mean that setting state to mem (what systemctl suspend does) does the same thing as setting state to freeze?
When I set mem_sleep to deep, then set state to mem, my computer was able to sleep and resume properly. When I set mem_sleep to deep, then executed systemctl suspend, the computer went to sleep but the fan started running uncomfortably loudly. Not sure what to make of this.

Offline

#12 2023-03-15 16:23:37

seth
Member
Registered: 2012-09-03
Posts: 51,532

Re: mt7921e module issue:Wifi stops working after sleep and resume[SOLVED]

https://wiki.archlinux.org/title/Power_ … end_method
https://www.kernel.org/doc/Documentatio … states.txt

When I set mem_sleep to deep, then set state to mem, my computer was able to sleep and resume properly. When I set mem_sleep to deep, then executed systemctl suspend, the computer went to sleep but the fan started running uncomfortably loudly.

Does this include a flub?
From the output above you've so far only entered s2idle?
And when going to actual "deep" sleep the S3 behavior depends on whether you use "systemctl suspend"??
If you set it to "deep" and /sys/power/state to "mem" and then resume, does "resume properly" include the wifi NIC?

"freeze" enters s2idle explicitly and was meant to test whether the NIC can recover from there.

Offline

#13 2023-03-16 15:15:50

ThornyAnt
Member
Registered: 2023-03-10
Posts: 11

Re: mt7921e module issue:Wifi stops working after sleep and resume[SOLVED]

Alright I've tested all the permutations:
/sys/power/mem_sleep = s2idle, echo mem > /sys/power/state: system goes to sleep but can't wake up, forced to force shutdown. journalctl stops after going to sleep.
/sys/power/mem_sleep = s2idle, echo freeze > /sys/powe/state: system goes to sleep but can't wake up, forced to force shutdown. journalctl stops after going to sleep.
/sys/power/mem_sleep = s2idle, systemctl suspend: system goes to sleep. When it wakes, wifi stops working. Original issue. journalctl shows the whole "unable to change power state" message.
/sys/power/mem_sleep = deep, echo freeze > /sys/power/state (out of curiosity): system goes to sleep but can't wake up, forced to force shutdown. journalctl stops after going to sleep.
/sys/power/mem_sleep = deep, echo mem > /sys/power/state: system goes to sleep and can wake. wifi works after resuming. no issue in journalctl.
/sys/power/mem_sleep = deep, systemctl suspend: system goes to sleep and can wake. wifi works after resuming. no issue in journalctl.

So I guess the issue is fixed? All that's left is for me to boot with the mem_sleep_default=deep kernel parameter.

Offline

#14 2023-03-16 15:47:56

ThornyAnt
Member
Registered: 2023-03-10
Posts: 11

Re: mt7921e module issue:Wifi stops working after sleep and resume[SOLVED]

Alright not quite out of the woods yet. After booting with the kernel parameter, the wifi does stay up upon the first suspend and resume, but the laptop fan starts going crazy. I can't seem to find anything in my journalctl that would indicate an error regarding the fans however. Also, after the second suspend, the whole computer can't resume -_-.

Offline

#15 2023-03-16 16:10:17

seth
Member
Registered: 2012-09-03
Posts: 51,532

Re: mt7921e module issue:Wifi stops working after sleep and resume[SOLVED]

Ftr.

Hardware name: ASUSTeK COMPUTER INC. Vivobook_ASUSLaptop X3500PC_K3500PC/X3500PC, BIOS X3500PC.300 10/04/2021

So deep sleep (actual S3) doesn't work properly and the device therefore defaults to S2idle, you probably want to check for a BIOS update to fix that hmm
About the wifi situation and s2idle, if you unload the module before the suspend (maybe even remove the device from the bus, see link below) and re-scan the bus after waking up… does that work?

https://stackoverflow.com/questions/323 … f-pcie-bus

Offline

#16 2023-03-29 15:40:34

ThornyAnt
Member
Registered: 2023-03-10
Posts: 11

Re: mt7921e module issue:Wifi stops working after sleep and resume[SOLVED]

Doesn't work unfortunately. Before and after updating my BIOS, I tried the following steps as you mentioned:

modprobe -r mt7921e
echo 1 > /sys/bus/pci/devices/0000:2e:00.0/remove

At this point, the wifi shuts off and 0000:2e:00.0 disappears from /sys/bus/pci/devices. I sleep my computer and reawaken it, then run:

echo 1 > /sys/bus/pci/rescan

However, the 0000:2e:00.0 directory doesn't reappear and the wifi doesn't return. It seems the rescan can't detect the wireless card?

Journal for reference: https://pastebin.com/i63t9EQJ

Offline

#17 2023-03-29 15:49:03

seth
Member
Registered: 2012-09-03
Posts: 51,532

Re: mt7921e module issue:Wifi stops working after sleep and resume[SOLVED]

Did the BIOS udpate change anything about the deep sleep / s2idle situation?

Offline

#18 2023-03-30 00:20:13

ThornyAnt
Member
Registered: 2023-03-10
Posts: 11

Re: mt7921e module issue:Wifi stops working after sleep and resume[SOLVED]

Oh! the BIOS update has worked to fix the fan issue with deep sleep so far. I'll test it out for the rest of today before marking it this thread as solved.

Offline

#19 2023-03-30 10:21:01

ThornyAnt
Member
Registered: 2023-03-10
Posts: 11

Re: mt7921e module issue:Wifi stops working after sleep and resume[SOLVED]

No issues so far! Thank you seth for all of the help, I greatly appreciate it. To those stumbling upon this post, this was the solution:
Update BIOS, then set the mem_sleep_default kernel parameter to 'deep'.

Offline

#20 2023-03-30 12:11:38

seth
Member
Registered: 2012-09-03
Posts: 51,532

Re: mt7921e module issue:Wifi stops working after sleep and resume[SOLVED]

Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Offline

Board footer

Powered by FluxBB