Bug 216386 - rtw_8822be: Wifi stops working after resume
Summary: rtw_8822be: Wifi stops working after resume
Status: NEEDINFO
Alias: None
Product: Drivers
Classification: Unclassified
Component: network-wireless (show other bugs)
Hardware: All Linux
: P1 high
Assignee: drivers_network-wireless@kernel-bugs.osdl.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-20 09:16 UTC by Utkarsh Verma
Modified: 2023-03-18 15:36 UTC (History)
1 user (show)

See Also:
Kernel Version: 5.19.2
Subsystem:
Regression: Yes
Bisected commit-id:


Attachments

Description Utkarsh Verma 2022-08-20 09:16:41 UTC
I have an ASUS TUF FX505DT which has the RTL8822BE wifi card. I recently upgraded to kernel 5.19 and this issue started popping up.

When I close my laptop lid and let it sleep for a considerable amount of time, the wifi stops working the next time I open it, and I have to reboot my PC to get internet. This is annoying because I suspended my PC to continue with my work after some time quickly, and having to reboot defeats the purpose.

I tried removing and reloading the kernel module for this device as well, and it fails with the following dmesg log.

```
[ 4914.877037] rtw_8822be 0000:04:00.0: Unable to change power state from D3cold to D0, device inaccessible
[ 4914.886333] rtw_8822be 0000:04:00.0: mac power on failed
[ 4914.886342] rtw_8822be 0000:04:00.0: failed to power on mac
[ 4914.886344] rtw_8822be 0000:04:00.0: failed to setup chip efuse info
[ 4914.886348] rtw_8822be 0000:04:00.0: failed to setup chip information
[ 4914.892027] rtw_8822be 0000:04:00.0: Firmware version 27.2.0, H2C version 13
[ 4914.922150] rtw_8822be: probe of 0000:04:00.0 failed with error -114
```
Comment 1 Artem S. Tashkinov 2022-08-26 06:52:24 UTC
CC'ing Ping-Ke Shih - please check.

OP, would be great if you performed git bisect:

https://docs.kernel.org/admin-guide/bug-bisect.html
https://ldpreload.com/blog/git-bisect-run
https://wiki.gentoo.org/wiki/Kernel_git-bisect
Comment 2 Ping-Ke Shih 2022-08-29 02:08:27 UTC
>  rtw_8822be 0000:04:00.0: Unable to change power state from D3cold to D0,
>  device inaccessible


That means card loss, so I suggest to turn off ASPM via module parameter
disable_aspm=y


I'm trying to reproduce this issue in my side, but I can't.
Could you also share the old kernel version you used? 
Then, I can dig deeper to see which patch can cause this issue.
Comment 3 Utkarsh Verma 2022-08-31 15:54:25 UTC
Wouldn't turning off aspm lead to battery drain during suspend?

Also, the kernel on which I faced this issue was 5.19.2 as far as I can remember.
Comment 4 Ping-Ke Shih 2022-09-01 00:24:41 UTC
> Wouldn't turning off aspm lead to battery drain during suspend?

During suspend, wifi card turns off power entirely, no matter with/without aspm.

This is an experiment to bisect which causes this symptom.
Please set disable_aspm=y and cold reboot before suspend.

> the kernel on which I faced this issue was 5.19.2 as far as I can remember.

Do you remember the kernel version that works before you upgrade to 5.19.2?
Can 5.18 work well?
Comment 5 Utkarsh Verma 2022-09-03 06:41:29 UTC
Yes, it used to work on kernel 5.18 versions. I used disable_aspm=y on kernel 5.19.6 and WiFi worked fine after 8 hours of suspension. Still not sure if this was fixed in kernel 5.19.6, therefore, I'll re-enable aspm and update here in a couple of days of usage.
Comment 6 Utkarsh Verma 2022-09-11 16:38:51 UTC
Okay, so after some prolonged usage, I noticed that `disable_aspm=y` in the kernel cmdline didn't affect anything. I got the same issue with and without it on kernel 5.19.7.

```
$ uname -a
Linux metia 5.19.7-arch1-1 #1 SMP PREEMPT_DYNAMIC Mon, 05 Sep 2022 18:09:09 +0000 x86_64 GNU/Linux
```

Here are the details:
**Without `disable_aspm=y`**
root=/dev/nvme0n1p4 resume=/dev/nvme0n1p6 rw quiet bgrt_disable i8042.noaux i8042.nomux iommu.passthrough=1

dmesg log: https://pastebin.com/7b8vd9Jh

**With `disable_aspm=y`**
root=/dev/nvme0n1p4 resume=/dev/nvme0n1p6 rw quiet bgrt_disable i8042.noaux i8042.nomux iommu.passthrough=1 disable_aspm=y 

dmesg log: https://pastebin.com/sCakbm98
Comment 7 Ping-Ke Shih 2022-09-12 07:36:55 UTC
I checked patches from 5.18 to 5.19.6. It seems no significant patch could cause this issue. Could you help to check if 5.18 really work well for you?


Another try is to set module parameter: disable_lps_deep=y
or, use 'iw wlan0 set power_save off' to turn off power saving.
Please try if this can help you.
Comment 8 Utkarsh Verma 2023-03-12 13:48:01 UTC
Hi, this issue stopped happening for me for the past 6 months, however, it resurfaced again in the last month on kernel v6.x.x. Based on the previous suggestion, I added this to `/etc/modprobe.d/rtw88.conf` and now WiFi works after waking up.

```
options rtw88_core disable_lps_deep=y 
options rtw88_pci disable_msi=y disable_aspm=y 
```

Please let me know if you need additional info.
Comment 9 Utkarsh Verma 2023-03-12 13:48:50 UTC
(In reply to Utkarsh Verma from comment #8)
> Hi, this issue stopped happening for me for the past 6 months, however, it
> resurfaced again in the last month on kernel v6.x.x. Based on the previous
> suggestion, I added this to `/etc/modprobe.d/rtw88.conf` and now WiFi works
> after waking up.
> 
> ```
> options rtw88_core disable_lps_deep=y 
> options rtw88_pci disable_msi=y disable_aspm=y 
> ```
> 
> Please let me know if you need additional info.

Just want to add that currently I am on Linux kernel 6.2.2-arch1-1.
Comment 10 Utkarsh Verma 2023-03-18 15:36:58 UTC
After a couple of days of usage, I've observed that disabling aspm did not fix the issue. The WiFi still fails on wake. 
Here is what dmesg has to say about the failure:

```
[19979.135305] rtw_8822be 0000:04:00.0: failed to poll offset=0x5 mask=0x2 value=0x0
[19979.135315] rtw_8822be 0000:04:00.0: mac power on failed
[19979.135317] rtw_8822be 0000:04:00.0: failed to power on mac
[19981.136260] rtw_8822be 0000:04:00.0: failed to poll offset=0x5 mask=0x2 value=0x0
[19981.136271] rtw_8822be 0000:04:00.0: mac power on failed
[19981.136274] rtw_8822be 0000:04:00.0: failed to power on mac
[19983.137886] rtw_8822be 0000:04:00.0: failed to poll offset=0x5 mask=0x2 value=0x0
[19983.137901] rtw_8822be 0000:04:00.0: mac power on failed
[19983.137904] rtw_8822be 0000:04:00.0: failed to power on mac
[19985.139122] rtw_8822be 0000:04:00.0: failed to poll offset=0x5 mask=0x2 value=0x0
[19985.139146] rtw_8822be 0000:04:00.0: mac power on failed
[19985.139149] rtw_8822be 0000:04:00.0: failed to power on mac
[19997.009524] rtw_8822be 0000:04:00.0: failed to poll offset=0x5 mask=0x2 value=0x0
[19997.009536] rtw_8822be 0000:04:00.0: mac power on failed
[19997.009538] rtw_8822be 0000:04:00.0: failed to power on mac
```

Note You need to log in before you can comment on or make changes to this bug.