jakeday / linux-surface

Linux Kernel for Surface Devices
2.59k stars 241 forks source link

Wi-Fi drops after suspend #420

Open tmarkov opened 5 years ago

tmarkov commented 5 years ago

This is a problem that wasn't happening... until it suddenly started happening though no config changes on my side. But twice today few hours (out of 5-6 suspends), I didn't have Wi-Fi after wakeup. Network manager was showing nothing, and I couldn't get it back up with restarting NM, echo 1 > /sys/bus/pci/rescan, or removing/reloading mwifiex and mwifiex_pcie.

Here's journal: journal.txt

Last lines of journal seem relevant; perhaps it's fixable with configuration, would appreciate some help is so.

Also, I should note that my sleep script is a bit different from Jakeday's, but it's been working no problem until now:

#!/bin/bash
case $1 in
  pre)
    # unload the modules before going to sleep
    modprobe -r intel_ipts
    modprobe -r mei_me
    modprobe -r mei
    modprobe -r mwifiex_pcie;
    modprobe -r mwifiex;
    modprobe -r cfg80211;
    ;;
  post)
    while [ $(cat /proc/acpi/button/lid/LID0/state | grep closed | wc -l) = 1 ]
    do
      echo $(date) >> /var/log/resuspend
      echo freeze > /sys/power/state
    done
    modprobe -i intel_ipts
    modprobe -i mei_me
    modprobe -i cfg80211;
    modprobe -i mwifiex;
    modprobe -i mwifiex_pcie;
    ;;
esac
qzed commented 4 years ago

@kitakar5525

What I'm now confused about is, when disabling the L1 state, the only way to achieve S0ix is to apply the patch. Unloading mwifiex modules will not fix S0ixthinking

That might have something to do with the device missing a driver after unloading the module. As far as I know, there are some power-management limitations when a device has no driver.

So maybe we should add the patch.

kitakar5525 commented 4 years ago

On my Surface 3 (non-pro), I disable ASPM L1 state (L0s is still enabled) for daily usage (#456).

What I'm now confused about is, when disabling the L1 state, the only way to achieve S0ix is to apply the patch. Unloading mwifiex modules will not fix S0ix

Sorry but it seems to be true only on my Chromium OS 4.19 kernel… (The kernel may have other power management patches). Sorry to make everyone confused.

On Arch Linux kernel (both 5.4 and 4.19) + Surface patches, I need to re-enable L1 state before suspend to achieve S0ix even with the patch from sebanc.

jrevillard commented 4 years ago

I'm a bit lost guys ... I have an SB1 with 5.3.9 kernel and always loose wifi after suspend:

déc. 04 09:43:49  kernel: mwifiex_pcie 0000:03:00.0: Refused to change power state, currently in D3
déc. 04 09:43:49  kernel: mwifiex_pcie: PCI memory map Virt0: 000000002157d0bd PCI memory map Virt2: 00000000bd4e1c1a
déc. 04 09:43:49  kernel: mwifiex_pcie 0000:03:00.0: WLAN read winner status failed!
déc. 04 09:43:49  kernel: mwifiex_pcie 0000:03:00.0: info: _mwifiex_fw_dpc: unregister device

What's the way to go please ?

kitakar5525 commented 4 years ago

Reporting here that this issue "mwifiex crash after suspend" has been hopefully fixed fixed by workaround on all devices with the latest build (https://github.com/linux-surface/linux-surface/releases); the latest releases include the patch from sebanc (linux-surface/kernel@8dbbfa6)

Following issues remain unresolved regarding mwifiex driver: