Bug 202563

Summary: MT7630E after the computer is turn to "sleep mode": unable to reconnect to Wifi network
Product: Networking Reporter: Julien Deniau (julien.deniau)
Component: WirelessAssignee: networking_wireless (networking_wireless)
Status: RESOLVED PATCH_ALREADY_AVAILABLE    
Severity: normal CC: iakuninaa, julien.deniau, lorenzo.bianconi83, luca.trombin, mario.limonciello, mathieu.lapierre.bouchard, nbernath
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 4.20.6 Subsystem:
Regression: No Bisected commit-id:
Attachments: 0001-mt76x0e-add-pm-support.patch
0002-mt76x0e-add-pm-support.patch
0001-mt76-mt76x0u-fix-resume.patch

Description Julien Deniau 2019-02-11 20:44:28 UTC
When the computer goes into sleep mode, and wakes up, the Wifi is unable to reconnect.


Distribution: Fedora 29 x86_64 with kernel 4.20.6

Output of `cat /proc/modules | grep mt76x`
mt76x0e 20480 0 - Live 0xffffffffc0c85000
mt76x0_common 81920 1 mt76x0e, Live 0xffffffffc0f93000
mt76x02_lib 57344 2 mt76x0e,mt76x0_common, Live 0xffffffffc0ff2000
mt76 45056 3 mt76x0e,mt76x0_common,mt76x02_lib, Live 0xffffffffc0fd5000
mac80211 933888 4 mt76x0e,mt76x0_common,mt76x02_lib,mt76, Live 0xffffffffc0eae000
cfg80211 770048 2 mt76x02_lib,mac80211, Live 0xffffffffc0cde000

Output of `lspci -vvv | grep mt76x`
04:00.0 Network controller: MEDIATEK Corp. MT7630e 802.11bgn Wireless Network Adapter
	DeviceName: WLAN
	Subsystem: Hewlett-Packard Company Device 197c
	Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0, Cache Line Size: 64 bytes
	Interrupt: pin A routed to IRQ 18
	Region 0: Memory at b0600000 (32-bit, non-prefetchable) [size=1M]
	Capabilities: [40] Power Management version 3
		Flags: PMEClk- DSI- D1- D2- AuxCurrent=375mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
		Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+
		Address: 0000000000000000  Data: 0000
	Capabilities: [70] Express (v2) Endpoint, MSI 00
		DevCap:	MaxPayload 128 bytes, PhantFunc 0, Latency L0s <4us, L1 unlimited
			ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset- SlotPowerLimit 10.000W
		DevCtl:	CorrErr- NonFatalErr- FatalErr- UnsupReq-
			RlxdOrd+ ExtTag- PhantFunc- AuxPwr- NoSnoop-
			MaxPayload 128 bytes, MaxReadReq 512 bytes
		DevSta:	CorrErr+ NonFatalErr- FatalErr- UnsupReq+ AuxPwr+ TransPend-
		LnkCap:	Port #0, Speed 2.5GT/s, Width x1, ASPM L0s L1, Exit Latency L0s <1us, L1 unlimited
			ClockPM+ Surprise- LLActRep- BwNot- ASPMOptComp+
		LnkCtl:	ASPM L1 Enabled; RCB 64 bytes Disabled- CommClk+
			ExtSynch- ClockPM+ AutWidDis- BWInt- AutBWInt-
		LnkSta:	Speed 2.5GT/s (ok), Width x1 (ok)
			TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
		DevCap2: Completion Timeout: Range ABCD, TimeoutDis+, LTR+, OBFF Via message/WAKE#
			 AtomicOpsCap: 32bit- 64bit- 128bitCAS-
		DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR+, OBFF Disabled
			 AtomicOpsCtl: ReqEn-
		LnkCtl2: Target Link Speed: 2.5GT/s, EnterCompliance- SpeedDis-
			 Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
			 Compliance De-emphasis: -6dB
		LnkSta2: Current De-emphasis Level: -6dB, EqualizationComplete-, EqualizationPhase1-
			 EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
	Capabilities: [100 v1] Advanced Error Reporting
		UESta:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
		UEMsk:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
		UESvrt:	DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
		CESta:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- AdvNonFatalErr+
		CEMsk:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- AdvNonFatalErr+
		AERCap:	First Error Pointer: 00, ECRCGenCap+ ECRCGenEn- ECRCChkCap+ ECRCChkEn-
			MultHdrRecCap- MultHdrRecEn- TLPPfxPres- HdrLogCap-
		HeaderLog: 00000000 00000000 00000000 00000000
	Capabilities: [140 v1] Device Serial Number 00-00-06-7c-56-d4-4d-fc
	Capabilities: [150 v1] Latency Tolerance Reporting
		Max snoop latency: 71680ns
		Max no snoop latency: 71680ns
	Kernel driver in use: mt76x0e
	Kernel modules: mt76x0e



Output of `ifconfig` BEFORE going to sleep mode:
wlo1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.94  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 2001:41d0:fc66:6f00:984f:9570:4bd2:3b15  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::bb46:a648:40ba:89b0  prefixlen 64  scopeid 0x20<link>
        ether fc:4d:d4:56:7c:06  txqueuelen 1000  (Ethernet)
        RX packets 301315  bytes 436715996 (416.4 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 154996  bytes 14576768 (13.9 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0



Output of `ifconfig` AFTER going to sleep mode:
wlo1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 6a:cd:60:ae:a9:d4  txqueuelen 1000  (Ethernet)
        RX packets 510  bytes 562556 (549.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 400  bytes 51984 (50.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

(it seems that the wlo1 interface is not "RUNNING" anymore)

output of `journalctl -xe` after waking up:
févr. 11 21:36:07 jdeniau-fedora NetworkManager[1057]: <info>  [1549917367.2666] policy: auto-activating connection 'rogden 1' (6a086207-a1f8-4aa5-8025-5e7f48f4c689)
févr. 11 21:36:07 jdeniau-fedora NetworkManager[1057]: <info>  [1549917367.2684] device (wlo1): Activation: starting connection 'rogden 1' (6a086207-a1f8-4aa5-8025-5e7f48f4c689)
févr. 11 21:36:07 jdeniau-fedora NetworkManager[1057]: <info>  [1549917367.2686] device (wlo1): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
févr. 11 21:36:07 jdeniau-fedora NetworkManager[1057]: <info>  [1549917367.2698] manager: NetworkManager state is now CONNECTING
févr. 11 21:36:07 jdeniau-fedora NetworkManager[1057]: <info>  [1549917367.2710] device (wlo1): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
févr. 11 21:36:07 jdeniau-fedora NetworkManager[1057]: <info>  [1549917367.2718] device (wlo1): Activation: (wifi) access point 'rogden 1' has security, but secrets are required.
févr. 11 21:36:07 jdeniau-fedora NetworkManager[1057]: <info>  [1549917367.2718] device (wlo1): state change: config -> need-auth (reason 'none', sys-iface-state: 'managed')
févr. 11 21:36:07 jdeniau-fedora NetworkManager[1057]: <info>  [1549917367.2752] device (wlo1): state change: need-auth -> prepare (reason 'none', sys-iface-state: 'managed')
févr. 11 21:36:07 jdeniau-fedora NetworkManager[1057]: <info>  [1549917367.2757] device (wlo1): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
févr. 11 21:36:07 jdeniau-fedora NetworkManager[1057]: <info>  [1549917367.2761] device (wlo1): Activation: (wifi) connection 'rogden 1' has security, and secrets exist.  No new secrets needed.
févr. 11 21:36:07 jdeniau-fedora NetworkManager[1057]: <info>  [1549917367.2761] Config: added 'ssid' value 'rogden'
févr. 11 21:36:07 jdeniau-fedora NetworkManager[1057]: <info>  [1549917367.2761] Config: added 'scan_ssid' value '1'
févr. 11 21:36:07 jdeniau-fedora NetworkManager[1057]: <info>  [1549917367.2761] Config: added 'bgscan' value 'simple:30:-80:86400'
févr. 11 21:36:07 jdeniau-fedora NetworkManager[1057]: <info>  [1549917367.2761] Config: added 'key_mgmt' value 'WPA-PSK WPA-PSK-SHA256'
févr. 11 21:36:07 jdeniau-fedora NetworkManager[1057]: <info>  [1549917367.2761] Config: added 'psk' value '<hidden>'
févr. 11 21:36:07 jdeniau-fedora NetworkManager[1057]: <info>  [1549917367.2898] device (wlo1): supplicant interface state: ready -> scanning
févr. 11 21:36:08 jdeniau-fedora audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=NetworkManager-dispatcher comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
févr. 11 21:36:09 jdeniau-fedora audit[5933]: USER_AUTH pid=5933 uid=1000 auid=1000 ses=3 msg='op=PAM:authentication grantors=pam_unix acct="root" exe="/usr/bin/su" hostname=jdeniau-fedora addr=? terminal=pts/1 res=success'
févr. 11 21:36:09 jdeniau-fedora audit[5933]: USER_ACCT pid=5933 uid=1000 auid=1000 ses=3 msg='op=PAM:accounting grantors=pam_unix,pam_localuser acct="root" exe="/usr/bin/su" hostname=jdeniau-fedora addr=? terminal=pts/1 res>
févr. 11 21:36:09 jdeniau-fedora su[5933]: (to root) jdeniau on pts/1
févr. 11 21:36:09 jdeniau-fedora audit[5933]: CRED_ACQ pid=5933 uid=1000 auid=1000 ses=3 msg='op=PAM:setcred grantors=pam_unix acct="root" exe="/usr/bin/su" hostname=jdeniau-fedora addr=? terminal=pts/1 res=success'
févr. 11 21:36:09 jdeniau-fedora su[5933]: pam_systemd(su-l:session): Cannot create session: Already running in a session or user slice
févr. 11 21:36:09 jdeniau-fedora su[5933]: pam_unix(su-l:session): session opened for user root by (uid=1000)
févr. 11 21:36:09 jdeniau-fedora audit[5933]: USER_START pid=5933 uid=1000 auid=1000 ses=3 msg='op=PAM:session_open grantors=pam_keyinit,pam_keyinit,pam_limits,pam_systemd,pam_unix acct="root" exe="/usr/bin/su" hostname=jden>
févr. 11 21:36:10 jdeniau-fedora polkitd[1032]: Registered Authentication Agent for unix-process:5959:216794 (system bus name :1.594 [flatpak --installations], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, loc>
févr. 11 21:36:10 jdeniau-fedora polkitd[1032]: Unregistered Authentication Agent for unix-process:5959:216794 (system bus name :1.594, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (discon>
févr. 11 21:36:30 jdeniau-fedora audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=fprintd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
févr. 11 21:36:32 jdeniau-fedora NetworkManager[1057]: <warn>  [1549917392.0896] device (wlo1): Activation: (wifi) association took too long, failing activation
févr. 11 21:36:32 jdeniau-fedora NetworkManager[1057]: <info>  [1549917392.0897] device (wlo1): state change: config -> failed (reason 'ssid-not-found', sys-iface-state: 'managed')
févr. 11 21:36:32 jdeniau-fedora NetworkManager[1057]: <info>  [1549917392.0907] manager: NetworkManager state is now CONNECTED_LOCAL
févr. 11 21:36:32 jdeniau-fedora NetworkManager[1057]: <warn>  [1549917392.0919] device (wlo1): Activation: failed for connection 'rogden 1'
févr. 11 21:36:32 jdeniau-fedora NetworkManager[1057]: <info>  [1549917392.0924] device (wlo1): state change: failed -> disconnected (reason 'none', sys-iface-state: 'managed')
févr. 11 21:36:32 jdeniau-fedora kernel: IPv6: ADDRCONF(NETDEV_UP): wlo1: link is not ready
févr. 11 21:36:32 jdeniau-fedora gnome-shell[1781]: An active wireless connection, in infrastructure mode, involves no access point?
févr. 11 21:36:32 jdeniau-fedora gnome-shell[1781]: An active wireless connection, in infrastructure mode, involves no access point?
févr. 11 21:36:32 jdeniau-fedora gnome-shell[1781]: An active wireless connection, in infrastructure mode, involves no access point?
févr. 11 21:36:32 jdeniau-fedora kernel: mt76x0e 0000:04:00.0: TX DMA did not stop
févr. 11 21:36:32 jdeniau-fedora NetworkManager[1057]: <info>  [1549917392.4888] device (wlo1): set-hw-addr: set MAC address to D2:99:B5:00:FF:74 (scanning)
févr. 11 21:36:32 jdeniau-fedora kernel: IPv6: ADDRCONF(NETDEV_UP): wlo1: link is not ready
févr. 11 21:36:32 jdeniau-fedora NetworkManager[1057]: <info>  [1549917392.6938] device (wlo1): supplicant interface state: scanning -> disconnected
févr. 11 21:36:32 jdeniau-fedora NetworkManager[1057]: <info>  [1549917392.6942] device (wlo1): supplicant interface state: disconnected -> disabled
févr. 11 21:36:32 jdeniau-fedora NetworkManager[1057]: <info>  [1549917392.7079] device (wlo1): supplicant interface state: disabled -> disconnected
févr. 11 21:36:36 jdeniau-fedora wpa_supplicant[1201]: wlo1: Reject scan trigger since one is already pending
Comment 1 Lorenzo Bianconi 2019-02-12 22:38:21 UTC
mt76x0e does not currently support suspend/resume. I will work on it soon
Comment 2 Julien Deniau 2019-02-13 06:44:28 UTC
Good to know.

Thank you!
Comment 3 Lorenzo Bianconi 2019-02-18 13:48:04 UTC
Created attachment 281179 [details]
0001-mt76x0e-add-pm-support.patch
Comment 4 Lorenzo Bianconi 2019-02-18 13:50:54 UTC
Could you please try attached patch? Please note it is just compiled and not tested since I have no mt7630e adapter
Comment 5 Julien Deniau 2019-02-18 20:47:27 UTC
Hi,

I got the following error when trying to compile : 

ERROR: "mt76_tx_free" [drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0e.ko] undefined! 

I tried different things:
- Compiling the 5.0.0-rc7 kernel without the patch, it does work
- Compiling then the same kernel with the patch, I got this error
- Launching `make drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0e.ko` (but it should do the same thing if I understood corerctly), and got the same error.

I tried investigate in the pci.c file myself:
it does compile when I copy the missing methods from "../tx.c"`, but when I try to load the modules with "rmmod mt76x0e; insmod path/to/mt76x0e.ko", I got the following error: "Invalid module format".
Comment 6 Lorenzo Bianconi 2019-02-18 22:15:49 UTC
Created attachment 281199 [details]
0002-mt76x0e-add-pm-support.patch

I added missing EXPORT_SYMBOL_GPL for mt76_tx_free in 0002-mt76x0e-add-pm-support.patch
Comment 7 Julien Deniau 2019-02-19 19:27:53 UTC
Hi,

I recompiled the kernel with this patch.
The wifi does work on startup, but does not work after a sleep mode.

The result of `journaltcl -xe` is : 
févr. 19 20:20:00 jdeniau-fedora NetworkManager[1058]: <warn>  [1550604000.4062] device (wlo1): Activation: (wifi) association took too long, failing activation
févr. 19 20:20:00 jdeniau-fedora NetworkManager[1058]: <info>  [1550604000.4063] device (wlo1): state change: config -> failed (reason 'ssid-not-found', sys-iface-state: 'managed')
févr. 19 20:20:00 jdeniau-fedora NetworkManager[1058]: <info>  [1550604000.4068] manager: NetworkManager state is now CONNECTED_GLOBAL
févr. 19 20:20:00 jdeniau-fedora NetworkManager[1058]: <warn>  [1550604000.4077] device (wlo1): Activation: failed for connection 'rogden 1'
févr. 19 20:20:00 jdeniau-fedora NetworkManager[1058]: <info>  [1550604000.4081] device (wlo1): state change: failed -> disconnected (reason 'none', sys-iface-state: 'managed')
févr. 19 20:20:00 jdeniau-fedora gnome-shell[1744]: An active wireless connection, in infrastructure mode, involves no access point?
févr. 19 20:20:00 jdeniau-fedora gnome-shell[1744]: An active wireless connection, in infrastructure mode, involves no access point?
févr. 19 20:20:00 jdeniau-fedora gnome-shell[1744]: An active wireless connection, in infrastructure mode, involves no access point?
févr. 19 20:20:01 jdeniau-fedora kernel:  0000:04:00.0: TX DMA did not stop
févr. 19 20:20:01 jdeniau-fedora kernel: mt76x0e 0000:04:00.0: Warning: MAC RX did not stop!
févr. 19 20:20:01 jdeniau-fedora kernel: mt76x0e 0000:04:00.0: TX DMA did not stop
févr. 19 20:20:01 jdeniau-fedora NetworkManager[1058]: <info>  [1550604001.8232] device (wlo1): set-hw-addr: set MAC address to 1A:76:18:BF:8A:D1 (scanning)
févr. 19 20:20:02 jdeniau-fedora NetworkManager[1058]: <info>  [1550604002.0326] device (wlo1): supplicant interface state: scanning -> disconnected
févr. 19 20:20:02 jdeniau-fedora NetworkManager[1058]: <info>  [1550604002.0345] device (wlo1): supplicant interface state: disconnected -> disabled
févr. 19 20:20:02 jdeniau-fedora NetworkManager[1058]: <info>  [1550604002.0507] device (wlo1): supplicant interface state: disabled -> disconnected


And `ifconfig`: 
wlo1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 1a:76:18:bf:8a:d1  txqueuelen 1000  (Ethernet)
        RX packets 3262  bytes 3113328 (2.9 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2723  bytes 1125153 (1.0 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


Apparently, the message is slighty different this time, but is there a way to be sure that the patch is applied ? (I never compiled a kernel before, especially with a patch applied ! (but I use git on a daily basis so no problem about that))
Comment 8 Lorenzo Bianconi 2019-02-19 22:41:18 UTC
you can do:
- git am <patch>
- make
- make modules_install
- make install
Comment 9 Julien Deniau 2019-02-20 06:23:18 UTC
OK, that's what I did.
Comment 10 Mathieu Bouchard 2021-01-24 17:54:48 UTC
Last month, I started using this driver instead of the 3rd party mt7630e driver, because I upgraded from Ubuntu 18.04 to 20.04 (18.04 doesn't have mt76x0e), but then I hit the problem described in this bug report. My uname -rvmpio is "5.8.0-40-generic #45~20.04.1-Ubuntu SMP Fri Jan 15 11:35:04 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux" and even though the fix is two years old, it does not seem to have been applied (from a user's perspective).

My laptop is an Asus x455wa, lspci says "03:00.0 Network controller: MEDIATEK Corp. MT7630e 802.11bgn Wireless Network Adapter". After suspend+resume, driver stays loaded but no network is selected and the list of available networks is empty and any attempt to refresh it fails.

But if I rmmod mt76x0e and modprobe mt76x0e again, nothing happens. But at that moment, if I modprobe the 3rd-party mt7630e driver instead, wifi works again without having to restart the computer, even without redoing rmmod mt76x0e. That other driver is the one at https://github.com/neurobin/MT7630E
Comment 11 Lorenzo Bianconi 2021-01-24 21:58:47 UTC
Created attachment 294833 [details]
0001-mt76-mt76x0u-fix-resume.patch

Hi Mathieu,

can you please try the attached patch? I added some missing bits from sdk but I have just compiled it since I do not have the adapter.
Comment 12 Mathieu Bouchard 2021-01-31 17:22:54 UTC
Although I know C language and how to compile things and how to operate the `patch` command, I haven't compiled a kernel since 1998 (back when I had 8 megs of RAM) and won't do it again. But I could be compiling just this driver if I get told how to do it. E.g. a certain `git clone` or `tar xf` of some download (or an apt command in ubuntu that really downloads Linux 5.8 and not 5.4), then cd into a certain folder and run a list of commands such as `make` and `modprobe`... the only kernel driver I've compiled in recent years is https://github.com/neurobin/MT7630E , but that's outside of the kernel tree so that tells me nothing about how to compile a single driver from the kernel tree.
Comment 13 Lorenzo Bianconi 2021-02-01 15:50:37 UTC
(In reply to Mathieu Bouchard from comment #12)
> Although I know C language and how to compile things and how to operate the
> `patch` command, I haven't compiled a kernel since 1998 (back when I had 8
> megs of RAM) and won't do it again. But I could be compiling just this
> driver if I get told how to do it. E.g. a certain `git clone` or `tar xf` of
> some download (or an apt command in ubuntu that really downloads Linux 5.8
> and not 5.4), then cd into a certain folder and run a list of commands such
> as `make` and `modprobe`... the only kernel driver I've compiled in recent
> years is https://github.com/neurobin/MT7630E , but that's outside of the
> kernel tree so that tells me nothing about how to compile a single driver
> from the kernel tree.

Can you please try this repo [0]? I modified the Makefile to compile mt76 as external kernel module. (just compiled, not tested)

[0] https://github.com/LorenzoBianconi/mt76/tree/openwrt-19.07-makefile
Comment 14 Mathieu Bouchard 2021-02-01 17:13:31 UTC
Doing `make -C /lib/modules/$(uname -r)/build M=$PWD` , where uname -r currently gives 5.8.0-41-generic ; I get this error message :

  CC [M]  /home/matju/src/mt76/agg-rx.o
/home/matju/src/mt76/agg-rx.c: In function `mt76_rx_aggr_stop':
/home/matju/src/mt76/agg-rx.c:293:2: error: implicit declaration of function `rcu_swap_protected' [-Werror=implicit-function-declaration]
  293 |  rcu_swap_protected(wcid->aggr[tidno], tid,
      |  ^~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [scripts/Makefile.build:290 : /home/matju/src/mt76/agg-rx.o] Erreur 1
make: *** [Makefile:1780 : /home/matju/src/mt76] Erreur 2
make : on quitte le répertoire « /usr/src/linux-headers-5.8.0-41-generic »

I tried removing -Werror from your Makefile, but the default still treats this warning as an error, so I added -Wno-error instead, which made no difference, I had to write explicitly -Wno-error=implicit-function-declaration , but then it seems that this is not just a header problem after all, because then I got this :

  MODPOST /home/matju/src/mt76/Module.symvers
ERROR: modpost: "rcu_swap_protected" [/home/matju/src/mt76/mt76.ko] undefined!
make[1]: *** [scripts/Makefile.modpost:111 : /home/matju/src/mt76/Module.symvers] Erreur 1
make[1]: *** Suppression du fichier « /home/matju/src/mt76/Module.symvers »
make: *** [Makefile:1693 : modules] Erreur 2
make : on quitte le répertoire « /usr/src/linux-headers-5.8.0-41-generic »
Comment 15 Lorenzo Bianconi 2021-02-01 19:21:51 UTC
(In reply to Mathieu Bouchard from comment #14)
> Doing `make -C /lib/modules/$(uname -r)/build M=$PWD` , where uname -r
> currently gives 5.8.0-41-generic ; I get this error message :
> 
>   CC [M]  /home/matju/src/mt76/agg-rx.o
> /home/matju/src/mt76/agg-rx.c: In function `mt76_rx_aggr_stop':
> /home/matju/src/mt76/agg-rx.c:293:2: error: implicit declaration of function
> `rcu_swap_protected' [-Werror=implicit-function-declaration]
>   293 |  rcu_swap_protected(wcid->aggr[tidno], tid,
>       |  ^~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> make[1]: *** [scripts/Makefile.build:290 : /home/matju/src/mt76/agg-rx.o]
> Erreur 1
> make: *** [Makefile:1780 : /home/matju/src/mt76] Erreur 2
> make : on quitte le répertoire « /usr/src/linux-headers-5.8.0-41-generic »
> 
> I tried removing -Werror from your Makefile, but the default still treats
> this warning as an error, so I added -Wno-error instead, which made no
> difference, I had to write explicitly
> -Wno-error=implicit-function-declaration , but then it seems that this is
> not just a header problem after all, because then I got this :
> 
>   MODPOST /home/matju/src/mt76/Module.symvers
> ERROR: modpost: "rcu_swap_protected" [/home/matju/src/mt76/mt76.ko]
> undefined!
> make[1]: *** [scripts/Makefile.modpost:111 :
> /home/matju/src/mt76/Module.symvers] Erreur 1
> make[1]: *** Suppression du fichier « /home/matju/src/mt76/Module.symvers »
> make: *** [Makefile:1693 : modules] Erreur 2
> make : on quitte le répertoire « /usr/src/linux-headers-5.8.0-41-generic »

I updated the branch to compile against 5.8. Anyway rcu_swap_protected() should be defined in mt76.h
Comment 16 Luca T. 2021-05-03 08:07:07 UTC
(In reply to Lorenzo Bianconi from comment #15)
> (In reply to Mathieu Bouchard from comment #14)
> > Doing `make -C /lib/modules/$(uname -r)/build M=$PWD` , where uname -r
> > currently gives 5.8.0-41-generic ; I get this error message :
> > 
> >   CC [M]  /home/matju/src/mt76/agg-rx.o
> > /home/matju/src/mt76/agg-rx.c: In function `mt76_rx_aggr_stop':
> > /home/matju/src/mt76/agg-rx.c:293:2: error: implicit declaration of
> function
> > `rcu_swap_protected' [-Werror=implicit-function-declaration]
> >   293 |  rcu_swap_protected(wcid->aggr[tidno], tid,
> >       |  ^~~~~~~~~~~~~~~~~~
> > cc1: all warnings being treated as errors
> > make[1]: *** [scripts/Makefile.build:290 : /home/matju/src/mt76/agg-rx.o]
> > Erreur 1
> > make: *** [Makefile:1780 : /home/matju/src/mt76] Erreur 2
> > make : on quitte le répertoire « /usr/src/linux-headers-5.8.0-41-generic »
> > 
> > I tried removing -Werror from your Makefile, but the default still treats
> > this warning as an error, so I added -Wno-error instead, which made no
> > difference, I had to write explicitly
> > -Wno-error=implicit-function-declaration , but then it seems that this is
> > not just a header problem after all, because then I got this :
> > 
> >   MODPOST /home/matju/src/mt76/Module.symvers
> > ERROR: modpost: "rcu_swap_protected" [/home/matju/src/mt76/mt76.ko]
> > undefined!
> > make[1]: *** [scripts/Makefile.modpost:111 :
> > /home/matju/src/mt76/Module.symvers] Erreur 1
> > make[1]: *** Suppression du fichier « /home/matju/src/mt76/Module.symvers »
> > make: *** [Makefile:1693 : modules] Erreur 2
> > make : on quitte le répertoire « /usr/src/linux-headers-5.8.0-41-generic »
> 
> I updated the branch to compile against 5.8. Anyway rcu_swap_protected()
> should be defined in mt76.h

Hello Lorenzo, 

is your patch already released in the kernel 5.12.1?

I have also another problem with the MT7630e (besides the one with the sleep command): sometimes on my laptop the wifi disappears and only the wire connectivity is present. In order to make it working again I need to hibernate my laptop and power-on it again so that it loads again the driver.
Do you know what can be the issue and eventually the solution?

Thanks in advance,

Luca T.
Comment 17 Lorenzo Bianconi 2021-05-03 08:39:36 UTC
(In reply to Luca T. from comment #16)
> (In reply to Lorenzo Bianconi from comment #15)
> > (In reply to Mathieu Bouchard from comment #14)
> > > Doing `make -C /lib/modules/$(uname -r)/build M=$PWD` , where uname -r
> > > currently gives 5.8.0-41-generic ; I get this error message :
> > > 
> > >   CC [M]  /home/matju/src/mt76/agg-rx.o
> > > /home/matju/src/mt76/agg-rx.c: In function `mt76_rx_aggr_stop':
> > > /home/matju/src/mt76/agg-rx.c:293:2: error: implicit declaration of
> > function
> > > `rcu_swap_protected' [-Werror=implicit-function-declaration]
> > >   293 |  rcu_swap_protected(wcid->aggr[tidno], tid,
> > >       |  ^~~~~~~~~~~~~~~~~~
> > > cc1: all warnings being treated as errors
> > > make[1]: *** [scripts/Makefile.build:290 : /home/matju/src/mt76/agg-rx.o]
> > > Erreur 1
> > > make: *** [Makefile:1780 : /home/matju/src/mt76] Erreur 2
> > > make : on quitte le répertoire « /usr/src/linux-headers-5.8.0-41-generic
> »
> > > 
> > > I tried removing -Werror from your Makefile, but the default still treats
> > > this warning as an error, so I added -Wno-error instead, which made no
> > > difference, I had to write explicitly
> > > -Wno-error=implicit-function-declaration , but then it seems that this is
> > > not just a header problem after all, because then I got this :
> > > 
> > >   MODPOST /home/matju/src/mt76/Module.symvers
> > > ERROR: modpost: "rcu_swap_protected" [/home/matju/src/mt76/mt76.ko]
> > > undefined!
> > > make[1]: *** [scripts/Makefile.modpost:111 :
> > > /home/matju/src/mt76/Module.symvers] Erreur 1
> > > make[1]: *** Suppression du fichier « /home/matju/src/mt76/Module.symvers
> »
> > > make: *** [Makefile:1693 : modules] Erreur 2
> > > make : on quitte le répertoire « /usr/src/linux-headers-5.8.0-41-generic
> »
> > 
> > I updated the branch to compile against 5.8. Anyway rcu_swap_protected()
> > should be defined in mt76.h
> 
> Hello Lorenzo, 

Hi Luca,

> 
> is your patch already released in the kernel 5.12.1?

nope since I have not received any feedback. Are you able to test it? (I do not have the mt7630e adapter) 

> 
> I have also another problem with the MT7630e (besides the one with the sleep
> command): sometimes on my laptop the wifi disappears and only the wire
> connectivity is present. In order to make it working again I need to
> hibernate my laptop and power-on it again so that it loads again the driver.
> Do you know what can be the issue and eventually the solution?

can you please describe when the issue occurs? do you have any info in the syslog?

Regards,
Lorenzo

> 
> Thanks in advance,
> 
> Luca T.
Comment 18 Luca T. 2021-05-03 12:03:25 UTC
(In reply to Lorenzo Bianconi from comment #17)
> (In reply to Luca T. from comment #16)
> > (In reply to Lorenzo Bianconi from comment #15)
> > > (In reply to Mathieu Bouchard from comment #14)
> > > > Doing `make -C /lib/modules/$(uname -r)/build M=$PWD` , where uname -r
> > > > currently gives 5.8.0-41-generic ; I get this error message :
> > > > 
> > > >   CC [M]  /home/matju/src/mt76/agg-rx.o
> > > > /home/matju/src/mt76/agg-rx.c: In function `mt76_rx_aggr_stop':
> > > > /home/matju/src/mt76/agg-rx.c:293:2: error: implicit declaration of
> > > function
> > > > `rcu_swap_protected' [-Werror=implicit-function-declaration]
> > > >   293 |  rcu_swap_protected(wcid->aggr[tidno], tid,
> > > >       |  ^~~~~~~~~~~~~~~~~~
> > > > cc1: all warnings being treated as errors
> > > > make[1]: *** [scripts/Makefile.build:290 :
> /home/matju/src/mt76/agg-rx.o]
> > > > Erreur 1
> > > > make: *** [Makefile:1780 : /home/matju/src/mt76] Erreur 2
> > > > make : on quitte le répertoire «
> /usr/src/linux-headers-5.8.0-41-generic
> > »
> > > > 
> > > > I tried removing -Werror from your Makefile, but the default still
> treats
> > > > this warning as an error, so I added -Wno-error instead, which made no
> > > > difference, I had to write explicitly
> > > > -Wno-error=implicit-function-declaration , but then it seems that this
> is
> > > > not just a header problem after all, because then I got this :
> > > > 
> > > >   MODPOST /home/matju/src/mt76/Module.symvers
> > > > ERROR: modpost: "rcu_swap_protected" [/home/matju/src/mt76/mt76.ko]
> > > > undefined!
> > > > make[1]: *** [scripts/Makefile.modpost:111 :
> > > > /home/matju/src/mt76/Module.symvers] Erreur 1
> > > > make[1]: *** Suppression du fichier «
> /home/matju/src/mt76/Module.symvers
> > »
> > > > make: *** [Makefile:1693 : modules] Erreur 2
> > > > make : on quitte le répertoire «
> /usr/src/linux-headers-5.8.0-41-generic
> > »
> > > 
> > > I updated the branch to compile against 5.8. Anyway rcu_swap_protected()
> > > should be defined in mt76.h
> > 
> > Hello Lorenzo, 
> 
> Hi Luca,
> 
> > 
> > is your patch already released in the kernel 5.12.1?
> 
> nope since I have not received any feedback. Are you able to test it? (I do
> not have the mt7630e adapter) 
> 
> > 
> > I have also another problem with the MT7630e (besides the one with the
> sleep
> > command): sometimes on my laptop the wifi disappears and only the wire
> > connectivity is present. In order to make it working again I need to
> > hibernate my laptop and power-on it again so that it loads again the
> driver.
> > Do you know what can be the issue and eventually the solution?
> 
> can you please describe when the issue occurs? do you have any info in the
> syslog?
> 
> Regards,
> Lorenzo
> 
> > 
> > Thanks in advance,
> > 
> > Luca T.

Hi Lorenzo,

yes, I have the hardware to test this patch.

I just installed the vanilla version of kernel 5.12.1, can you please provide me the link to the patch?

For the other issue I'll check the journal and provide you additional details soon (unfornately it happens once a day :) so I'll come back quickly).

Thanks in advance,

Luca
Comment 19 Lorenzo Bianconi 2021-05-03 12:40:40 UTC
(In reply to Luca T. from comment #18)
> (In reply to Lorenzo Bianconi from comment #17)
> > (In reply to Luca T. from comment #16)
> > > (In reply to Lorenzo Bianconi from comment #15)
> > > > (In reply to Mathieu Bouchard from comment #14)
> > > > > Doing `make -C /lib/modules/$(uname -r)/build M=$PWD` , where uname
> -r
> > > > > currently gives 5.8.0-41-generic ; I get this error message :
> > > > > 
> > > > >   CC [M]  /home/matju/src/mt76/agg-rx.o
> > > > > /home/matju/src/mt76/agg-rx.c: In function `mt76_rx_aggr_stop':
> > > > > /home/matju/src/mt76/agg-rx.c:293:2: error: implicit declaration of
> > > > function
> > > > > `rcu_swap_protected' [-Werror=implicit-function-declaration]
> > > > >   293 |  rcu_swap_protected(wcid->aggr[tidno], tid,
> > > > >       |  ^~~~~~~~~~~~~~~~~~
> > > > > cc1: all warnings being treated as errors
> > > > > make[1]: *** [scripts/Makefile.build:290 :
> > /home/matju/src/mt76/agg-rx.o]
> > > > > Erreur 1
> > > > > make: *** [Makefile:1780 : /home/matju/src/mt76] Erreur 2
> > > > > make : on quitte le répertoire «
> > /usr/src/linux-headers-5.8.0-41-generic
> > > »
> > > > > 
> > > > > I tried removing -Werror from your Makefile, but the default still
> > treats
> > > > > this warning as an error, so I added -Wno-error instead, which made
> no
> > > > > difference, I had to write explicitly
> > > > > -Wno-error=implicit-function-declaration , but then it seems that
> this
> > is
> > > > > not just a header problem after all, because then I got this :
> > > > > 
> > > > >   MODPOST /home/matju/src/mt76/Module.symvers
> > > > > ERROR: modpost: "rcu_swap_protected" [/home/matju/src/mt76/mt76.ko]
> > > > > undefined!
> > > > > make[1]: *** [scripts/Makefile.modpost:111 :
> > > > > /home/matju/src/mt76/Module.symvers] Erreur 1
> > > > > make[1]: *** Suppression du fichier «
> > /home/matju/src/mt76/Module.symvers
> > > »
> > > > > make: *** [Makefile:1693 : modules] Erreur 2
> > > > > make : on quitte le répertoire «
> > /usr/src/linux-headers-5.8.0-41-generic
> > > »
> > > > 
> > > > I updated the branch to compile against 5.8. Anyway
> rcu_swap_protected()
> > > > should be defined in mt76.h
> > > 
> > > Hello Lorenzo, 
> > 
> > Hi Luca,
> > 
> > > 
> > > is your patch already released in the kernel 5.12.1?
> > 
> > nope since I have not received any feedback. Are you able to test it? (I do
> > not have the mt7630e adapter) 
> > 
> > > 
> > > I have also another problem with the MT7630e (besides the one with the
> > sleep
> > > command): sometimes on my laptop the wifi disappears and only the wire
> > > connectivity is present. In order to make it working again I need to
> > > hibernate my laptop and power-on it again so that it loads again the
> > driver.
> > > Do you know what can be the issue and eventually the solution?
> > 
> > can you please describe when the issue occurs? do you have any info in the
> > syslog?
> > 
> > Regards,
> > Lorenzo
> > 
> > > 
> > > Thanks in advance,
> > > 
> > > Luca T.
> 
> Hi Lorenzo,
> 
> yes, I have the hardware to test this patch.
> 
> I just installed the vanilla version of kernel 5.12.1, can you please
> provide me the link to the patch?

it is linked in the bz (it has the wrong mt76x0u name)

> 
> For the other issue I'll check the journal and provide you additional
> details soon (unfornately it happens once a day :) so I'll come back
> quickly).
> 
> Thanks in advance,
> 
> Luca
Comment 20 Luca T. 2021-05-03 15:48:35 UTC
(In reply to Lorenzo Bianconi from comment #19)
> (In reply to Luca T. from comment #18)
> > (In reply to Lorenzo Bianconi from comment #17)
> > > (In reply to Luca T. from comment #16)
> > > > (In reply to Lorenzo Bianconi from comment #15)
> > > > > (In reply to Mathieu Bouchard from comment #14)
> > > > > > Doing `make -C /lib/modules/$(uname -r)/build M=$PWD` , where uname
> > -r
> > > > > > currently gives 5.8.0-41-generic ; I get this error message :
> > > > > > 
> > > > > >   CC [M]  /home/matju/src/mt76/agg-rx.o
> > > > > > /home/matju/src/mt76/agg-rx.c: In function `mt76_rx_aggr_stop':
> > > > > > /home/matju/src/mt76/agg-rx.c:293:2: error: implicit declaration of
> > > > > function
> > > > > > `rcu_swap_protected' [-Werror=implicit-function-declaration]
> > > > > >   293 |  rcu_swap_protected(wcid->aggr[tidno], tid,
> > > > > >       |  ^~~~~~~~~~~~~~~~~~
> > > > > > cc1: all warnings being treated as errors
> > > > > > make[1]: *** [scripts/Makefile.build:290 :
> > > /home/matju/src/mt76/agg-rx.o]
> > > > > > Erreur 1
> > > > > > make: *** [Makefile:1780 : /home/matju/src/mt76] Erreur 2
> > > > > > make : on quitte le répertoire «
> > > /usr/src/linux-headers-5.8.0-41-generic
> > > > »
> > > > > > 
> > > > > > I tried removing -Werror from your Makefile, but the default still
> > > treats
> > > > > > this warning as an error, so I added -Wno-error instead, which made
> > no
> > > > > > difference, I had to write explicitly
> > > > > > -Wno-error=implicit-function-declaration , but then it seems that
> > this
> > > is
> > > > > > not just a header problem after all, because then I got this :
> > > > > > 
> > > > > >   MODPOST /home/matju/src/mt76/Module.symvers
> > > > > > ERROR: modpost: "rcu_swap_protected" [/home/matju/src/mt76/mt76.ko]
> > > > > > undefined!
> > > > > > make[1]: *** [scripts/Makefile.modpost:111 :
> > > > > > /home/matju/src/mt76/Module.symvers] Erreur 1
> > > > > > make[1]: *** Suppression du fichier «
> > > /home/matju/src/mt76/Module.symvers
> > > > »
> > > > > > make: *** [Makefile:1693 : modules] Erreur 2
> > > > > > make : on quitte le répertoire «
> > > /usr/src/linux-headers-5.8.0-41-generic
> > > > »
> > > > > 
> > > > > I updated the branch to compile against 5.8. Anyway
> > rcu_swap_protected()
> > > > > should be defined in mt76.h
> > > > 
> > > > Hello Lorenzo, 
> > > 
> > > Hi Luca,
> > > 
> > > > 
> > > > is your patch already released in the kernel 5.12.1?
> > > 
> > > nope since I have not received any feedback. Are you able to test it? (I
> do
> > > not have the mt7630e adapter) 
> > > 
> > > > 
> > > > I have also another problem with the MT7630e (besides the one with the
> > > sleep
> > > > command): sometimes on my laptop the wifi disappears and only the wire
> > > > connectivity is present. In order to make it working again I need to
> > > > hibernate my laptop and power-on it again so that it loads again the
> > > driver.
> > > > Do you know what can be the issue and eventually the solution?
> > > 
> > > can you please describe when the issue occurs? do you have any info in
> the
> > > syslog?
> > > 
> > > Regards,
> > > Lorenzo
> > > 
> > > > 
> > > > Thanks in advance,
> > > > 
> > > > Luca T.
> > 
> > Hi Lorenzo,
> > 
> > yes, I have the hardware to test this patch.
> > 
> > I just installed the vanilla version of kernel 5.12.1, can you please
> > provide me the link to the patch?
> 
> it is linked in the bz (it has the wrong mt76x0u name)
> 
> > 
> > For the other issue I'll check the journal and provide you additional
> > details soon (unfornately it happens once a day :) so I'll come back
> > quickly).
> > 
> > Thanks in advance,
> > 
> > Luca

Hi Lorenzo,

it's quite a bit of time I'm recompiling kernel (~15 years :) ) so I have some difficulties...
Since I have a working kernel from the Linux Mint distributions, I copied the configuration file in the new kernel directory and I recompiled it.
The problem is that when I'm restarting the kernel does not load some drivers, hence linux can't find the hard disk and it goes in kernel panic.

Did I miss anything in the following compiling steps:
1) Extract kernel in /usr/src
2) Patch kernel (patch -p1 < <patch file>)
3) Copy config file: cp /boot/config-$(uname -r) .config
4) make menuconfig in case of changes (here I didn't change anything for now)
5) make -j12
6) make bzImage (it seems required by Linux Mint)
7) make modules_install
8) Copy the configuration file back: cp .config /boot/config-5.12.1
9) make install
10) update-grub2

Did I miss anything?

Thanks,

Luca
Comment 21 Luca T. 2021-05-03 19:39:07 UTC
(In reply to Luca T. from comment #20)
> (In reply to Lorenzo Bianconi from comment #19)
> > (In reply to Luca T. from comment #18)
> > > (In reply to Lorenzo Bianconi from comment #17)
> > > > (In reply to Luca T. from comment #16)
> > > > > (In reply to Lorenzo Bianconi from comment #15)
> > > > > > (In reply to Mathieu Bouchard from comment #14)
> > > > > > > Doing `make -C /lib/modules/$(uname -r)/build M=$PWD` , where
> uname
> > > -r
> > > > > > > currently gives 5.8.0-41-generic ; I get this error message :
> > > > > > > 
> > > > > > >   CC [M]  /home/matju/src/mt76/agg-rx.o
> > > > > > > /home/matju/src/mt76/agg-rx.c: In function `mt76_rx_aggr_stop':
> > > > > > > /home/matju/src/mt76/agg-rx.c:293:2: error: implicit declaration
> of
> > > > > > function
> > > > > > > `rcu_swap_protected' [-Werror=implicit-function-declaration]
> > > > > > >   293 |  rcu_swap_protected(wcid->aggr[tidno], tid,
> > > > > > >       |  ^~~~~~~~~~~~~~~~~~
> > > > > > > cc1: all warnings being treated as errors
> > > > > > > make[1]: *** [scripts/Makefile.build:290 :
> > > > /home/matju/src/mt76/agg-rx.o]
> > > > > > > Erreur 1
> > > > > > > make: *** [Makefile:1780 : /home/matju/src/mt76] Erreur 2
> > > > > > > make : on quitte le répertoire «
> > > > /usr/src/linux-headers-5.8.0-41-generic
> > > > > »
> > > > > > > 
> > > > > > > I tried removing -Werror from your Makefile, but the default
> still
> > > > treats
> > > > > > > this warning as an error, so I added -Wno-error instead, which
> made
> > > no
> > > > > > > difference, I had to write explicitly
> > > > > > > -Wno-error=implicit-function-declaration , but then it seems that
> > > this
> > > > is
> > > > > > > not just a header problem after all, because then I got this :
> > > > > > > 
> > > > > > >   MODPOST /home/matju/src/mt76/Module.symvers
> > > > > > > ERROR: modpost: "rcu_swap_protected"
> [/home/matju/src/mt76/mt76.ko]
> > > > > > > undefined!
> > > > > > > make[1]: *** [scripts/Makefile.modpost:111 :
> > > > > > > /home/matju/src/mt76/Module.symvers] Erreur 1
> > > > > > > make[1]: *** Suppression du fichier «
> > > > /home/matju/src/mt76/Module.symvers
> > > > > »
> > > > > > > make: *** [Makefile:1693 : modules] Erreur 2
> > > > > > > make : on quitte le répertoire «
> > > > /usr/src/linux-headers-5.8.0-41-generic
> > > > > »
> > > > > > 
> > > > > > I updated the branch to compile against 5.8. Anyway
> > > rcu_swap_protected()
> > > > > > should be defined in mt76.h
> > > > > 
> > > > > Hello Lorenzo, 
> > > > 
> > > > Hi Luca,
> > > > 
> > > > > 
> > > > > is your patch already released in the kernel 5.12.1?
> > > > 
> > > > nope since I have not received any feedback. Are you able to test it?
> (I
> > do
> > > > not have the mt7630e adapter) 
> > > > 
> > > > > 
> > > > > I have also another problem with the MT7630e (besides the one with
> the
> > > > sleep
> > > > > command): sometimes on my laptop the wifi disappears and only the
> wire
> > > > > connectivity is present. In order to make it working again I need to
> > > > > hibernate my laptop and power-on it again so that it loads again the
> > > > driver.
> > > > > Do you know what can be the issue and eventually the solution?
> > > > 
> > > > can you please describe when the issue occurs? do you have any info in
> > the
> > > > syslog?
> > > > 
> > > > Regards,
> > > > Lorenzo
> > > > 
> > > > > 
> > > > > Thanks in advance,
> > > > > 
> > > > > Luca T.
> > > 
> > > Hi Lorenzo,
> > > 
> > > yes, I have the hardware to test this patch.
> > > 
> > > I just installed the vanilla version of kernel 5.12.1, can you please
> > > provide me the link to the patch?
> > 
> > it is linked in the bz (it has the wrong mt76x0u name)
> > 
> > > 
> > > For the other issue I'll check the journal and provide you additional
> > > details soon (unfornately it happens once a day :) so I'll come back
> > > quickly).
> > > 
> > > Thanks in advance,
> > > 
> > > Luca
> 
> Hi Lorenzo,
> 
> it's quite a bit of time I'm recompiling kernel (~15 years :) ) so I have
> some difficulties...
> Since I have a working kernel from the Linux Mint distributions, I copied
> the configuration file in the new kernel directory and I recompiled it.
> The problem is that when I'm restarting the kernel does not load some
> drivers, hence linux can't find the hard disk and it goes in kernel panic.
> 
> Did I miss anything in the following compiling steps:
> 1) Extract kernel in /usr/src
> 2) Patch kernel (patch -p1 < <patch file>)
> 3) Copy config file: cp /boot/config-$(uname -r) .config
> 4) make menuconfig in case of changes (here I didn't change anything for now)
> 5) make -j12
> 6) make bzImage (it seems required by Linux Mint)
> 7) make modules_install
> 8) Copy the configuration file back: cp .config /boot/config-5.12.1
> 9) make install
> 10) update-grub2
> 
> Did I miss anything?
> 
> Thanks,
> 
> Luca

Hi Lorenzo,

I managed somehow to make the new kernel loading and your patch seems working fine since I'm able to suspend and resume my laptop and the driver reloads correctly and connectivity is re-established.

You can proceed to merge the patch to the kernel.

In order to make it working temporarily I had to:
1) append "nomodeset" parameter otherwise the screen is black
2) replace the UUID identifier of my partition with the partition number itself (like /dev/sda4)
3) remove "initrd" line since laptop freezes when loading the image

When I'm installing the kernel I see this issue:
---------------------------------------------------
root@oldlaptop:/usr/src/linux-5.12.1-MT7630e-patch# make install
sh ./arch/x86/boot/install.sh 5.12.1 arch/x86/boot/bzImage \
        System.map "/boot"
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 5.12.1 /boot/vmlinuz-5.12.1
run-parts: executing /etc/kernel/postinst.d/dkms 5.12.1 /boot/vmlinuz-5.12.1
 * dkms: running auto installation service for kernel 5.12.1                                                                                                                                                                                 Error!  The /var/lib/dkms/ndiswrapper/1.60/5.12.1/x86_64/dkms.conf for module ndiswrapper includes a BUILD_EXCLUSIVE directive which
does not match this kernel/arch.  This indicates that it should not be built.
                                                                                                                                                                                                                                      [ OK ]
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 5.12.1 /boot/vmlinuz-5.12.1
update-initramfs: Generating /boot/initrd.img-5.12.1
W: Possible missing firmware /lib/firmware/i915/skl_guc_49.0.1.bin for module i915
...
-----------------------------------------------------

Could you please help me to resolve the issues I have in the kernel installation?

Thanks in advance,

Luca
Comment 22 Lorenzo Bianconi 2021-05-03 21:06:37 UTC
(In reply to Luca T. from comment #21)
> (In reply to Luca T. from comment #20)
> > (In reply to Lorenzo Bianconi from comment #19)
> > > (In reply to Luca T. from comment #18)
> > > > (In reply to Lorenzo Bianconi from comment #17)
> > > > > (In reply to Luca T. from comment #16)
> > > > > > (In reply to Lorenzo Bianconi from comment #15)
> > > > > > > (In reply to Mathieu Bouchard from comment #14)
> > > > > > > > Doing `make -C /lib/modules/$(uname -r)/build M=$PWD` , where
> > uname
> > > > -r
> > > > > > > > currently gives 5.8.0-41-generic ; I get this error message :
> > > > > > > > 
> > > > > > > >   CC [M]  /home/matju/src/mt76/agg-rx.o
> > > > > > > > /home/matju/src/mt76/agg-rx.c: In function `mt76_rx_aggr_stop':
> > > > > > > > /home/matju/src/mt76/agg-rx.c:293:2: error: implicit
> declaration
> > of
> > > > > > > function
> > > > > > > > `rcu_swap_protected' [-Werror=implicit-function-declaration]
> > > > > > > >   293 |  rcu_swap_protected(wcid->aggr[tidno], tid,
> > > > > > > >       |  ^~~~~~~~~~~~~~~~~~
> > > > > > > > cc1: all warnings being treated as errors
> > > > > > > > make[1]: *** [scripts/Makefile.build:290 :
> > > > > /home/matju/src/mt76/agg-rx.o]
> > > > > > > > Erreur 1
> > > > > > > > make: *** [Makefile:1780 : /home/matju/src/mt76] Erreur 2
> > > > > > > > make : on quitte le répertoire «
> > > > > /usr/src/linux-headers-5.8.0-41-generic
> > > > > > »
> > > > > > > > 
> > > > > > > > I tried removing -Werror from your Makefile, but the default
> > still
> > > > > treats
> > > > > > > > this warning as an error, so I added -Wno-error instead, which
> > made
> > > > no
> > > > > > > > difference, I had to write explicitly
> > > > > > > > -Wno-error=implicit-function-declaration , but then it seems
> that
> > > > this
> > > > > is
> > > > > > > > not just a header problem after all, because then I got this :
> > > > > > > > 
> > > > > > > >   MODPOST /home/matju/src/mt76/Module.symvers
> > > > > > > > ERROR: modpost: "rcu_swap_protected"
> > [/home/matju/src/mt76/mt76.ko]
> > > > > > > > undefined!
> > > > > > > > make[1]: *** [scripts/Makefile.modpost:111 :
> > > > > > > > /home/matju/src/mt76/Module.symvers] Erreur 1
> > > > > > > > make[1]: *** Suppression du fichier «
> > > > > /home/matju/src/mt76/Module.symvers
> > > > > > »
> > > > > > > > make: *** [Makefile:1693 : modules] Erreur 2
> > > > > > > > make : on quitte le répertoire «
> > > > > /usr/src/linux-headers-5.8.0-41-generic
> > > > > > »
> > > > > > > 
> > > > > > > I updated the branch to compile against 5.8. Anyway
> > > > rcu_swap_protected()
> > > > > > > should be defined in mt76.h
> > > > > > 
> > > > > > Hello Lorenzo, 
> > > > > 
> > > > > Hi Luca,
> > > > > 
> > > > > > 
> > > > > > is your patch already released in the kernel 5.12.1?
> > > > > 
> > > > > nope since I have not received any feedback. Are you able to test it?
> > (I
> > > do
> > > > > not have the mt7630e adapter) 
> > > > > 
> > > > > > 
> > > > > > I have also another problem with the MT7630e (besides the one with
> > the
> > > > > sleep
> > > > > > command): sometimes on my laptop the wifi disappears and only the
> > wire
> > > > > > connectivity is present. In order to make it working again I need
> to
> > > > > > hibernate my laptop and power-on it again so that it loads again
> the
> > > > > driver.
> > > > > > Do you know what can be the issue and eventually the solution?
> > > > > 
> > > > > can you please describe when the issue occurs? do you have any info
> in
> > > the
> > > > > syslog?
> > > > > 
> > > > > Regards,
> > > > > Lorenzo
> > > > > 
> > > > > > 
> > > > > > Thanks in advance,
> > > > > > 
> > > > > > Luca T.
> > > > 
> > > > Hi Lorenzo,
> > > > 
> > > > yes, I have the hardware to test this patch.
> > > > 
> > > > I just installed the vanilla version of kernel 5.12.1, can you please
> > > > provide me the link to the patch?
> > > 
> > > it is linked in the bz (it has the wrong mt76x0u name)
> > > 
> > > > 
> > > > For the other issue I'll check the journal and provide you additional
> > > > details soon (unfornately it happens once a day :) so I'll come back
> > > > quickly).
> > > > 
> > > > Thanks in advance,
> > > > 
> > > > Luca
> > 
> > Hi Lorenzo,
> > 
> > it's quite a bit of time I'm recompiling kernel (~15 years :) ) so I have
> > some difficulties...
> > Since I have a working kernel from the Linux Mint distributions, I copied
> > the configuration file in the new kernel directory and I recompiled it.
> > The problem is that when I'm restarting the kernel does not load some
> > drivers, hence linux can't find the hard disk and it goes in kernel panic.
> > 
> > Did I miss anything in the following compiling steps:
> > 1) Extract kernel in /usr/src
> > 2) Patch kernel (patch -p1 < <patch file>)
> > 3) Copy config file: cp /boot/config-$(uname -r) .config
> > 4) make menuconfig in case of changes (here I didn't change anything for
> now)
> > 5) make -j12
> > 6) make bzImage (it seems required by Linux Mint)
> > 7) make modules_install
> > 8) Copy the configuration file back: cp .config /boot/config-5.12.1
> > 9) make install
> > 10) update-grub2
> > 
> > Did I miss anything?
> > 
> > Thanks,
> > 
> > Luca
> 
> Hi Lorenzo,
> 
> I managed somehow to make the new kernel loading and your patch seems
> working fine since I'm able to suspend and resume my laptop and the driver
> reloads correctly and connectivity is re-established.
> 
> You can proceed to merge the patch to the kernel.

nice. So you confirm now suspend/resume is fine. Can you please keep testing it for a while?

> 
> In order to make it working temporarily I had to:
> 1) append "nomodeset" parameter otherwise the screen is black
> 2) replace the UUID identifier of my partition with the partition number
> itself (like /dev/sda4)
> 3) remove "initrd" line since laptop freezes when loading the image
> 
> When I'm installing the kernel I see this issue:
> ---------------------------------------------------
> root@oldlaptop:/usr/src/linux-5.12.1-MT7630e-patch# make install
> sh ./arch/x86/boot/install.sh 5.12.1 arch/x86/boot/bzImage \
>         System.map "/boot"
> run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 5.12.1
> /boot/vmlinuz-5.12.1
> run-parts: executing /etc/kernel/postinst.d/dkms 5.12.1 /boot/vmlinuz-5.12.1
>  * dkms: running auto installation service for kernel 5.12.1                
> Error!  The /var/lib/dkms/ndiswrapper/1.60/5.12.1/x86_64/dkms.conf for
> module ndiswrapper includes a BUILD_EXCLUSIVE directive which
> does not match this kernel/arch.  This indicates that it should not be built.
>                                                                             
> [ OK ]
> run-parts: executing /etc/kernel/postinst.d/initramfs-tools 5.12.1
> /boot/vmlinuz-5.12.1
> update-initramfs: Generating /boot/initrd.img-5.12.1
> W: Possible missing firmware /lib/firmware/i915/skl_guc_49.0.1.bin for
> module i915
> ...
> -----------------------------------------------------
> 

I am not familiar with mint build system. Is it enough to run make, make modules_install; make install or do you need to create the .deb file?

> Could you please help me to resolve the issues I have in the kernel
> installation?
> 
> Thanks in advance,
> 
> Luca
Comment 23 Luca T. 2021-05-04 02:30:18 UTC
(In reply to Lorenzo Bianconi from comment #22)
> (In reply to Luca T. from comment #21)
> > (In reply to Luca T. from comment #20)
> > > (In reply to Lorenzo Bianconi from comment #19)
> > > > (In reply to Luca T. from comment #18)
> > > > > (In reply to Lorenzo Bianconi from comment #17)
> > > > > > (In reply to Luca T. from comment #16)
> > > > > > > (In reply to Lorenzo Bianconi from comment #15)
> > > > > > > > (In reply to Mathieu Bouchard from comment #14)
> > > > > > > > > Doing `make -C /lib/modules/$(uname -r)/build M=$PWD` , where
> > > uname
> > > > > -r
> > > > > > > > > currently gives 5.8.0-41-generic ; I get this error message :
> > > > > > > > > 
> > > > > > > > >   CC [M]  /home/matju/src/mt76/agg-rx.o
> > > > > > > > > /home/matju/src/mt76/agg-rx.c: In function
> `mt76_rx_aggr_stop':
> > > > > > > > > /home/matju/src/mt76/agg-rx.c:293:2: error: implicit
> > declaration
> > > of
> > > > > > > > function
> > > > > > > > > `rcu_swap_protected' [-Werror=implicit-function-declaration]
> > > > > > > > >   293 |  rcu_swap_protected(wcid->aggr[tidno], tid,
> > > > > > > > >       |  ^~~~~~~~~~~~~~~~~~
> > > > > > > > > cc1: all warnings being treated as errors
> > > > > > > > > make[1]: *** [scripts/Makefile.build:290 :
> > > > > > /home/matju/src/mt76/agg-rx.o]
> > > > > > > > > Erreur 1
> > > > > > > > > make: *** [Makefile:1780 : /home/matju/src/mt76] Erreur 2
> > > > > > > > > make : on quitte le répertoire «
> > > > > > /usr/src/linux-headers-5.8.0-41-generic
> > > > > > > »
> > > > > > > > > 
> > > > > > > > > I tried removing -Werror from your Makefile, but the default
> > > still
> > > > > > treats
> > > > > > > > > this warning as an error, so I added -Wno-error instead,
> which
> > > made
> > > > > no
> > > > > > > > > difference, I had to write explicitly
> > > > > > > > > -Wno-error=implicit-function-declaration , but then it seems
> > that
> > > > > this
> > > > > > is
> > > > > > > > > not just a header problem after all, because then I got this
> :
> > > > > > > > > 
> > > > > > > > >   MODPOST /home/matju/src/mt76/Module.symvers
> > > > > > > > > ERROR: modpost: "rcu_swap_protected"
> > > [/home/matju/src/mt76/mt76.ko]
> > > > > > > > > undefined!
> > > > > > > > > make[1]: *** [scripts/Makefile.modpost:111 :
> > > > > > > > > /home/matju/src/mt76/Module.symvers] Erreur 1
> > > > > > > > > make[1]: *** Suppression du fichier «
> > > > > > /home/matju/src/mt76/Module.symvers
> > > > > > > »
> > > > > > > > > make: *** [Makefile:1693 : modules] Erreur 2
> > > > > > > > > make : on quitte le répertoire «
> > > > > > /usr/src/linux-headers-5.8.0-41-generic
> > > > > > > »
> > > > > > > > 
> > > > > > > > I updated the branch to compile against 5.8. Anyway
> > > > > rcu_swap_protected()
> > > > > > > > should be defined in mt76.h
> > > > > > > 
> > > > > > > Hello Lorenzo, 
> > > > > > 
> > > > > > Hi Luca,
> > > > > > 
> > > > > > > 
> > > > > > > is your patch already released in the kernel 5.12.1?
> > > > > > 
> > > > > > nope since I have not received any feedback. Are you able to test
> it?
> > > (I
> > > > do
> > > > > > not have the mt7630e adapter) 
> > > > > > 
> > > > > > > 
> > > > > > > I have also another problem with the MT7630e (besides the one
> with
> > > the
> > > > > > sleep
> > > > > > > command): sometimes on my laptop the wifi disappears and only the
> > > wire
> > > > > > > connectivity is present. In order to make it working again I need
> > to
> > > > > > > hibernate my laptop and power-on it again so that it loads again
> > the
> > > > > > driver.
> > > > > > > Do you know what can be the issue and eventually the solution?
> > > > > > 
> > > > > > can you please describe when the issue occurs? do you have any info
> > in
> > > > the
> > > > > > syslog?
> > > > > > 
> > > > > > Regards,
> > > > > > Lorenzo
> > > > > > 
> > > > > > > 
> > > > > > > Thanks in advance,
> > > > > > > 
> > > > > > > Luca T.
> > > > > 
> > > > > Hi Lorenzo,
> > > > > 
> > > > > yes, I have the hardware to test this patch.
> > > > > 
> > > > > I just installed the vanilla version of kernel 5.12.1, can you please
> > > > > provide me the link to the patch?
> > > > 
> > > > it is linked in the bz (it has the wrong mt76x0u name)
> > > > 
> > > > > 
> > > > > For the other issue I'll check the journal and provide you additional
> > > > > details soon (unfornately it happens once a day :) so I'll come back
> > > > > quickly).
> > > > > 
> > > > > Thanks in advance,
> > > > > 
> > > > > Luca
> > > 
> > > Hi Lorenzo,
> > > 
> > > it's quite a bit of time I'm recompiling kernel (~15 years :) ) so I have
> > > some difficulties...
> > > Since I have a working kernel from the Linux Mint distributions, I copied
> > > the configuration file in the new kernel directory and I recompiled it.
> > > The problem is that when I'm restarting the kernel does not load some
> > > drivers, hence linux can't find the hard disk and it goes in kernel
> panic.
> > > 
> > > Did I miss anything in the following compiling steps:
> > > 1) Extract kernel in /usr/src
> > > 2) Patch kernel (patch -p1 < <patch file>)
> > > 3) Copy config file: cp /boot/config-$(uname -r) .config
> > > 4) make menuconfig in case of changes (here I didn't change anything for
> > now)
> > > 5) make -j12
> > > 6) make bzImage (it seems required by Linux Mint)
> > > 7) make modules_install
> > > 8) Copy the configuration file back: cp .config /boot/config-5.12.1
> > > 9) make install
> > > 10) update-grub2
> > > 
> > > Did I miss anything?
> > > 
> > > Thanks,
> > > 
> > > Luca
> > 
> > Hi Lorenzo,
> > 
> > I managed somehow to make the new kernel loading and your patch seems
> > working fine since I'm able to suspend and resume my laptop and the driver
> > reloads correctly and connectivity is re-established.
> > 
> > You can proceed to merge the patch to the kernel.
> 
> nice. So you confirm now suspend/resume is fine. Can you please keep testing
> it for a while?
> 
> > 
> > In order to make it working temporarily I had to:
> > 1) append "nomodeset" parameter otherwise the screen is black
> > 2) replace the UUID identifier of my partition with the partition number
> > itself (like /dev/sda4)
> > 3) remove "initrd" line since laptop freezes when loading the image
> > 
> > When I'm installing the kernel I see this issue:
> > ---------------------------------------------------
> > root@oldlaptop:/usr/src/linux-5.12.1-MT7630e-patch# make install
> > sh ./arch/x86/boot/install.sh 5.12.1 arch/x86/boot/bzImage \
> >         System.map "/boot"
> > run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 5.12.1
> > /boot/vmlinuz-5.12.1
> > run-parts: executing /etc/kernel/postinst.d/dkms 5.12.1
> /boot/vmlinuz-5.12.1
> >  * dkms: running auto installation service for kernel 5.12.1                
> > Error!  The /var/lib/dkms/ndiswrapper/1.60/5.12.1/x86_64/dkms.conf for
> > module ndiswrapper includes a BUILD_EXCLUSIVE directive which
> > does not match this kernel/arch.  This indicates that it should not be
> built.
> >                                                                             
> > [ OK ]
> > run-parts: executing /etc/kernel/postinst.d/initramfs-tools 5.12.1
> > /boot/vmlinuz-5.12.1
> > update-initramfs: Generating /boot/initrd.img-5.12.1
> > W: Possible missing firmware /lib/firmware/i915/skl_guc_49.0.1.bin for
> > module i915
> > ...
> > -----------------------------------------------------
> > 
> 
> I am not familiar with mint build system. Is it enough to run make, make
> modules_install; make install or do you need to create the .deb file?
> 
> > Could you please help me to resolve the issues I have in the kernel
> > installation?
> > 
> > Thanks in advance,
> > 
> > Luca

Hi Lorenzo,

I'll keep testing for some days also because I remember I created some scripts to resume from suspend when it was not supported and I need to remove.

Regarding the issue I have with kernel I'll figure out myself thx.

I'll keep you posted, 

thx in advance,

Luca
Comment 24 Luca T. 2021-05-04 12:41:51 UTC
(In reply to Luca T. from comment #23)
> (In reply to Lorenzo Bianconi from comment #22)
> > (In reply to Luca T. from comment #21)
> > > (In reply to Luca T. from comment #20)
> > > > (In reply to Lorenzo Bianconi from comment #19)
> > > > > (In reply to Luca T. from comment #18)
> > > > > > (In reply to Lorenzo Bianconi from comment #17)
> > > > > > > (In reply to Luca T. from comment #16)
> > > > > > > > (In reply to Lorenzo Bianconi from comment #15)
> > > > > > > > > (In reply to Mathieu Bouchard from comment #14)
> > > > > > > > > > Doing `make -C /lib/modules/$(uname -r)/build M=$PWD` ,
> where
> > > > uname
> > > > > > -r
> > > > > > > > > > currently gives 5.8.0-41-generic ; I get this error message
> :
> > > > > > > > > > 
> > > > > > > > > >   CC [M]  /home/matju/src/mt76/agg-rx.o
> > > > > > > > > > /home/matju/src/mt76/agg-rx.c: In function
> > `mt76_rx_aggr_stop':
> > > > > > > > > > /home/matju/src/mt76/agg-rx.c:293:2: error: implicit
> > > declaration
> > > > of
> > > > > > > > > function
> > > > > > > > > > `rcu_swap_protected'
> [-Werror=implicit-function-declaration]
> > > > > > > > > >   293 |  rcu_swap_protected(wcid->aggr[tidno], tid,
> > > > > > > > > >       |  ^~~~~~~~~~~~~~~~~~
> > > > > > > > > > cc1: all warnings being treated as errors
> > > > > > > > > > make[1]: *** [scripts/Makefile.build:290 :
> > > > > > > /home/matju/src/mt76/agg-rx.o]
> > > > > > > > > > Erreur 1
> > > > > > > > > > make: *** [Makefile:1780 : /home/matju/src/mt76] Erreur 2
> > > > > > > > > > make : on quitte le répertoire «
> > > > > > > /usr/src/linux-headers-5.8.0-41-generic
> > > > > > > > »
> > > > > > > > > > 
> > > > > > > > > > I tried removing -Werror from your Makefile, but the
> default
> > > > still
> > > > > > > treats
> > > > > > > > > > this warning as an error, so I added -Wno-error instead,
> > which
> > > > made
> > > > > > no
> > > > > > > > > > difference, I had to write explicitly
> > > > > > > > > > -Wno-error=implicit-function-declaration , but then it
> seems
> > > that
> > > > > > this
> > > > > > > is
> > > > > > > > > > not just a header problem after all, because then I got
> this
> > :
> > > > > > > > > > 
> > > > > > > > > >   MODPOST /home/matju/src/mt76/Module.symvers
> > > > > > > > > > ERROR: modpost: "rcu_swap_protected"
> > > > [/home/matju/src/mt76/mt76.ko]
> > > > > > > > > > undefined!
> > > > > > > > > > make[1]: *** [scripts/Makefile.modpost:111 :
> > > > > > > > > > /home/matju/src/mt76/Module.symvers] Erreur 1
> > > > > > > > > > make[1]: *** Suppression du fichier «
> > > > > > > /home/matju/src/mt76/Module.symvers
> > > > > > > > »
> > > > > > > > > > make: *** [Makefile:1693 : modules] Erreur 2
> > > > > > > > > > make : on quitte le répertoire «
> > > > > > > /usr/src/linux-headers-5.8.0-41-generic
> > > > > > > > »
> > > > > > > > > 
> > > > > > > > > I updated the branch to compile against 5.8. Anyway
> > > > > > rcu_swap_protected()
> > > > > > > > > should be defined in mt76.h
> > > > > > > > 
> > > > > > > > Hello Lorenzo, 
> > > > > > > 
> > > > > > > Hi Luca,
> > > > > > > 
> > > > > > > > 
> > > > > > > > is your patch already released in the kernel 5.12.1?
> > > > > > > 
> > > > > > > nope since I have not received any feedback. Are you able to test
> > it?
> > > > (I
> > > > > do
> > > > > > > not have the mt7630e adapter) 
> > > > > > > 
> > > > > > > > 
> > > > > > > > I have also another problem with the MT7630e (besides the one
> > with
> > > > the
> > > > > > > sleep
> > > > > > > > command): sometimes on my laptop the wifi disappears and only
> the
> > > > wire
> > > > > > > > connectivity is present. In order to make it working again I
> need
> > > to
> > > > > > > > hibernate my laptop and power-on it again so that it loads
> again
> > > the
> > > > > > > driver.
> > > > > > > > Do you know what can be the issue and eventually the solution?
> > > > > > > 
> > > > > > > can you please describe when the issue occurs? do you have any
> info
> > > in
> > > > > the
> > > > > > > syslog?
> > > > > > > 
> > > > > > > Regards,
> > > > > > > Lorenzo
> > > > > > > 
> > > > > > > > 
> > > > > > > > Thanks in advance,
> > > > > > > > 
> > > > > > > > Luca T.
> > > > > > 
> > > > > > Hi Lorenzo,
> > > > > > 
> > > > > > yes, I have the hardware to test this patch.
> > > > > > 
> > > > > > I just installed the vanilla version of kernel 5.12.1, can you
> please
> > > > > > provide me the link to the patch?
> > > > > 
> > > > > it is linked in the bz (it has the wrong mt76x0u name)
> > > > > 
> > > > > > 
> > > > > > For the other issue I'll check the journal and provide you
> additional
> > > > > > details soon (unfornately it happens once a day :) so I'll come
> back
> > > > > > quickly).
> > > > > > 
> > > > > > Thanks in advance,
> > > > > > 
> > > > > > Luca
> > > > 
> > > > Hi Lorenzo,
> > > > 
> > > > it's quite a bit of time I'm recompiling kernel (~15 years :) ) so I
> have
> > > > some difficulties...
> > > > Since I have a working kernel from the Linux Mint distributions, I
> copied
> > > > the configuration file in the new kernel directory and I recompiled it.
> > > > The problem is that when I'm restarting the kernel does not load some
> > > > drivers, hence linux can't find the hard disk and it goes in kernel
> > panic.
> > > > 
> > > > Did I miss anything in the following compiling steps:
> > > > 1) Extract kernel in /usr/src
> > > > 2) Patch kernel (patch -p1 < <patch file>)
> > > > 3) Copy config file: cp /boot/config-$(uname -r) .config
> > > > 4) make menuconfig in case of changes (here I didn't change anything
> for
> > > now)
> > > > 5) make -j12
> > > > 6) make bzImage (it seems required by Linux Mint)
> > > > 7) make modules_install
> > > > 8) Copy the configuration file back: cp .config /boot/config-5.12.1
> > > > 9) make install
> > > > 10) update-grub2
> > > > 
> > > > Did I miss anything?
> > > > 
> > > > Thanks,
> > > > 
> > > > Luca
> > > 
> > > Hi Lorenzo,
> > > 
> > > I managed somehow to make the new kernel loading and your patch seems
> > > working fine since I'm able to suspend and resume my laptop and the
> driver
> > > reloads correctly and connectivity is re-established.
> > > 
> > > You can proceed to merge the patch to the kernel.
> > 
> > nice. So you confirm now suspend/resume is fine. Can you please keep
> testing
> > it for a while?
> > 
> > > 
> > > In order to make it working temporarily I had to:
> > > 1) append "nomodeset" parameter otherwise the screen is black
> > > 2) replace the UUID identifier of my partition with the partition number
> > > itself (like /dev/sda4)
> > > 3) remove "initrd" line since laptop freezes when loading the image
> > > 
> > > When I'm installing the kernel I see this issue:
> > > ---------------------------------------------------
> > > root@oldlaptop:/usr/src/linux-5.12.1-MT7630e-patch# make install
> > > sh ./arch/x86/boot/install.sh 5.12.1 arch/x86/boot/bzImage \
> > >         System.map "/boot"
> > > run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 5.12.1
> > > /boot/vmlinuz-5.12.1
> > > run-parts: executing /etc/kernel/postinst.d/dkms 5.12.1
> > /boot/vmlinuz-5.12.1
> > >  * dkms: running auto installation service for kernel 5.12.1              
> > > Error!  The /var/lib/dkms/ndiswrapper/1.60/5.12.1/x86_64/dkms.conf for
> > > module ndiswrapper includes a BUILD_EXCLUSIVE directive which
> > > does not match this kernel/arch.  This indicates that it should not be
> > built.
> > >                                                                           
> > > [ OK ]
> > > run-parts: executing /etc/kernel/postinst.d/initramfs-tools 5.12.1
> > > /boot/vmlinuz-5.12.1
> > > update-initramfs: Generating /boot/initrd.img-5.12.1
> > > W: Possible missing firmware /lib/firmware/i915/skl_guc_49.0.1.bin for
> > > module i915
> > > ...
> > > -----------------------------------------------------
> > > 
> > 
> > I am not familiar with mint build system. Is it enough to run make, make
> > modules_install; make install or do you need to create the .deb file?
> > 
> > > Could you please help me to resolve the issues I have in the kernel
> > > installation?
> > > 
> > > Thanks in advance,
> > > 
> > > Luca
> 
> Hi Lorenzo,
> 
> I'll keep testing for some days also because I remember I created some
> scripts to resume from suspend when it was not supported and I need to
> remove.
> 
> Regarding the issue I have with kernel I'll figure out myself thx.
> 
> I'll keep you posted, 
> 
> thx in advance,
> 
> Luca

Hi Lorenzo,

I removed my workaround for the missing suspend support and in this case your patch does NOT work. On resume the laptop is fully stuck and I need to force it to shutdown manually.

Unfortunately I have no data in syslog... any idea how to address this issue?

Regards,

Luca
Comment 25 Luca T. 2021-05-06 20:03:33 UTC
(In reply to Lorenzo Bianconi from comment #22)
> (In reply to Luca T. from comment #21)
> > (In reply to Luca T. from comment #20)
> > > (In reply to Lorenzo Bianconi from comment #19)
> > > > (In reply to Luca T. from comment #18)
> > > > > (In reply to Lorenzo Bianconi from comment #17)
> > > > > > (In reply to Luca T. from comment #16)
> > > > > > > (In reply to Lorenzo Bianconi from comment #15)
> > > > > > > > (In reply to Mathieu Bouchard from comment #14)
> > > > > > > > > Doing `make -C /lib/modules/$(uname -r)/build M=$PWD` , where
> > > uname
> > > > > -r
> > > > > > > > > currently gives 5.8.0-41-generic ; I get this error message :
> > > > > > > > > 
> > > > > > > > >   CC [M]  /home/matju/src/mt76/agg-rx.o
> > > > > > > > > /home/matju/src/mt76/agg-rx.c: In function
> `mt76_rx_aggr_stop':
> > > > > > > > > /home/matju/src/mt76/agg-rx.c:293:2: error: implicit
> > declaration
> > > of
> > > > > > > > function
> > > > > > > > > `rcu_swap_protected' [-Werror=implicit-function-declaration]
> > > > > > > > >   293 |  rcu_swap_protected(wcid->aggr[tidno], tid,
> > > > > > > > >       |  ^~~~~~~~~~~~~~~~~~
> > > > > > > > > cc1: all warnings being treated as errors
> > > > > > > > > make[1]: *** [scripts/Makefile.build:290 :
> > > > > > /home/matju/src/mt76/agg-rx.o]
> > > > > > > > > Erreur 1
> > > > > > > > > make: *** [Makefile:1780 : /home/matju/src/mt76] Erreur 2
> > > > > > > > > make : on quitte le répertoire «
> > > > > > /usr/src/linux-headers-5.8.0-41-generic
> > > > > > > »
> > > > > > > > > 
> > > > > > > > > I tried removing -Werror from your Makefile, but the default
> > > still
> > > > > > treats
> > > > > > > > > this warning as an error, so I added -Wno-error instead,
> which
> > > made
> > > > > no
> > > > > > > > > difference, I had to write explicitly
> > > > > > > > > -Wno-error=implicit-function-declaration , but then it seems
> > that
> > > > > this
> > > > > > is
> > > > > > > > > not just a header problem after all, because then I got this
> :
> > > > > > > > > 
> > > > > > > > >   MODPOST /home/matju/src/mt76/Module.symvers
> > > > > > > > > ERROR: modpost: "rcu_swap_protected"
> > > [/home/matju/src/mt76/mt76.ko]
> > > > > > > > > undefined!
> > > > > > > > > make[1]: *** [scripts/Makefile.modpost:111 :
> > > > > > > > > /home/matju/src/mt76/Module.symvers] Erreur 1
> > > > > > > > > make[1]: *** Suppression du fichier «
> > > > > > /home/matju/src/mt76/Module.symvers
> > > > > > > »
> > > > > > > > > make: *** [Makefile:1693 : modules] Erreur 2
> > > > > > > > > make : on quitte le répertoire «
> > > > > > /usr/src/linux-headers-5.8.0-41-generic
> > > > > > > »
> > > > > > > > 
> > > > > > > > I updated the branch to compile against 5.8. Anyway
> > > > > rcu_swap_protected()
> > > > > > > > should be defined in mt76.h
> > > > > > > 
> > > > > > > Hello Lorenzo, 
> > > > > > 
> > > > > > Hi Luca,
> > > > > > 
> > > > > > > 
> > > > > > > is your patch already released in the kernel 5.12.1?
> > > > > > 
> > > > > > nope since I have not received any feedback. Are you able to test
> it?
> > > (I
> > > > do
> > > > > > not have the mt7630e adapter) 
> > > > > > 
> > > > > > > 
> > > > > > > I have also another problem with the MT7630e (besides the one
> with
> > > the
> > > > > > sleep
> > > > > > > command): sometimes on my laptop the wifi disappears and only the
> > > wire
> > > > > > > connectivity is present. In order to make it working again I need
> > to
> > > > > > > hibernate my laptop and power-on it again so that it loads again
> > the
> > > > > > driver.
> > > > > > > Do you know what can be the issue and eventually the solution?
> > > > > > 
> > > > > > can you please describe when the issue occurs? do you have any info
> > in
> > > > the
> > > > > > syslog?
> > > > > > 
> > > > > > Regards,
> > > > > > Lorenzo
> > > > > > 
> > > > > > > 
> > > > > > > Thanks in advance,
> > > > > > > 
> > > > > > > Luca T.
> > > > > 
> > > > > Hi Lorenzo,
> > > > > 
> > > > > yes, I have the hardware to test this patch.
> > > > > 
> > > > > I just installed the vanilla version of kernel 5.12.1, can you please
> > > > > provide me the link to the patch?
> > > > 
> > > > it is linked in the bz (it has the wrong mt76x0u name)
> > > > 
> > > > > 
> > > > > For the other issue I'll check the journal and provide you additional
> > > > > details soon (unfornately it happens once a day :) so I'll come back
> > > > > quickly).
> > > > > 
> > > > > Thanks in advance,
> > > > > 
> > > > > Luca
> > > 
> > > Hi Lorenzo,
> > > 
> > > it's quite a bit of time I'm recompiling kernel (~15 years :) ) so I have
> > > some difficulties...
> > > Since I have a working kernel from the Linux Mint distributions, I copied
> > > the configuration file in the new kernel directory and I recompiled it.
> > > The problem is that when I'm restarting the kernel does not load some
> > > drivers, hence linux can't find the hard disk and it goes in kernel
> panic.
> > > 
> > > Did I miss anything in the following compiling steps:
> > > 1) Extract kernel in /usr/src
> > > 2) Patch kernel (patch -p1 < <patch file>)
> > > 3) Copy config file: cp /boot/config-$(uname -r) .config
> > > 4) make menuconfig in case of changes (here I didn't change anything for
> > now)
> > > 5) make -j12
> > > 6) make bzImage (it seems required by Linux Mint)
> > > 7) make modules_install
> > > 8) Copy the configuration file back: cp .config /boot/config-5.12.1
> > > 9) make install
> > > 10) update-grub2
> > > 
> > > Did I miss anything?
> > > 
> > > Thanks,
> > > 
> > > Luca
> > 
> > Hi Lorenzo,
> > 
> > I managed somehow to make the new kernel loading and your patch seems
> > working fine since I'm able to suspend and resume my laptop and the driver
> > reloads correctly and connectivity is re-established.
> > 
> > You can proceed to merge the patch to the kernel.
> 
> nice. So you confirm now suspend/resume is fine. Can you please keep testing
> it for a while?
> 
> > 
> > In order to make it working temporarily I had to:
> > 1) append "nomodeset" parameter otherwise the screen is black
> > 2) replace the UUID identifier of my partition with the partition number
> > itself (like /dev/sda4)
> > 3) remove "initrd" line since laptop freezes when loading the image
> > 
> > When I'm installing the kernel I see this issue:
> > ---------------------------------------------------
> > root@oldlaptop:/usr/src/linux-5.12.1-MT7630e-patch# make install
> > sh ./arch/x86/boot/install.sh 5.12.1 arch/x86/boot/bzImage \
> >         System.map "/boot"
> > run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 5.12.1
> > /boot/vmlinuz-5.12.1
> > run-parts: executing /etc/kernel/postinst.d/dkms 5.12.1
> /boot/vmlinuz-5.12.1
> >  * dkms: running auto installation service for kernel 5.12.1                
> > Error!  The /var/lib/dkms/ndiswrapper/1.60/5.12.1/x86_64/dkms.conf for
> > module ndiswrapper includes a BUILD_EXCLUSIVE directive which
> > does not match this kernel/arch.  This indicates that it should not be
> built.
> >                                                                             
> > [ OK ]
> > run-parts: executing /etc/kernel/postinst.d/initramfs-tools 5.12.1
> > /boot/vmlinuz-5.12.1
> > update-initramfs: Generating /boot/initrd.img-5.12.1
> > W: Possible missing firmware /lib/firmware/i915/skl_guc_49.0.1.bin for
> > module i915
> > ...
> > -----------------------------------------------------
> > 
> 
> I am not familiar with mint build system. Is it enough to run make, make
> modules_install; make install or do you need to create the .deb file?
> 
> > Could you please help me to resolve the issues I have in the kernel
> > installation?
> > 
> > Thanks in advance,
> > 
> > Luca

Hi Lorenzo,

sorry for bothering you, I continued today to make some tests.

I isolated the problem where the laptop got stuck after resume: I disabled the graphical UI since I discovered that the radeon card has a bug in the kernel :(

During my test I suspended linux in text mode and I successfully resumed the laptop, the wifi, and the connectivity: everything works correctly without any "magic script" from my side.

I just noticed that a message appeared after resuming wifi:

mt76x0e 0000:04:00.0: driver does not support HW RF ctrl

What do you think?

Thanks,

Luca
Comment 26 Lorenzo Bianconi 2021-05-07 07:23:09 UTC
(In reply to Luca T. from comment #25)
> (In reply to Lorenzo Bianconi from comment #22)
> > (In reply to Luca T. from comment #21)
> > > (In reply to Luca T. from comment #20)
> > > > (In reply to Lorenzo Bianconi from comment #19)
> > > > > (In reply to Luca T. from comment #18)
> > > > > > (In reply to Lorenzo Bianconi from comment #17)
> > > > > > > (In reply to Luca T. from comment #16)
> > > > > > > > (In reply to Lorenzo Bianconi from comment #15)
> > > > > > > > > (In reply to Mathieu Bouchard from comment #14)
> > > > > > > > > > Doing `make -C /lib/modules/$(uname -r)/build M=$PWD` ,
> where
> > > > uname
> > > > > > -r
> > > > > > > > > > currently gives 5.8.0-41-generic ; I get this error message
> :
> > > > > > > > > > 
> > > > > > > > > >   CC [M]  /home/matju/src/mt76/agg-rx.o
> > > > > > > > > > /home/matju/src/mt76/agg-rx.c: In function
> > `mt76_rx_aggr_stop':
> > > > > > > > > > /home/matju/src/mt76/agg-rx.c:293:2: error: implicit
> > > declaration
> > > > of
> > > > > > > > > function
> > > > > > > > > > `rcu_swap_protected'
> [-Werror=implicit-function-declaration]
> > > > > > > > > >   293 |  rcu_swap_protected(wcid->aggr[tidno], tid,
> > > > > > > > > >       |  ^~~~~~~~~~~~~~~~~~
> > > > > > > > > > cc1: all warnings being treated as errors
> > > > > > > > > > make[1]: *** [scripts/Makefile.build:290 :
> > > > > > > /home/matju/src/mt76/agg-rx.o]
> > > > > > > > > > Erreur 1
> > > > > > > > > > make: *** [Makefile:1780 : /home/matju/src/mt76] Erreur 2
> > > > > > > > > > make : on quitte le répertoire «
> > > > > > > /usr/src/linux-headers-5.8.0-41-generic
> > > > > > > > »
> > > > > > > > > > 
> > > > > > > > > > I tried removing -Werror from your Makefile, but the
> default
> > > > still
> > > > > > > treats
> > > > > > > > > > this warning as an error, so I added -Wno-error instead,
> > which
> > > > made
> > > > > > no
> > > > > > > > > > difference, I had to write explicitly
> > > > > > > > > > -Wno-error=implicit-function-declaration , but then it
> seems
> > > that
> > > > > > this
> > > > > > > is
> > > > > > > > > > not just a header problem after all, because then I got
> this
> > :
> > > > > > > > > > 
> > > > > > > > > >   MODPOST /home/matju/src/mt76/Module.symvers
> > > > > > > > > > ERROR: modpost: "rcu_swap_protected"
> > > > [/home/matju/src/mt76/mt76.ko]
> > > > > > > > > > undefined!
> > > > > > > > > > make[1]: *** [scripts/Makefile.modpost:111 :
> > > > > > > > > > /home/matju/src/mt76/Module.symvers] Erreur 1
> > > > > > > > > > make[1]: *** Suppression du fichier «
> > > > > > > /home/matju/src/mt76/Module.symvers
> > > > > > > > »
> > > > > > > > > > make: *** [Makefile:1693 : modules] Erreur 2
> > > > > > > > > > make : on quitte le répertoire «
> > > > > > > /usr/src/linux-headers-5.8.0-41-generic
> > > > > > > > »
> > > > > > > > > 
> > > > > > > > > I updated the branch to compile against 5.8. Anyway
> > > > > > rcu_swap_protected()
> > > > > > > > > should be defined in mt76.h
> > > > > > > > 
> > > > > > > > Hello Lorenzo, 
> > > > > > > 
> > > > > > > Hi Luca,
> > > > > > > 
> > > > > > > > 
> > > > > > > > is your patch already released in the kernel 5.12.1?
> > > > > > > 
> > > > > > > nope since I have not received any feedback. Are you able to test
> > it?
> > > > (I
> > > > > do
> > > > > > > not have the mt7630e adapter) 
> > > > > > > 
> > > > > > > > 
> > > > > > > > I have also another problem with the MT7630e (besides the one
> > with
> > > > the
> > > > > > > sleep
> > > > > > > > command): sometimes on my laptop the wifi disappears and only
> the
> > > > wire
> > > > > > > > connectivity is present. In order to make it working again I
> need
> > > to
> > > > > > > > hibernate my laptop and power-on it again so that it loads
> again
> > > the
> > > > > > > driver.
> > > > > > > > Do you know what can be the issue and eventually the solution?
> > > > > > > 
> > > > > > > can you please describe when the issue occurs? do you have any
> info
> > > in
> > > > > the
> > > > > > > syslog?
> > > > > > > 
> > > > > > > Regards,
> > > > > > > Lorenzo
> > > > > > > 
> > > > > > > > 
> > > > > > > > Thanks in advance,
> > > > > > > > 
> > > > > > > > Luca T.
> > > > > > 
> > > > > > Hi Lorenzo,
> > > > > > 
> > > > > > yes, I have the hardware to test this patch.
> > > > > > 
> > > > > > I just installed the vanilla version of kernel 5.12.1, can you
> please
> > > > > > provide me the link to the patch?
> > > > > 
> > > > > it is linked in the bz (it has the wrong mt76x0u name)
> > > > > 
> > > > > > 
> > > > > > For the other issue I'll check the journal and provide you
> additional
> > > > > > details soon (unfornately it happens once a day :) so I'll come
> back
> > > > > > quickly).
> > > > > > 
> > > > > > Thanks in advance,
> > > > > > 
> > > > > > Luca
> > > > 
> > > > Hi Lorenzo,
> > > > 
> > > > it's quite a bit of time I'm recompiling kernel (~15 years :) ) so I
> have
> > > > some difficulties...
> > > > Since I have a working kernel from the Linux Mint distributions, I
> copied
> > > > the configuration file in the new kernel directory and I recompiled it.
> > > > The problem is that when I'm restarting the kernel does not load some
> > > > drivers, hence linux can't find the hard disk and it goes in kernel
> > panic.
> > > > 
> > > > Did I miss anything in the following compiling steps:
> > > > 1) Extract kernel in /usr/src
> > > > 2) Patch kernel (patch -p1 < <patch file>)
> > > > 3) Copy config file: cp /boot/config-$(uname -r) .config
> > > > 4) make menuconfig in case of changes (here I didn't change anything
> for
> > > now)
> > > > 5) make -j12
> > > > 6) make bzImage (it seems required by Linux Mint)
> > > > 7) make modules_install
> > > > 8) Copy the configuration file back: cp .config /boot/config-5.12.1
> > > > 9) make install
> > > > 10) update-grub2
> > > > 
> > > > Did I miss anything?
> > > > 
> > > > Thanks,
> > > > 
> > > > Luca
> > > 
> > > Hi Lorenzo,
> > > 
> > > I managed somehow to make the new kernel loading and your patch seems
> > > working fine since I'm able to suspend and resume my laptop and the
> driver
> > > reloads correctly and connectivity is re-established.
> > > 
> > > You can proceed to merge the patch to the kernel.
> > 
> > nice. So you confirm now suspend/resume is fine. Can you please keep
> testing
> > it for a while?
> > 
> > > 
> > > In order to make it working temporarily I had to:
> > > 1) append "nomodeset" parameter otherwise the screen is black
> > > 2) replace the UUID identifier of my partition with the partition number
> > > itself (like /dev/sda4)
> > > 3) remove "initrd" line since laptop freezes when loading the image
> > > 
> > > When I'm installing the kernel I see this issue:
> > > ---------------------------------------------------
> > > root@oldlaptop:/usr/src/linux-5.12.1-MT7630e-patch# make install
> > > sh ./arch/x86/boot/install.sh 5.12.1 arch/x86/boot/bzImage \
> > >         System.map "/boot"
> > > run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 5.12.1
> > > /boot/vmlinuz-5.12.1
> > > run-parts: executing /etc/kernel/postinst.d/dkms 5.12.1
> > /boot/vmlinuz-5.12.1
> > >  * dkms: running auto installation service for kernel 5.12.1              
> > > Error!  The /var/lib/dkms/ndiswrapper/1.60/5.12.1/x86_64/dkms.conf for
> > > module ndiswrapper includes a BUILD_EXCLUSIVE directive which
> > > does not match this kernel/arch.  This indicates that it should not be
> > built.
> > >                                                                           
> > > [ OK ]
> > > run-parts: executing /etc/kernel/postinst.d/initramfs-tools 5.12.1
> > > /boot/vmlinuz-5.12.1
> > > update-initramfs: Generating /boot/initrd.img-5.12.1
> > > W: Possible missing firmware /lib/firmware/i915/skl_guc_49.0.1.bin for
> > > module i915
> > > ...
> > > -----------------------------------------------------
> > > 
> > 
> > I am not familiar with mint build system. Is it enough to run make, make
> > modules_install; make install or do you need to create the .deb file?
> > 
> > > Could you please help me to resolve the issues I have in the kernel
> > > installation?
> > > 
> > > Thanks in advance,
> > > 
> > > Luca
> 
> Hi Lorenzo,
> 
> sorry for bothering you, I continued today to make some tests.
> 
> I isolated the problem where the laptop got stuck after resume: I disabled
> the graphical UI since I discovered that the radeon card has a bug in the
> kernel :(
> 
> During my test I suspended linux in text mode and I successfully resumed the
> laptop, the wifi, and the connectivity: everything works correctly without
> any "magic script" from my side.

ok, thx for sharing. Can you please confirm my patch is not necessary?

> 
> I just noticed that a message appeared after resuming wifi:
> 
> mt76x0e 0000:04:00.0: driver does not support HW RF ctrl
> 
> What do you think?

this means the radio is controlled in sw, this is info harmful (probably it is enough dev_info instead of dev_err)

Lorenzo

> 
> Thanks,
> 
> Luca
Comment 27 Luca T. 2021-05-07 08:52:23 UTC
(In reply to Lorenzo Bianconi from comment #26)
> (In reply to Luca T. from comment #25)
> > (In reply to Lorenzo Bianconi from comment #22)
> > > (In reply to Luca T. from comment #21)
> > > > (In reply to Luca T. from comment #20)
> > > > > (In reply to Lorenzo Bianconi from comment #19)
> > > > > > (In reply to Luca T. from comment #18)
> > > > > > > (In reply to Lorenzo Bianconi from comment #17)
> > > > > > > > (In reply to Luca T. from comment #16)
> > > > > > > > > (In reply to Lorenzo Bianconi from comment #15)
> > > > > > > > > > (In reply to Mathieu Bouchard from comment #14)
> > > > > > > > > > > Doing `make -C /lib/modules/$(uname -r)/build M=$PWD` ,
> > where
> > > > > uname
> > > > > > > -r
> > > > > > > > > > > currently gives 5.8.0-41-generic ; I get this error
> message
> > :
> > > > > > > > > > > 
> > > > > > > > > > >   CC [M]  /home/matju/src/mt76/agg-rx.o
> > > > > > > > > > > /home/matju/src/mt76/agg-rx.c: In function
> > > `mt76_rx_aggr_stop':
> > > > > > > > > > > /home/matju/src/mt76/agg-rx.c:293:2: error: implicit
> > > > declaration
> > > > > of
> > > > > > > > > > function
> > > > > > > > > > > `rcu_swap_protected'
> > [-Werror=implicit-function-declaration]
> > > > > > > > > > >   293 |  rcu_swap_protected(wcid->aggr[tidno], tid,
> > > > > > > > > > >       |  ^~~~~~~~~~~~~~~~~~
> > > > > > > > > > > cc1: all warnings being treated as errors
> > > > > > > > > > > make[1]: *** [scripts/Makefile.build:290 :
> > > > > > > > /home/matju/src/mt76/agg-rx.o]
> > > > > > > > > > > Erreur 1
> > > > > > > > > > > make: *** [Makefile:1780 : /home/matju/src/mt76] Erreur 2
> > > > > > > > > > > make : on quitte le répertoire «
> > > > > > > > /usr/src/linux-headers-5.8.0-41-generic
> > > > > > > > > »
> > > > > > > > > > > 
> > > > > > > > > > > I tried removing -Werror from your Makefile, but the
> > default
> > > > > still
> > > > > > > > treats
> > > > > > > > > > > this warning as an error, so I added -Wno-error instead,
> > > which
> > > > > made
> > > > > > > no
> > > > > > > > > > > difference, I had to write explicitly
> > > > > > > > > > > -Wno-error=implicit-function-declaration , but then it
> > seems
> > > > that
> > > > > > > this
> > > > > > > > is
> > > > > > > > > > > not just a header problem after all, because then I got
> > this
> > > :
> > > > > > > > > > > 
> > > > > > > > > > >   MODPOST /home/matju/src/mt76/Module.symvers
> > > > > > > > > > > ERROR: modpost: "rcu_swap_protected"
> > > > > [/home/matju/src/mt76/mt76.ko]
> > > > > > > > > > > undefined!
> > > > > > > > > > > make[1]: *** [scripts/Makefile.modpost:111 :
> > > > > > > > > > > /home/matju/src/mt76/Module.symvers] Erreur 1
> > > > > > > > > > > make[1]: *** Suppression du fichier «
> > > > > > > > /home/matju/src/mt76/Module.symvers
> > > > > > > > > »
> > > > > > > > > > > make: *** [Makefile:1693 : modules] Erreur 2
> > > > > > > > > > > make : on quitte le répertoire «
> > > > > > > > /usr/src/linux-headers-5.8.0-41-generic
> > > > > > > > > »
> > > > > > > > > > 
> > > > > > > > > > I updated the branch to compile against 5.8. Anyway
> > > > > > > rcu_swap_protected()
> > > > > > > > > > should be defined in mt76.h
> > > > > > > > > 
> > > > > > > > > Hello Lorenzo, 
> > > > > > > > 
> > > > > > > > Hi Luca,
> > > > > > > > 
> > > > > > > > > 
> > > > > > > > > is your patch already released in the kernel 5.12.1?
> > > > > > > > 
> > > > > > > > nope since I have not received any feedback. Are you able to
> test
> > > it?
> > > > > (I
> > > > > > do
> > > > > > > > not have the mt7630e adapter) 
> > > > > > > > 
> > > > > > > > > 
> > > > > > > > > I have also another problem with the MT7630e (besides the one
> > > with
> > > > > the
> > > > > > > > sleep
> > > > > > > > > command): sometimes on my laptop the wifi disappears and only
> > the
> > > > > wire
> > > > > > > > > connectivity is present. In order to make it working again I
> > need
> > > > to
> > > > > > > > > hibernate my laptop and power-on it again so that it loads
> > again
> > > > the
> > > > > > > > driver.
> > > > > > > > > Do you know what can be the issue and eventually the
> solution?
> > > > > > > > 
> > > > > > > > can you please describe when the issue occurs? do you have any
> > info
> > > > in
> > > > > > the
> > > > > > > > syslog?
> > > > > > > > 
> > > > > > > > Regards,
> > > > > > > > Lorenzo
> > > > > > > > 
> > > > > > > > > 
> > > > > > > > > Thanks in advance,
> > > > > > > > > 
> > > > > > > > > Luca T.
> > > > > > > 
> > > > > > > Hi Lorenzo,
> > > > > > > 
> > > > > > > yes, I have the hardware to test this patch.
> > > > > > > 
> > > > > > > I just installed the vanilla version of kernel 5.12.1, can you
> > please
> > > > > > > provide me the link to the patch?
> > > > > > 
> > > > > > it is linked in the bz (it has the wrong mt76x0u name)
> > > > > > 
> > > > > > > 
> > > > > > > For the other issue I'll check the journal and provide you
> > additional
> > > > > > > details soon (unfornately it happens once a day :) so I'll come
> > back
> > > > > > > quickly).
> > > > > > > 
> > > > > > > Thanks in advance,
> > > > > > > 
> > > > > > > Luca
> > > > > 
> > > > > Hi Lorenzo,
> > > > > 
> > > > > it's quite a bit of time I'm recompiling kernel (~15 years :) ) so I
> > have
> > > > > some difficulties...
> > > > > Since I have a working kernel from the Linux Mint distributions, I
> > copied
> > > > > the configuration file in the new kernel directory and I recompiled
> it.
> > > > > The problem is that when I'm restarting the kernel does not load some
> > > > > drivers, hence linux can't find the hard disk and it goes in kernel
> > > panic.
> > > > > 
> > > > > Did I miss anything in the following compiling steps:
> > > > > 1) Extract kernel in /usr/src
> > > > > 2) Patch kernel (patch -p1 < <patch file>)
> > > > > 3) Copy config file: cp /boot/config-$(uname -r) .config
> > > > > 4) make menuconfig in case of changes (here I didn't change anything
> > for
> > > > now)
> > > > > 5) make -j12
> > > > > 6) make bzImage (it seems required by Linux Mint)
> > > > > 7) make modules_install
> > > > > 8) Copy the configuration file back: cp .config /boot/config-5.12.1
> > > > > 9) make install
> > > > > 10) update-grub2
> > > > > 
> > > > > Did I miss anything?
> > > > > 
> > > > > Thanks,
> > > > > 
> > > > > Luca
> > > > 
> > > > Hi Lorenzo,
> > > > 
> > > > I managed somehow to make the new kernel loading and your patch seems
> > > > working fine since I'm able to suspend and resume my laptop and the
> > driver
> > > > reloads correctly and connectivity is re-established.
> > > > 
> > > > You can proceed to merge the patch to the kernel.
> > > 
> > > nice. So you confirm now suspend/resume is fine. Can you please keep
> > testing
> > > it for a while?
> > > 
> > > > 
> > > > In order to make it working temporarily I had to:
> > > > 1) append "nomodeset" parameter otherwise the screen is black
> > > > 2) replace the UUID identifier of my partition with the partition
> number
> > > > itself (like /dev/sda4)
> > > > 3) remove "initrd" line since laptop freezes when loading the image
> > > > 
> > > > When I'm installing the kernel I see this issue:
> > > > ---------------------------------------------------
> > > > root@oldlaptop:/usr/src/linux-5.12.1-MT7630e-patch# make install
> > > > sh ./arch/x86/boot/install.sh 5.12.1 arch/x86/boot/bzImage \
> > > >         System.map "/boot"
> > > > run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 5.12.1
> > > > /boot/vmlinuz-5.12.1
> > > > run-parts: executing /etc/kernel/postinst.d/dkms 5.12.1
> > > /boot/vmlinuz-5.12.1
> > > >  * dkms: running auto installation service for kernel 5.12.1            
> > > > Error!  The /var/lib/dkms/ndiswrapper/1.60/5.12.1/x86_64/dkms.conf for
> > > > module ndiswrapper includes a BUILD_EXCLUSIVE directive which
> > > > does not match this kernel/arch.  This indicates that it should not be
> > > built.
> > > >                                                                         
> > > > [ OK ]
> > > > run-parts: executing /etc/kernel/postinst.d/initramfs-tools 5.12.1
> > > > /boot/vmlinuz-5.12.1
> > > > update-initramfs: Generating /boot/initrd.img-5.12.1
> > > > W: Possible missing firmware /lib/firmware/i915/skl_guc_49.0.1.bin for
> > > > module i915
> > > > ...
> > > > -----------------------------------------------------
> > > > 
> > > 
> > > I am not familiar with mint build system. Is it enough to run make, make
> > > modules_install; make install or do you need to create the .deb file?
> > > 
> > > > Could you please help me to resolve the issues I have in the kernel
> > > > installation?
> > > > 
> > > > Thanks in advance,
> > > > 
> > > > Luca
> > 
> > Hi Lorenzo,
> > 
> > sorry for bothering you, I continued today to make some tests.
> > 
> > I isolated the problem where the laptop got stuck after resume: I disabled
> > the graphical UI since I discovered that the radeon card has a bug in the
> > kernel :(
> > 
> > During my test I suspended linux in text mode and I successfully resumed
> the
> > laptop, the wifi, and the connectivity: everything works correctly without
> > any "magic script" from my side.
> 
> ok, thx for sharing. Can you please confirm my patch is not necessary?
> 
> > 
> > I just noticed that a message appeared after resuming wifi:
> > 
> > mt76x0e 0000:04:00.0: driver does not support HW RF ctrl
> > 
> > What do you think?
> 
> this means the radio is controlled in sw, this is info harmful (probably it
> is enough dev_info instead of dev_err)
> 
> Lorenzo
> 
> > 
> > Thanks,
> > 
> > Luca

Hi Lorenzo,

your patch is definitely required.

Thanks,

Luca
Comment 28 Lorenzo Bianconi 2021-05-07 09:21:12 UTC
(In reply to Luca T. from comment #27)
> (In reply to Lorenzo Bianconi from comment #26)
> > (In reply to Luca T. from comment #25)
> > > (In reply to Lorenzo Bianconi from comment #22)
> > > > (In reply to Luca T. from comment #21)
> > > > > (In reply to Luca T. from comment #20)
> > > > > > (In reply to Lorenzo Bianconi from comment #19)
> > > > > > > (In reply to Luca T. from comment #18)
> > > > > > > > (In reply to Lorenzo Bianconi from comment #17)
> > > > > > > > > (In reply to Luca T. from comment #16)
> > > > > > > > > > (In reply to Lorenzo Bianconi from comment #15)
> > > > > > > > > > > (In reply to Mathieu Bouchard from comment #14)
> > > > > > > > > > > > Doing `make -C /lib/modules/$(uname -r)/build M=$PWD` ,
> > > where
> > > > > > uname
> > > > > > > > -r
> > > > > > > > > > > > currently gives 5.8.0-41-generic ; I get this error
> > message
> > > :
> > > > > > > > > > > > 
> > > > > > > > > > > >   CC [M]  /home/matju/src/mt76/agg-rx.o
> > > > > > > > > > > > /home/matju/src/mt76/agg-rx.c: In function
> > > > `mt76_rx_aggr_stop':
> > > > > > > > > > > > /home/matju/src/mt76/agg-rx.c:293:2: error: implicit
> > > > > declaration
> > > > > > of
> > > > > > > > > > > function
> > > > > > > > > > > > `rcu_swap_protected'
> > > [-Werror=implicit-function-declaration]
> > > > > > > > > > > >   293 |  rcu_swap_protected(wcid->aggr[tidno], tid,
> > > > > > > > > > > >       |  ^~~~~~~~~~~~~~~~~~
> > > > > > > > > > > > cc1: all warnings being treated as errors
> > > > > > > > > > > > make[1]: *** [scripts/Makefile.build:290 :
> > > > > > > > > /home/matju/src/mt76/agg-rx.o]
> > > > > > > > > > > > Erreur 1
> > > > > > > > > > > > make: *** [Makefile:1780 : /home/matju/src/mt76] Erreur
> 2
> > > > > > > > > > > > make : on quitte le répertoire «
> > > > > > > > > /usr/src/linux-headers-5.8.0-41-generic
> > > > > > > > > > »
> > > > > > > > > > > > 
> > > > > > > > > > > > I tried removing -Werror from your Makefile, but the
> > > default
> > > > > > still
> > > > > > > > > treats
> > > > > > > > > > > > this warning as an error, so I added -Wno-error
> instead,
> > > > which
> > > > > > made
> > > > > > > > no
> > > > > > > > > > > > difference, I had to write explicitly
> > > > > > > > > > > > -Wno-error=implicit-function-declaration , but then it
> > > seems
> > > > > that
> > > > > > > > this
> > > > > > > > > is
> > > > > > > > > > > > not just a header problem after all, because then I got
> > > this
> > > > :
> > > > > > > > > > > > 
> > > > > > > > > > > >   MODPOST /home/matju/src/mt76/Module.symvers
> > > > > > > > > > > > ERROR: modpost: "rcu_swap_protected"
> > > > > > [/home/matju/src/mt76/mt76.ko]
> > > > > > > > > > > > undefined!
> > > > > > > > > > > > make[1]: *** [scripts/Makefile.modpost:111 :
> > > > > > > > > > > > /home/matju/src/mt76/Module.symvers] Erreur 1
> > > > > > > > > > > > make[1]: *** Suppression du fichier «
> > > > > > > > > /home/matju/src/mt76/Module.symvers
> > > > > > > > > > »
> > > > > > > > > > > > make: *** [Makefile:1693 : modules] Erreur 2
> > > > > > > > > > > > make : on quitte le répertoire «
> > > > > > > > > /usr/src/linux-headers-5.8.0-41-generic
> > > > > > > > > > »
> > > > > > > > > > > 
> > > > > > > > > > > I updated the branch to compile against 5.8. Anyway
> > > > > > > > rcu_swap_protected()
> > > > > > > > > > > should be defined in mt76.h
> > > > > > > > > > 
> > > > > > > > > > Hello Lorenzo, 
> > > > > > > > > 
> > > > > > > > > Hi Luca,
> > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > > is your patch already released in the kernel 5.12.1?
> > > > > > > > > 
> > > > > > > > > nope since I have not received any feedback. Are you able to
> > test
> > > > it?
> > > > > > (I
> > > > > > > do
> > > > > > > > > not have the mt7630e adapter) 
> > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > > I have also another problem with the MT7630e (besides the
> one
> > > > with
> > > > > > the
> > > > > > > > > sleep
> > > > > > > > > > command): sometimes on my laptop the wifi disappears and
> only
> > > the
> > > > > > wire
> > > > > > > > > > connectivity is present. In order to make it working again
> I
> > > need
> > > > > to
> > > > > > > > > > hibernate my laptop and power-on it again so that it loads
> > > again
> > > > > the
> > > > > > > > > driver.
> > > > > > > > > > Do you know what can be the issue and eventually the
> > solution?
> > > > > > > > > 
> > > > > > > > > can you please describe when the issue occurs? do you have
> any
> > > info
> > > > > in
> > > > > > > the
> > > > > > > > > syslog?
> > > > > > > > > 
> > > > > > > > > Regards,
> > > > > > > > > Lorenzo
> > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > > Thanks in advance,
> > > > > > > > > > 
> > > > > > > > > > Luca T.
> > > > > > > > 
> > > > > > > > Hi Lorenzo,
> > > > > > > > 
> > > > > > > > yes, I have the hardware to test this patch.
> > > > > > > > 
> > > > > > > > I just installed the vanilla version of kernel 5.12.1, can you
> > > please
> > > > > > > > provide me the link to the patch?
> > > > > > > 
> > > > > > > it is linked in the bz (it has the wrong mt76x0u name)
> > > > > > > 
> > > > > > > > 
> > > > > > > > For the other issue I'll check the journal and provide you
> > > additional
> > > > > > > > details soon (unfornately it happens once a day :) so I'll come
> > > back
> > > > > > > > quickly).
> > > > > > > > 
> > > > > > > > Thanks in advance,
> > > > > > > > 
> > > > > > > > Luca
> > > > > > 
> > > > > > Hi Lorenzo,
> > > > > > 
> > > > > > it's quite a bit of time I'm recompiling kernel (~15 years :) ) so
> I
> > > have
> > > > > > some difficulties...
> > > > > > Since I have a working kernel from the Linux Mint distributions, I
> > > copied
> > > > > > the configuration file in the new kernel directory and I recompiled
> > it.
> > > > > > The problem is that when I'm restarting the kernel does not load
> some
> > > > > > drivers, hence linux can't find the hard disk and it goes in kernel
> > > > panic.
> > > > > > 
> > > > > > Did I miss anything in the following compiling steps:
> > > > > > 1) Extract kernel in /usr/src
> > > > > > 2) Patch kernel (patch -p1 < <patch file>)
> > > > > > 3) Copy config file: cp /boot/config-$(uname -r) .config
> > > > > > 4) make menuconfig in case of changes (here I didn't change
> anything
> > > for
> > > > > now)
> > > > > > 5) make -j12
> > > > > > 6) make bzImage (it seems required by Linux Mint)
> > > > > > 7) make modules_install
> > > > > > 8) Copy the configuration file back: cp .config /boot/config-5.12.1
> > > > > > 9) make install
> > > > > > 10) update-grub2
> > > > > > 
> > > > > > Did I miss anything?
> > > > > > 
> > > > > > Thanks,
> > > > > > 
> > > > > > Luca
> > > > > 
> > > > > Hi Lorenzo,
> > > > > 
> > > > > I managed somehow to make the new kernel loading and your patch seems
> > > > > working fine since I'm able to suspend and resume my laptop and the
> > > driver
> > > > > reloads correctly and connectivity is re-established.
> > > > > 
> > > > > You can proceed to merge the patch to the kernel.
> > > > 
> > > > nice. So you confirm now suspend/resume is fine. Can you please keep
> > > testing
> > > > it for a while?
> > > > 
> > > > > 
> > > > > In order to make it working temporarily I had to:
> > > > > 1) append "nomodeset" parameter otherwise the screen is black
> > > > > 2) replace the UUID identifier of my partition with the partition
> > number
> > > > > itself (like /dev/sda4)
> > > > > 3) remove "initrd" line since laptop freezes when loading the image
> > > > > 
> > > > > When I'm installing the kernel I see this issue:
> > > > > ---------------------------------------------------
> > > > > root@oldlaptop:/usr/src/linux-5.12.1-MT7630e-patch# make install
> > > > > sh ./arch/x86/boot/install.sh 5.12.1 arch/x86/boot/bzImage \
> > > > >         System.map "/boot"
> > > > > run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 5.12.1
> > > > > /boot/vmlinuz-5.12.1
> > > > > run-parts: executing /etc/kernel/postinst.d/dkms 5.12.1
> > > > /boot/vmlinuz-5.12.1
> > > > >  * dkms: running auto installation service for kernel 5.12.1          
> > > > > Error!  The /var/lib/dkms/ndiswrapper/1.60/5.12.1/x86_64/dkms.conf
> for
> > > > > module ndiswrapper includes a BUILD_EXCLUSIVE directive which
> > > > > does not match this kernel/arch.  This indicates that it should not
> be
> > > > built.
> > > > >                                                                       
> > > > > [ OK ]
> > > > > run-parts: executing /etc/kernel/postinst.d/initramfs-tools 5.12.1
> > > > > /boot/vmlinuz-5.12.1
> > > > > update-initramfs: Generating /boot/initrd.img-5.12.1
> > > > > W: Possible missing firmware /lib/firmware/i915/skl_guc_49.0.1.bin
> for
> > > > > module i915
> > > > > ...
> > > > > -----------------------------------------------------
> > > > > 
> > > > 
> > > > I am not familiar with mint build system. Is it enough to run make,
> make
> > > > modules_install; make install or do you need to create the .deb file?
> > > > 
> > > > > Could you please help me to resolve the issues I have in the kernel
> > > > > installation?
> > > > > 
> > > > > Thanks in advance,
> > > > > 
> > > > > Luca
> > > 
> > > Hi Lorenzo,
> > > 
> > > sorry for bothering you, I continued today to make some tests.
> > > 
> > > I isolated the problem where the laptop got stuck after resume: I
> disabled
> > > the graphical UI since I discovered that the radeon card has a bug in the
> > > kernel :(
> > > 
> > > During my test I suspended linux in text mode and I successfully resumed
> > the
> > > laptop, the wifi, and the connectivity: everything works correctly
> without
> > > any "magic script" from my side.
> > 
> > ok, thx for sharing. Can you please confirm my patch is not necessary?
> > 
> > > 
> > > I just noticed that a message appeared after resuming wifi:
> > > 
> > > mt76x0e 0000:04:00.0: driver does not support HW RF ctrl
> > > 
> > > What do you think?
> > 
> > this means the radio is controlled in sw, this is info harmful (probably it
> > is enough dev_info instead of dev_err)
> > 
> > Lorenzo
> > 
> > > 
> > > Thanks,
> > > 
> > > Luca
> 
> Hi Lorenzo,
> 
> your patch is definitely required.
> 
> Thanks,
> 
> Luca

ok, so you confirm without my patch the suspend/resume process fails on mt76x0e?
Can you please keep testing it?
Comment 29 Luca T. 2021-05-07 09:27:55 UTC
(In reply to Lorenzo Bianconi from comment #28)
> (In reply to Luca T. from comment #27)
> > (In reply to Lorenzo Bianconi from comment #26)
> > > (In reply to Luca T. from comment #25)
> > > > (In reply to Lorenzo Bianconi from comment #22)
> > > > > (In reply to Luca T. from comment #21)
> > > > > > (In reply to Luca T. from comment #20)
> > > > > > > (In reply to Lorenzo Bianconi from comment #19)
> > > > > > > > (In reply to Luca T. from comment #18)
> > > > > > > > > (In reply to Lorenzo Bianconi from comment #17)
> > > > > > > > > > (In reply to Luca T. from comment #16)
> > > > > > > > > > > (In reply to Lorenzo Bianconi from comment #15)
> > > > > > > > > > > > (In reply to Mathieu Bouchard from comment #14)
> > > > > > > > > > > > > Doing `make -C /lib/modules/$(uname -r)/build M=$PWD`
> ,
> > > > where
> > > > > > > uname
> > > > > > > > > -r
> > > > > > > > > > > > > currently gives 5.8.0-41-generic ; I get this error
> > > message
> > > > :
> > > > > > > > > > > > > 
> > > > > > > > > > > > >   CC [M]  /home/matju/src/mt76/agg-rx.o
> > > > > > > > > > > > > /home/matju/src/mt76/agg-rx.c: In function
> > > > > `mt76_rx_aggr_stop':
> > > > > > > > > > > > > /home/matju/src/mt76/agg-rx.c:293:2: error: implicit
> > > > > > declaration
> > > > > > > of
> > > > > > > > > > > > function
> > > > > > > > > > > > > `rcu_swap_protected'
> > > > [-Werror=implicit-function-declaration]
> > > > > > > > > > > > >   293 |  rcu_swap_protected(wcid->aggr[tidno], tid,
> > > > > > > > > > > > >       |  ^~~~~~~~~~~~~~~~~~
> > > > > > > > > > > > > cc1: all warnings being treated as errors
> > > > > > > > > > > > > make[1]: *** [scripts/Makefile.build:290 :
> > > > > > > > > > /home/matju/src/mt76/agg-rx.o]
> > > > > > > > > > > > > Erreur 1
> > > > > > > > > > > > > make: *** [Makefile:1780 : /home/matju/src/mt76]
> Erreur
> > 2
> > > > > > > > > > > > > make : on quitte le répertoire «
> > > > > > > > > > /usr/src/linux-headers-5.8.0-41-generic
> > > > > > > > > > > »
> > > > > > > > > > > > > 
> > > > > > > > > > > > > I tried removing -Werror from your Makefile, but the
> > > > default
> > > > > > > still
> > > > > > > > > > treats
> > > > > > > > > > > > > this warning as an error, so I added -Wno-error
> > instead,
> > > > > which
> > > > > > > made
> > > > > > > > > no
> > > > > > > > > > > > > difference, I had to write explicitly
> > > > > > > > > > > > > -Wno-error=implicit-function-declaration , but then
> it
> > > > seems
> > > > > > that
> > > > > > > > > this
> > > > > > > > > > is
> > > > > > > > > > > > > not just a header problem after all, because then I
> got
> > > > this
> > > > > :
> > > > > > > > > > > > > 
> > > > > > > > > > > > >   MODPOST /home/matju/src/mt76/Module.symvers
> > > > > > > > > > > > > ERROR: modpost: "rcu_swap_protected"
> > > > > > > [/home/matju/src/mt76/mt76.ko]
> > > > > > > > > > > > > undefined!
> > > > > > > > > > > > > make[1]: *** [scripts/Makefile.modpost:111 :
> > > > > > > > > > > > > /home/matju/src/mt76/Module.symvers] Erreur 1
> > > > > > > > > > > > > make[1]: *** Suppression du fichier «
> > > > > > > > > > /home/matju/src/mt76/Module.symvers
> > > > > > > > > > > »
> > > > > > > > > > > > > make: *** [Makefile:1693 : modules] Erreur 2
> > > > > > > > > > > > > make : on quitte le répertoire «
> > > > > > > > > > /usr/src/linux-headers-5.8.0-41-generic
> > > > > > > > > > > »
> > > > > > > > > > > > 
> > > > > > > > > > > > I updated the branch to compile against 5.8. Anyway
> > > > > > > > > rcu_swap_protected()
> > > > > > > > > > > > should be defined in mt76.h
> > > > > > > > > > > 
> > > > > > > > > > > Hello Lorenzo, 
> > > > > > > > > > 
> > > > > > > > > > Hi Luca,
> > > > > > > > > > 
> > > > > > > > > > > 
> > > > > > > > > > > is your patch already released in the kernel 5.12.1?
> > > > > > > > > > 
> > > > > > > > > > nope since I have not received any feedback. Are you able
> to
> > > test
> > > > > it?
> > > > > > > (I
> > > > > > > > do
> > > > > > > > > > not have the mt7630e adapter) 
> > > > > > > > > > 
> > > > > > > > > > > 
> > > > > > > > > > > I have also another problem with the MT7630e (besides the
> > one
> > > > > with
> > > > > > > the
> > > > > > > > > > sleep
> > > > > > > > > > > command): sometimes on my laptop the wifi disappears and
> > only
> > > > the
> > > > > > > wire
> > > > > > > > > > > connectivity is present. In order to make it working
> again
> > I
> > > > need
> > > > > > to
> > > > > > > > > > > hibernate my laptop and power-on it again so that it
> loads
> > > > again
> > > > > > the
> > > > > > > > > > driver.
> > > > > > > > > > > Do you know what can be the issue and eventually the
> > > solution?
> > > > > > > > > > 
> > > > > > > > > > can you please describe when the issue occurs? do you have
> > any
> > > > info
> > > > > > in
> > > > > > > > the
> > > > > > > > > > syslog?
> > > > > > > > > > 
> > > > > > > > > > Regards,
> > > > > > > > > > Lorenzo
> > > > > > > > > > 
> > > > > > > > > > > 
> > > > > > > > > > > Thanks in advance,
> > > > > > > > > > > 
> > > > > > > > > > > Luca T.
> > > > > > > > > 
> > > > > > > > > Hi Lorenzo,
> > > > > > > > > 
> > > > > > > > > yes, I have the hardware to test this patch.
> > > > > > > > > 
> > > > > > > > > I just installed the vanilla version of kernel 5.12.1, can
> you
> > > > please
> > > > > > > > > provide me the link to the patch?
> > > > > > > > 
> > > > > > > > it is linked in the bz (it has the wrong mt76x0u name)
> > > > > > > > 
> > > > > > > > > 
> > > > > > > > > For the other issue I'll check the journal and provide you
> > > > additional
> > > > > > > > > details soon (unfornately it happens once a day :) so I'll
> come
> > > > back
> > > > > > > > > quickly).
> > > > > > > > > 
> > > > > > > > > Thanks in advance,
> > > > > > > > > 
> > > > > > > > > Luca
> > > > > > > 
> > > > > > > Hi Lorenzo,
> > > > > > > 
> > > > > > > it's quite a bit of time I'm recompiling kernel (~15 years :) )
> so
> > I
> > > > have
> > > > > > > some difficulties...
> > > > > > > Since I have a working kernel from the Linux Mint distributions,
> I
> > > > copied
> > > > > > > the configuration file in the new kernel directory and I
> recompiled
> > > it.
> > > > > > > The problem is that when I'm restarting the kernel does not load
> > some
> > > > > > > drivers, hence linux can't find the hard disk and it goes in
> kernel
> > > > > panic.
> > > > > > > 
> > > > > > > Did I miss anything in the following compiling steps:
> > > > > > > 1) Extract kernel in /usr/src
> > > > > > > 2) Patch kernel (patch -p1 < <patch file>)
> > > > > > > 3) Copy config file: cp /boot/config-$(uname -r) .config
> > > > > > > 4) make menuconfig in case of changes (here I didn't change
> > anything
> > > > for
> > > > > > now)
> > > > > > > 5) make -j12
> > > > > > > 6) make bzImage (it seems required by Linux Mint)
> > > > > > > 7) make modules_install
> > > > > > > 8) Copy the configuration file back: cp .config
> /boot/config-5.12.1
> > > > > > > 9) make install
> > > > > > > 10) update-grub2
> > > > > > > 
> > > > > > > Did I miss anything?
> > > > > > > 
> > > > > > > Thanks,
> > > > > > > 
> > > > > > > Luca
> > > > > > 
> > > > > > Hi Lorenzo,
> > > > > > 
> > > > > > I managed somehow to make the new kernel loading and your patch
> seems
> > > > > > working fine since I'm able to suspend and resume my laptop and the
> > > > driver
> > > > > > reloads correctly and connectivity is re-established.
> > > > > > 
> > > > > > You can proceed to merge the patch to the kernel.
> > > > > 
> > > > > nice. So you confirm now suspend/resume is fine. Can you please keep
> > > > testing
> > > > > it for a while?
> > > > > 
> > > > > > 
> > > > > > In order to make it working temporarily I had to:
> > > > > > 1) append "nomodeset" parameter otherwise the screen is black
> > > > > > 2) replace the UUID identifier of my partition with the partition
> > > number
> > > > > > itself (like /dev/sda4)
> > > > > > 3) remove "initrd" line since laptop freezes when loading the image
> > > > > > 
> > > > > > When I'm installing the kernel I see this issue:
> > > > > > ---------------------------------------------------
> > > > > > root@oldlaptop:/usr/src/linux-5.12.1-MT7630e-patch# make install
> > > > > > sh ./arch/x86/boot/install.sh 5.12.1 arch/x86/boot/bzImage \
> > > > > >         System.map "/boot"
> > > > > > run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 5.12.1
> > > > > > /boot/vmlinuz-5.12.1
> > > > > > run-parts: executing /etc/kernel/postinst.d/dkms 5.12.1
> > > > > /boot/vmlinuz-5.12.1
> > > > > >  * dkms: running auto installation service for kernel 5.12.1        
> > > > > > Error!  The /var/lib/dkms/ndiswrapper/1.60/5.12.1/x86_64/dkms.conf
> > for
> > > > > > module ndiswrapper includes a BUILD_EXCLUSIVE directive which
> > > > > > does not match this kernel/arch.  This indicates that it should not
> > be
> > > > > built.
> > > > > >                                                                     
> > > > > > [ OK ]
> > > > > > run-parts: executing /etc/kernel/postinst.d/initramfs-tools 5.12.1
> > > > > > /boot/vmlinuz-5.12.1
> > > > > > update-initramfs: Generating /boot/initrd.img-5.12.1
> > > > > > W: Possible missing firmware /lib/firmware/i915/skl_guc_49.0.1.bin
> > for
> > > > > > module i915
> > > > > > ...
> > > > > > -----------------------------------------------------
> > > > > > 
> > > > > 
> > > > > I am not familiar with mint build system. Is it enough to run make,
> > make
> > > > > modules_install; make install or do you need to create the .deb file?
> > > > > 
> > > > > > Could you please help me to resolve the issues I have in the kernel
> > > > > > installation?
> > > > > > 
> > > > > > Thanks in advance,
> > > > > > 
> > > > > > Luca
> > > > 
> > > > Hi Lorenzo,
> > > > 
> > > > sorry for bothering you, I continued today to make some tests.
> > > > 
> > > > I isolated the problem where the laptop got stuck after resume: I
> > disabled
> > > > the graphical UI since I discovered that the radeon card has a bug in
> the
> > > > kernel :(
> > > > 
> > > > During my test I suspended linux in text mode and I successfully
> resumed
> > > the
> > > > laptop, the wifi, and the connectivity: everything works correctly
> > without
> > > > any "magic script" from my side.
> > > 
> > > ok, thx for sharing. Can you please confirm my patch is not necessary?
> > > 
> > > > 
> > > > I just noticed that a message appeared after resuming wifi:
> > > > 
> > > > mt76x0e 0000:04:00.0: driver does not support HW RF ctrl
> > > > 
> > > > What do you think?
> > > 
> > > this means the radio is controlled in sw, this is info harmful (probably
> it
> > > is enough dev_info instead of dev_err)
> > > 
> > > Lorenzo
> > > 
> > > > 
> > > > Thanks,
> > > > 
> > > > Luca
> > 
> > Hi Lorenzo,
> > 
> > your patch is definitely required.
> > 
> > Thanks,
> > 
> > Luca
> 
> ok, so you confirm without my patch the suspend/resume process fails on
> mt76x0e?
> Can you please keep testing it?

yes, I confirm that without your patch the resume process fails to resume wifi.

I'll keep testing it.
Comment 30 Lorenzo Bianconi 2021-05-07 09:29:15 UTC
(In reply to Luca T. from comment #29)
> (In reply to Lorenzo Bianconi from comment #28)
> > (In reply to Luca T. from comment #27)
> > > (In reply to Lorenzo Bianconi from comment #26)
> > > > (In reply to Luca T. from comment #25)
> > > > > (In reply to Lorenzo Bianconi from comment #22)
> > > > > > (In reply to Luca T. from comment #21)
> > > > > > > (In reply to Luca T. from comment #20)
> > > > > > > > (In reply to Lorenzo Bianconi from comment #19)
> > > > > > > > > (In reply to Luca T. from comment #18)
> > > > > > > > > > (In reply to Lorenzo Bianconi from comment #17)
> > > > > > > > > > > (In reply to Luca T. from comment #16)
> > > > > > > > > > > > (In reply to Lorenzo Bianconi from comment #15)
> > > > > > > > > > > > > (In reply to Mathieu Bouchard from comment #14)
> > > > > > > > > > > > > > Doing `make -C /lib/modules/$(uname -r)/build
> M=$PWD`
> > ,
> > > > > where
> > > > > > > > uname
> > > > > > > > > > -r
> > > > > > > > > > > > > > currently gives 5.8.0-41-generic ; I get this error
> > > > message
> > > > > :
> > > > > > > > > > > > > > 
> > > > > > > > > > > > > >   CC [M]  /home/matju/src/mt76/agg-rx.o
> > > > > > > > > > > > > > /home/matju/src/mt76/agg-rx.c: In function
> > > > > > `mt76_rx_aggr_stop':
> > > > > > > > > > > > > > /home/matju/src/mt76/agg-rx.c:293:2: error:
> implicit
> > > > > > > declaration
> > > > > > > > of
> > > > > > > > > > > > > function
> > > > > > > > > > > > > > `rcu_swap_protected'
> > > > > [-Werror=implicit-function-declaration]
> > > > > > > > > > > > > >   293 |  rcu_swap_protected(wcid->aggr[tidno], tid,
> > > > > > > > > > > > > >       |  ^~~~~~~~~~~~~~~~~~
> > > > > > > > > > > > > > cc1: all warnings being treated as errors
> > > > > > > > > > > > > > make[1]: *** [scripts/Makefile.build:290 :
> > > > > > > > > > > /home/matju/src/mt76/agg-rx.o]
> > > > > > > > > > > > > > Erreur 1
> > > > > > > > > > > > > > make: *** [Makefile:1780 : /home/matju/src/mt76]
> > Erreur
> > > 2
> > > > > > > > > > > > > > make : on quitte le répertoire «
> > > > > > > > > > > /usr/src/linux-headers-5.8.0-41-generic
> > > > > > > > > > > > »
> > > > > > > > > > > > > > 
> > > > > > > > > > > > > > I tried removing -Werror from your Makefile, but
> the
> > > > > default
> > > > > > > > still
> > > > > > > > > > > treats
> > > > > > > > > > > > > > this warning as an error, so I added -Wno-error
> > > instead,
> > > > > > which
> > > > > > > > made
> > > > > > > > > > no
> > > > > > > > > > > > > > difference, I had to write explicitly
> > > > > > > > > > > > > > -Wno-error=implicit-function-declaration , but then
> > it
> > > > > seems
> > > > > > > that
> > > > > > > > > > this
> > > > > > > > > > > is
> > > > > > > > > > > > > > not just a header problem after all, because then I
> > got
> > > > > this
> > > > > > :
> > > > > > > > > > > > > > 
> > > > > > > > > > > > > >   MODPOST /home/matju/src/mt76/Module.symvers
> > > > > > > > > > > > > > ERROR: modpost: "rcu_swap_protected"
> > > > > > > > [/home/matju/src/mt76/mt76.ko]
> > > > > > > > > > > > > > undefined!
> > > > > > > > > > > > > > make[1]: *** [scripts/Makefile.modpost:111 :
> > > > > > > > > > > > > > /home/matju/src/mt76/Module.symvers] Erreur 1
> > > > > > > > > > > > > > make[1]: *** Suppression du fichier «
> > > > > > > > > > > /home/matju/src/mt76/Module.symvers
> > > > > > > > > > > > »
> > > > > > > > > > > > > > make: *** [Makefile:1693 : modules] Erreur 2
> > > > > > > > > > > > > > make : on quitte le répertoire «
> > > > > > > > > > > /usr/src/linux-headers-5.8.0-41-generic
> > > > > > > > > > > > »
> > > > > > > > > > > > > 
> > > > > > > > > > > > > I updated the branch to compile against 5.8. Anyway
> > > > > > > > > > rcu_swap_protected()
> > > > > > > > > > > > > should be defined in mt76.h
> > > > > > > > > > > > 
> > > > > > > > > > > > Hello Lorenzo, 
> > > > > > > > > > > 
> > > > > > > > > > > Hi Luca,
> > > > > > > > > > > 
> > > > > > > > > > > > 
> > > > > > > > > > > > is your patch already released in the kernel 5.12.1?
> > > > > > > > > > > 
> > > > > > > > > > > nope since I have not received any feedback. Are you able
> > to
> > > > test
> > > > > > it?
> > > > > > > > (I
> > > > > > > > > do
> > > > > > > > > > > not have the mt7630e adapter) 
> > > > > > > > > > > 
> > > > > > > > > > > > 
> > > > > > > > > > > > I have also another problem with the MT7630e (besides
> the
> > > one
> > > > > > with
> > > > > > > > the
> > > > > > > > > > > sleep
> > > > > > > > > > > > command): sometimes on my laptop the wifi disappears
> and
> > > only
> > > > > the
> > > > > > > > wire
> > > > > > > > > > > > connectivity is present. In order to make it working
> > again
> > > I
> > > > > need
> > > > > > > to
> > > > > > > > > > > > hibernate my laptop and power-on it again so that it
> > loads
> > > > > again
> > > > > > > the
> > > > > > > > > > > driver.
> > > > > > > > > > > > Do you know what can be the issue and eventually the
> > > > solution?
> > > > > > > > > > > 
> > > > > > > > > > > can you please describe when the issue occurs? do you
> have
> > > any
> > > > > info
> > > > > > > in
> > > > > > > > > the
> > > > > > > > > > > syslog?
> > > > > > > > > > > 
> > > > > > > > > > > Regards,
> > > > > > > > > > > Lorenzo
> > > > > > > > > > > 
> > > > > > > > > > > > 
> > > > > > > > > > > > Thanks in advance,
> > > > > > > > > > > > 
> > > > > > > > > > > > Luca T.
> > > > > > > > > > 
> > > > > > > > > > Hi Lorenzo,
> > > > > > > > > > 
> > > > > > > > > > yes, I have the hardware to test this patch.
> > > > > > > > > > 
> > > > > > > > > > I just installed the vanilla version of kernel 5.12.1, can
> > you
> > > > > please
> > > > > > > > > > provide me the link to the patch?
> > > > > > > > > 
> > > > > > > > > it is linked in the bz (it has the wrong mt76x0u name)
> > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > > For the other issue I'll check the journal and provide you
> > > > > additional
> > > > > > > > > > details soon (unfornately it happens once a day :) so I'll
> > come
> > > > > back
> > > > > > > > > > quickly).
> > > > > > > > > > 
> > > > > > > > > > Thanks in advance,
> > > > > > > > > > 
> > > > > > > > > > Luca
> > > > > > > > 
> > > > > > > > Hi Lorenzo,
> > > > > > > > 
> > > > > > > > it's quite a bit of time I'm recompiling kernel (~15 years :) )
> > so
> > > I
> > > > > have
> > > > > > > > some difficulties...
> > > > > > > > Since I have a working kernel from the Linux Mint
> distributions,
> > I
> > > > > copied
> > > > > > > > the configuration file in the new kernel directory and I
> > recompiled
> > > > it.
> > > > > > > > The problem is that when I'm restarting the kernel does not
> load
> > > some
> > > > > > > > drivers, hence linux can't find the hard disk and it goes in
> > kernel
> > > > > > panic.
> > > > > > > > 
> > > > > > > > Did I miss anything in the following compiling steps:
> > > > > > > > 1) Extract kernel in /usr/src
> > > > > > > > 2) Patch kernel (patch -p1 < <patch file>)
> > > > > > > > 3) Copy config file: cp /boot/config-$(uname -r) .config
> > > > > > > > 4) make menuconfig in case of changes (here I didn't change
> > > anything
> > > > > for
> > > > > > > now)
> > > > > > > > 5) make -j12
> > > > > > > > 6) make bzImage (it seems required by Linux Mint)
> > > > > > > > 7) make modules_install
> > > > > > > > 8) Copy the configuration file back: cp .config
> > /boot/config-5.12.1
> > > > > > > > 9) make install
> > > > > > > > 10) update-grub2
> > > > > > > > 
> > > > > > > > Did I miss anything?
> > > > > > > > 
> > > > > > > > Thanks,
> > > > > > > > 
> > > > > > > > Luca
> > > > > > > 
> > > > > > > Hi Lorenzo,
> > > > > > > 
> > > > > > > I managed somehow to make the new kernel loading and your patch
> > seems
> > > > > > > working fine since I'm able to suspend and resume my laptop and
> the
> > > > > driver
> > > > > > > reloads correctly and connectivity is re-established.
> > > > > > > 
> > > > > > > You can proceed to merge the patch to the kernel.
> > > > > > 
> > > > > > nice. So you confirm now suspend/resume is fine. Can you please
> keep
> > > > > testing
> > > > > > it for a while?
> > > > > > 
> > > > > > > 
> > > > > > > In order to make it working temporarily I had to:
> > > > > > > 1) append "nomodeset" parameter otherwise the screen is black
> > > > > > > 2) replace the UUID identifier of my partition with the partition
> > > > number
> > > > > > > itself (like /dev/sda4)
> > > > > > > 3) remove "initrd" line since laptop freezes when loading the
> image
> > > > > > > 
> > > > > > > When I'm installing the kernel I see this issue:
> > > > > > > ---------------------------------------------------
> > > > > > > root@oldlaptop:/usr/src/linux-5.12.1-MT7630e-patch# make install
> > > > > > > sh ./arch/x86/boot/install.sh 5.12.1 arch/x86/boot/bzImage \
> > > > > > >         System.map "/boot"
> > > > > > > run-parts: executing /etc/kernel/postinst.d/apt-auto-removal
> 5.12.1
> > > > > > > /boot/vmlinuz-5.12.1
> > > > > > > run-parts: executing /etc/kernel/postinst.d/dkms 5.12.1
> > > > > > /boot/vmlinuz-5.12.1
> > > > > > >  * dkms: running auto installation service for kernel 5.12.1      
> > > > > > > Error!  The
> /var/lib/dkms/ndiswrapper/1.60/5.12.1/x86_64/dkms.conf
> > > for
> > > > > > > module ndiswrapper includes a BUILD_EXCLUSIVE directive which
> > > > > > > does not match this kernel/arch.  This indicates that it should
> not
> > > be
> > > > > > built.
> > > > > > >                                                                   
> > > > > > > [ OK ]
> > > > > > > run-parts: executing /etc/kernel/postinst.d/initramfs-tools
> 5.12.1
> > > > > > > /boot/vmlinuz-5.12.1
> > > > > > > update-initramfs: Generating /boot/initrd.img-5.12.1
> > > > > > > W: Possible missing firmware
> /lib/firmware/i915/skl_guc_49.0.1.bin
> > > for
> > > > > > > module i915
> > > > > > > ...
> > > > > > > -----------------------------------------------------
> > > > > > > 
> > > > > > 
> > > > > > I am not familiar with mint build system. Is it enough to run make,
> > > make
> > > > > > modules_install; make install or do you need to create the .deb
> file?
> > > > > > 
> > > > > > > Could you please help me to resolve the issues I have in the
> kernel
> > > > > > > installation?
> > > > > > > 
> > > > > > > Thanks in advance,
> > > > > > > 
> > > > > > > Luca
> > > > > 
> > > > > Hi Lorenzo,
> > > > > 
> > > > > sorry for bothering you, I continued today to make some tests.
> > > > > 
> > > > > I isolated the problem where the laptop got stuck after resume: I
> > > disabled
> > > > > the graphical UI since I discovered that the radeon card has a bug in
> > the
> > > > > kernel :(
> > > > > 
> > > > > During my test I suspended linux in text mode and I successfully
> > resumed
> > > > the
> > > > > laptop, the wifi, and the connectivity: everything works correctly
> > > without
> > > > > any "magic script" from my side.
> > > > 
> > > > ok, thx for sharing. Can you please confirm my patch is not necessary?
> > > > 
> > > > > 
> > > > > I just noticed that a message appeared after resuming wifi:
> > > > > 
> > > > > mt76x0e 0000:04:00.0: driver does not support HW RF ctrl
> > > > > 
> > > > > What do you think?
> > > > 
> > > > this means the radio is controlled in sw, this is info harmful
> (probably
> > it
> > > > is enough dev_info instead of dev_err)
> > > > 
> > > > Lorenzo
> > > > 
> > > > > 
> > > > > Thanks,
> > > > > 
> > > > > Luca
> > > 
> > > Hi Lorenzo,
> > > 
> > > your patch is definitely required.
> > > 
> > > Thanks,
> > > 
> > > Luca
> > 
> > ok, so you confirm without my patch the suspend/resume process fails on
> > mt76x0e?
> > Can you please keep testing it?
> 
> yes, I confirm that without your patch the resume process fails to resume
> wifi.
> 
> I'll keep testing it.

ok, thx for sharing. If you confirm there are no other issue, I will post the patch

Regards,
Lorenzo
Comment 31 Luca T. 2021-05-08 07:33:32 UTC
(In reply to Lorenzo Bianconi from comment #30)
> (In reply to Luca T. from comment #29)
> > (In reply to Lorenzo Bianconi from comment #28)
> > > (In reply to Luca T. from comment #27)
> > > > (In reply to Lorenzo Bianconi from comment #26)
> > > > > (In reply to Luca T. from comment #25)
> > > > > > (In reply to Lorenzo Bianconi from comment #22)
> > > > > > > (In reply to Luca T. from comment #21)
> > > > > > > > (In reply to Luca T. from comment #20)
> > > > > > > > > (In reply to Lorenzo Bianconi from comment #19)
> > > > > > > > > > (In reply to Luca T. from comment #18)
> > > > > > > > > > > (In reply to Lorenzo Bianconi from comment #17)
> > > > > > > > > > > > (In reply to Luca T. from comment #16)
> > > > > > > > > > > > > (In reply to Lorenzo Bianconi from comment #15)
> > > > > > > > > > > > > > (In reply to Mathieu Bouchard from comment #14)
> > > > > > > > > > > > > > > Doing `make -C /lib/modules/$(uname -r)/build
> > M=$PWD`
> > > ,
> > > > > > where
> > > > > > > > > uname
> > > > > > > > > > > -r
> > > > > > > > > > > > > > > currently gives 5.8.0-41-generic ; I get this
> error
> > > > > message
> > > > > > :
> > > > > > > > > > > > > > > 
> > > > > > > > > > > > > > >   CC [M]  /home/matju/src/mt76/agg-rx.o
> > > > > > > > > > > > > > > /home/matju/src/mt76/agg-rx.c: In function
> > > > > > > `mt76_rx_aggr_stop':
> > > > > > > > > > > > > > > /home/matju/src/mt76/agg-rx.c:293:2: error:
> > implicit
> > > > > > > > declaration
> > > > > > > > > of
> > > > > > > > > > > > > > function
> > > > > > > > > > > > > > > `rcu_swap_protected'
> > > > > > [-Werror=implicit-function-declaration]
> > > > > > > > > > > > > > >   293 |  rcu_swap_protected(wcid->aggr[tidno],
> tid,
> > > > > > > > > > > > > > >       |  ^~~~~~~~~~~~~~~~~~
> > > > > > > > > > > > > > > cc1: all warnings being treated as errors
> > > > > > > > > > > > > > > make[1]: *** [scripts/Makefile.build:290 :
> > > > > > > > > > > > /home/matju/src/mt76/agg-rx.o]
> > > > > > > > > > > > > > > Erreur 1
> > > > > > > > > > > > > > > make: *** [Makefile:1780 : /home/matju/src/mt76]
> > > Erreur
> > > > 2
> > > > > > > > > > > > > > > make : on quitte le répertoire «
> > > > > > > > > > > > /usr/src/linux-headers-5.8.0-41-generic
> > > > > > > > > > > > > »
> > > > > > > > > > > > > > > 
> > > > > > > > > > > > > > > I tried removing -Werror from your Makefile, but
> > the
> > > > > > default
> > > > > > > > > still
> > > > > > > > > > > > treats
> > > > > > > > > > > > > > > this warning as an error, so I added -Wno-error
> > > > instead,
> > > > > > > which
> > > > > > > > > made
> > > > > > > > > > > no
> > > > > > > > > > > > > > > difference, I had to write explicitly
> > > > > > > > > > > > > > > -Wno-error=implicit-function-declaration , but
> then
> > > it
> > > > > > seems
> > > > > > > > that
> > > > > > > > > > > this
> > > > > > > > > > > > is
> > > > > > > > > > > > > > > not just a header problem after all, because then
> I
> > > got
> > > > > > this
> > > > > > > :
> > > > > > > > > > > > > > > 
> > > > > > > > > > > > > > >   MODPOST /home/matju/src/mt76/Module.symvers
> > > > > > > > > > > > > > > ERROR: modpost: "rcu_swap_protected"
> > > > > > > > > [/home/matju/src/mt76/mt76.ko]
> > > > > > > > > > > > > > > undefined!
> > > > > > > > > > > > > > > make[1]: *** [scripts/Makefile.modpost:111 :
> > > > > > > > > > > > > > > /home/matju/src/mt76/Module.symvers] Erreur 1
> > > > > > > > > > > > > > > make[1]: *** Suppression du fichier «
> > > > > > > > > > > > /home/matju/src/mt76/Module.symvers
> > > > > > > > > > > > > »
> > > > > > > > > > > > > > > make: *** [Makefile:1693 : modules] Erreur 2
> > > > > > > > > > > > > > > make : on quitte le répertoire «
> > > > > > > > > > > > /usr/src/linux-headers-5.8.0-41-generic
> > > > > > > > > > > > > »
> > > > > > > > > > > > > > 
> > > > > > > > > > > > > > I updated the branch to compile against 5.8. Anyway
> > > > > > > > > > > rcu_swap_protected()
> > > > > > > > > > > > > > should be defined in mt76.h
> > > > > > > > > > > > > 
> > > > > > > > > > > > > Hello Lorenzo, 
> > > > > > > > > > > > 
> > > > > > > > > > > > Hi Luca,
> > > > > > > > > > > > 
> > > > > > > > > > > > > 
> > > > > > > > > > > > > is your patch already released in the kernel 5.12.1?
> > > > > > > > > > > > 
> > > > > > > > > > > > nope since I have not received any feedback. Are you
> able
> > > to
> > > > > test
> > > > > > > it?
> > > > > > > > > (I
> > > > > > > > > > do
> > > > > > > > > > > > not have the mt7630e adapter) 
> > > > > > > > > > > > 
> > > > > > > > > > > > > 
> > > > > > > > > > > > > I have also another problem with the MT7630e (besides
> > the
> > > > one
> > > > > > > with
> > > > > > > > > the
> > > > > > > > > > > > sleep
> > > > > > > > > > > > > command): sometimes on my laptop the wifi disappears
> > and
> > > > only
> > > > > > the
> > > > > > > > > wire
> > > > > > > > > > > > > connectivity is present. In order to make it working
> > > again
> > > > I
> > > > > > need
> > > > > > > > to
> > > > > > > > > > > > > hibernate my laptop and power-on it again so that it
> > > loads
> > > > > > again
> > > > > > > > the
> > > > > > > > > > > > driver.
> > > > > > > > > > > > > Do you know what can be the issue and eventually the
> > > > > solution?
> > > > > > > > > > > > 
> > > > > > > > > > > > can you please describe when the issue occurs? do you
> > have
> > > > any
> > > > > > info
> > > > > > > > in
> > > > > > > > > > the
> > > > > > > > > > > > syslog?
> > > > > > > > > > > > 
> > > > > > > > > > > > Regards,
> > > > > > > > > > > > Lorenzo
> > > > > > > > > > > > 
> > > > > > > > > > > > > 
> > > > > > > > > > > > > Thanks in advance,
> > > > > > > > > > > > > 
> > > > > > > > > > > > > Luca T.
> > > > > > > > > > > 
> > > > > > > > > > > Hi Lorenzo,
> > > > > > > > > > > 
> > > > > > > > > > > yes, I have the hardware to test this patch.
> > > > > > > > > > > 
> > > > > > > > > > > I just installed the vanilla version of kernel 5.12.1,
> can
> > > you
> > > > > > please
> > > > > > > > > > > provide me the link to the patch?
> > > > > > > > > > 
> > > > > > > > > > it is linked in the bz (it has the wrong mt76x0u name)
> > > > > > > > > > 
> > > > > > > > > > > 
> > > > > > > > > > > For the other issue I'll check the journal and provide
> you
> > > > > > additional
> > > > > > > > > > > details soon (unfornately it happens once a day :) so
> I'll
> > > come
> > > > > > back
> > > > > > > > > > > quickly).
> > > > > > > > > > > 
> > > > > > > > > > > Thanks in advance,
> > > > > > > > > > > 
> > > > > > > > > > > Luca
> > > > > > > > > 
> > > > > > > > > Hi Lorenzo,
> > > > > > > > > 
> > > > > > > > > it's quite a bit of time I'm recompiling kernel (~15 years :)
> )
> > > so
> > > > I
> > > > > > have
> > > > > > > > > some difficulties...
> > > > > > > > > Since I have a working kernel from the Linux Mint
> > distributions,
> > > I
> > > > > > copied
> > > > > > > > > the configuration file in the new kernel directory and I
> > > recompiled
> > > > > it.
> > > > > > > > > The problem is that when I'm restarting the kernel does not
> > load
> > > > some
> > > > > > > > > drivers, hence linux can't find the hard disk and it goes in
> > > kernel
> > > > > > > panic.
> > > > > > > > > 
> > > > > > > > > Did I miss anything in the following compiling steps:
> > > > > > > > > 1) Extract kernel in /usr/src
> > > > > > > > > 2) Patch kernel (patch -p1 < <patch file>)
> > > > > > > > > 3) Copy config file: cp /boot/config-$(uname -r) .config
> > > > > > > > > 4) make menuconfig in case of changes (here I didn't change
> > > > anything
> > > > > > for
> > > > > > > > now)
> > > > > > > > > 5) make -j12
> > > > > > > > > 6) make bzImage (it seems required by Linux Mint)
> > > > > > > > > 7) make modules_install
> > > > > > > > > 8) Copy the configuration file back: cp .config
> > > /boot/config-5.12.1
> > > > > > > > > 9) make install
> > > > > > > > > 10) update-grub2
> > > > > > > > > 
> > > > > > > > > Did I miss anything?
> > > > > > > > > 
> > > > > > > > > Thanks,
> > > > > > > > > 
> > > > > > > > > Luca
> > > > > > > > 
> > > > > > > > Hi Lorenzo,
> > > > > > > > 
> > > > > > > > I managed somehow to make the new kernel loading and your patch
> > > seems
> > > > > > > > working fine since I'm able to suspend and resume my laptop and
> > the
> > > > > > driver
> > > > > > > > reloads correctly and connectivity is re-established.
> > > > > > > > 
> > > > > > > > You can proceed to merge the patch to the kernel.
> > > > > > > 
> > > > > > > nice. So you confirm now suspend/resume is fine. Can you please
> > keep
> > > > > > testing
> > > > > > > it for a while?
> > > > > > > 
> > > > > > > > 
> > > > > > > > In order to make it working temporarily I had to:
> > > > > > > > 1) append "nomodeset" parameter otherwise the screen is black
> > > > > > > > 2) replace the UUID identifier of my partition with the
> partition
> > > > > number
> > > > > > > > itself (like /dev/sda4)
> > > > > > > > 3) remove "initrd" line since laptop freezes when loading the
> > image
> > > > > > > > 
> > > > > > > > When I'm installing the kernel I see this issue:
> > > > > > > > ---------------------------------------------------
> > > > > > > > root@oldlaptop:/usr/src/linux-5.12.1-MT7630e-patch# make
> install
> > > > > > > > sh ./arch/x86/boot/install.sh 5.12.1 arch/x86/boot/bzImage \
> > > > > > > >         System.map "/boot"
> > > > > > > > run-parts: executing /etc/kernel/postinst.d/apt-auto-removal
> > 5.12.1
> > > > > > > > /boot/vmlinuz-5.12.1
> > > > > > > > run-parts: executing /etc/kernel/postinst.d/dkms 5.12.1
> > > > > > > /boot/vmlinuz-5.12.1
> > > > > > > >  * dkms: running auto installation service for kernel 5.12.1    
> > > > > > > > Error!  The
> > /var/lib/dkms/ndiswrapper/1.60/5.12.1/x86_64/dkms.conf
> > > > for
> > > > > > > > module ndiswrapper includes a BUILD_EXCLUSIVE directive which
> > > > > > > > does not match this kernel/arch.  This indicates that it should
> > not
> > > > be
> > > > > > > built.
> > > > > > > >                                                                 
> > > > > > > > [ OK ]
> > > > > > > > run-parts: executing /etc/kernel/postinst.d/initramfs-tools
> > 5.12.1
> > > > > > > > /boot/vmlinuz-5.12.1
> > > > > > > > update-initramfs: Generating /boot/initrd.img-5.12.1
> > > > > > > > W: Possible missing firmware
> > /lib/firmware/i915/skl_guc_49.0.1.bin
> > > > for
> > > > > > > > module i915
> > > > > > > > ...
> > > > > > > > -----------------------------------------------------
> > > > > > > > 
> > > > > > > 
> > > > > > > I am not familiar with mint build system. Is it enough to run
> make,
> > > > make
> > > > > > > modules_install; make install or do you need to create the .deb
> > file?
> > > > > > > 
> > > > > > > > Could you please help me to resolve the issues I have in the
> > kernel
> > > > > > > > installation?
> > > > > > > > 
> > > > > > > > Thanks in advance,
> > > > > > > > 
> > > > > > > > Luca
> > > > > > 
> > > > > > Hi Lorenzo,
> > > > > > 
> > > > > > sorry for bothering you, I continued today to make some tests.
> > > > > > 
> > > > > > I isolated the problem where the laptop got stuck after resume: I
> > > > disabled
> > > > > > the graphical UI since I discovered that the radeon card has a bug
> in
> > > the
> > > > > > kernel :(
> > > > > > 
> > > > > > During my test I suspended linux in text mode and I successfully
> > > resumed
> > > > > the
> > > > > > laptop, the wifi, and the connectivity: everything works correctly
> > > > without
> > > > > > any "magic script" from my side.
> > > > > 
> > > > > ok, thx for sharing. Can you please confirm my patch is not
> necessary?
> > > > > 
> > > > > > 
> > > > > > I just noticed that a message appeared after resuming wifi:
> > > > > > 
> > > > > > mt76x0e 0000:04:00.0: driver does not support HW RF ctrl
> > > > > > 
> > > > > > What do you think?
> > > > > 
> > > > > this means the radio is controlled in sw, this is info harmful
> > (probably
> > > it
> > > > > is enough dev_info instead of dev_err)
> > > > > 
> > > > > Lorenzo
> > > > > 
> > > > > > 
> > > > > > Thanks,
> > > > > > 
> > > > > > Luca
> > > > 
> > > > Hi Lorenzo,
> > > > 
> > > > your patch is definitely required.
> > > > 
> > > > Thanks,
> > > > 
> > > > Luca
> > > 
> > > ok, so you confirm without my patch the suspend/resume process fails on
> > > mt76x0e?
> > > Can you please keep testing it?
> > 
> > yes, I confirm that without your patch the resume process fails to resume
> > wifi.
> > 
> > I'll keep testing it.
> 
> ok, thx for sharing. If you confirm there are no other issue, I will post
> the patch
> 
> Regards,
> Lorenzo

Hi Lorenzo,

I'm using now your patch by 1 week and wifi resumes correctly, so I believe there are no more issues, you can post the patch.

Thanks,

Luca
Comment 32 Luca T. 2022-01-02 14:10:12 UTC
Hi Lorenzo,

I tested your fix for long time and I found now that when the laptop starts everything works smoothly and there are no issues with the WiFi driver, but in case I'm putting the laptop on sleep and waking it up again, the laptop stops to respond and I need to perform an hard reset.

This was not detected before since I forgot that I had also added a workaround script which perform the following actions:

/lib/systemd/system-sleep/wifi-wakeup:
case $1/$2 in
    pre/*)
        modprobe -r mt76x0e mt76xx
        sleep 1
        ;;
    post/*)
        modprobe mt76x0e mt76xx
        ;;
esac

Please let me know whether you want to investigate further.

Thanks,

Luca
Comment 33 Iakunin Andrei 2022-05-11 08:21:34 UTC
I have same issue with WiFi driver and suspend mode. System goes to suspend but never wakes up. 

ThinkPad E14 Gen 3 with AMD Ryzen 3 5300U.
Device-2: MEDIATEK MT7921 802.11ax PCI Express Wireless Network Adapter driver: mt7921e

Altlinux p10. 
Kernel: 5.15.25-un-def-alt1

I checked Bug 215787 but:

$echo 'dev_addr' > /sys/bus/pci/drivers/mt7921e/unbind
$echo 'dev_addr' > /sys/bus/pci/drivers/mt7921e/bind

goes without showing any troubles.
Comment 34 Iakunin Andrei 2022-05-11 13:22:02 UTC
Edition: 
$echo 'dev_addr' > /sys/bus/pci/drivers/mt7921e/unbind
$echo 'dev_addr' > /sys/bus/pci/drivers/mt7921e/bind

makes system reboot about half of an hour later right after using network.
Comment 35 Iakunin Andrei 2022-05-16 07:13:56 UTC
(In reply to Luca T. from comment #32)
> Hi Lorenzo,
> 
> I tested your fix for long time and I found now that when the laptop starts
> everything works smoothly and there are no issues with the WiFi driver, but
> in case I'm putting the laptop on sleep and waking it up again, the laptop
> stops to respond and I need to perform an hard reset.
> 
> This was not detected before since I forgot that I had also added a
> workaround script which perform the following actions:
> 
> /lib/systemd/system-sleep/wifi-wakeup:
> case $1/$2 in
>     pre/*)
>         modprobe -r mt76x0e mt76xx
>         sleep 1
>         ;;
>     post/*)
>         modprobe mt76x0e mt76xx
>         ;;
> esac
> 
> Please let me know whether you want to investigate further.
> 
> Thanks,
> 
> Luca

Hello, Luca!
I used patch proposed in Bug 215787 discussion and it fix suspend/resume problem for me.
Comment 36 Mario Limonciello (AMD) 2023-03-08 19:51:26 UTC
That linked bug has a solution in the mainline kernel 5.19 or later.
ad483ed9dd51 ("mt76: mt7921: fix kernel crash at mt7921_pci_remove")

Does this issue still happen in a current 6.1.y or 6.2.y kernel version?
Comment 37 Artem S. Tashkinov 2023-03-26 09:28:34 UTC
No response from the OP for two weeks, closing.
Comment 38 Safir 2023-03-26 11:26:04 UTC
I suppose I'm just a little late, but was testing the patch and newer kernels. It seems as though most, if not all, of the code in the patch is already implemented in newer kernels. Unfortunately it doesn't fix this issue.

Once the laptop has been suspended, the wifi stops working. Weirdly, even a reboot doesn't resolve this, as the wifi chip seems to be disabled entirely after a reboot. Only a power off and power on will restore wifi functionality.

While being fairly new to linux in general, I believe I could help with testing and hunting for a solution. I'm open to installing and running any kernel, patch and distro in assisting to resolving this. Please let me know what I can do, and what information you'd like me to provide you with in order to fully resolve this issue.


$ inxi -Fx
System:
  Host: laptop Kernel: 6.2.8 x86_64 bits: 64 compiler: gcc v: 11.3.0
    Desktop: Cinnamon 5.6.8 Distro: Linux Mint 21.1 Vera
    base: Ubuntu 22.04 jammy
Machine:
  Type: Laptop System: Hewlett-Packard product: HP ProBook 450 G1
    v: A3009DD10303 serial: <superuser required>
  Mobo: Hewlett-Packard model: 1942 v: KBC Version 89.10
    serial: <superuser required> UEFI: Hewlett-Packard v: L74 Ver. 01.05
    date: 11/04/2013
Battery:
  ID-1: BAT0 charge: 41.6 Wh (98.6%) condition: 42.2/42.2 Wh (100.0%)
    volts: 12.5 min: 10.8 model: Hewlett-Packard Primary status: Not charging
CPU:
  Info: dual core model: Intel Core i5-4200M bits: 64 type: MT MCP
    arch: Haswell rev: 3 cache: L1: 128 KiB L2: 512 KiB L3: 3 MiB
  Speed (MHz): avg: 2744 high: 2774 min/max: 800/3100 cores: 1: 2774
    2: 2697 3: 2752 4: 2753 bogomips: 19954
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
Graphics:
  Device-1: Intel 4th Gen Core Processor Integrated Graphics
    vendor: Hewlett-Packard driver: i915 v: kernel bus-ID: 00:02.0
  Device-2: Cheng Uei Precision Industry (Foxlink) HP HD Webcam type: USB
    driver: uvcvideo bus-ID: 3-7:3
  Display: x11 server: X.Org v: 1.21.1.3 driver: X: loaded: modesetting
    unloaded: fbdev,vesa gpu: i915 resolution: 1366x768~60Hz
  OpenGL: renderer: Mesa Intel HD Graphics 4600 (HSW GT2)
    v: 4.6 Mesa 22.2.5 direct render: Yes
Audio:
  Device-1: Intel Xeon E3-1200 v3/4th Gen Core Processor HD Audio
    vendor: Hewlett-Packard driver: snd_hda_intel v: kernel bus-ID: 00:03.0
  Device-2: Intel 8 Series/C220 Series High Definition Audio
    vendor: Hewlett-Packard driver: snd_hda_intel v: kernel bus-ID: 00:1b.0
  Sound Server-1: ALSA v: k6.2.8 running: yes
  Sound Server-2: PulseAudio v: 15.99.1 running: yes
  Sound Server-3: PipeWire v: 0.3.48 running: yes
Network:
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    vendor: Hewlett-Packard driver: r8169 v: kernel port: 3000 bus-ID: 02:00.0
  IF: enp2s0 state: down mac: a0:1d:48:a8:5e:ac
  Device-2: MEDIATEK MT7630e 802.11bgn Wireless Network Adapter
    vendor: Hewlett-Packard driver: mt76x0e v: kernel bus-ID: 03:00.0
  IF: wlo1 state: up mac: fc:4d:d4:54:c3:a4
Bluetooth:
  Device-1: MediaTek MT7630e Bluetooth Adapter type: USB driver: N/A
    bus-ID: 3-12:4
Drives:
  Local Storage: total: 238.47 GiB used: 136.21 GiB (57.1%)
  ID-1: /dev/sda vendor: Samsung model: SSD 840 PRO Series size: 238.47 GiB
Partition:
  ID-1: / size: 233.18 GiB used: 68.1 GiB (29.2%) fs: ext4 dev: /dev/sda2
  ID-2: /boot/efi size: 511 MiB used: 6.1 MiB (1.2%) fs: vfat
    dev: /dev/sda1
Swap:
  ID-1: swap-1 type: file size: 2 GiB used: 512 KiB (0.0%) file: /swapfile
Sensors:
  System Temperatures: cpu: 49.0 C mobo: 0.0 C
  Fan Speeds (RPM): N/A
Info:
  Processes: 219 Uptime: 26m Memory: 15.5 GiB used: 2.67 GiB (17.2%)
  Init: systemd runlevel: 5 Compilers: gcc: 11.3.0 Packages: 2180 Shell: Bash
  v: 5.1.16 inxi: 3.3.13
Comment 39 Mathieu Bouchard 2023-03-26 16:14:11 UTC
Sorry for not having replied after Feb 2021. This issue was never resolved for me. What has changed are the workarounds. Back then I was still able to use a 3rd party driver (mt7630e), and then after a certain upgrade it stopped working, so I switched to this driver but used some kind of command like sudo bash -c 'rmmod mt76x0e && modprobe mt76x0e' each time the laptop left sleep mode. I think that the actual sequence changed from time to time: I may have had to run this command twice, or add more steps. But then came a time when no workaround seemed to work, so I just stopped using sleep mode at all on this computer.

I just tried again today and the problem with sleep mode is not recovered by a reboot, it requires shutting down the computer, but not unplugging it nor unplugging the battery (I mention the battery because I once had to do that to reset a crashed DVD drive...). I tried rmmodding those and modprobing again :

mt76x0e                20480  0
mt76x0_common          53248  1 mt76x0e
mt76x02_lib            94208  2 mt76x0e,mt76x0_common
mt76                  102400  3 mt76x0e,mt76x02_lib,mt76x0_common

But obviously, a reboot is already a quite complete way to rmmod everything and modprobe everything back...