MT76x02 Kernel Panic

@nbd

After updating to the latest MT76 driver (2018-11-28) I get a Kernel Panic for the MT7612. It happens on two different devices (MT7621 and MT7628 based.)

[   12.060171] procd: - watchdog -                                              
[   12.725821] procd: - watchdog -                                              
[   12.729283] procd: - ubus -                                                  
[   12.886561] procd: - init -                                                  
Please press Enter to activate this console.                                    
[   13.244995] kmodloader: loading kernel modules from /etc/modules.d/*         
[   13.262311] device-mapper: ioctl: 4.37.0-ioctl (2017-09-20) initialised: dm-m
[   13.280266] Initializing XFRM netlink socket                                 
[   13.286433] NET: Registered protocol family 15                               
[   13.292754] tun: Universal TUN/TAP device driver, 1.6                        
[   13.308619] ip6_tables: (C) 2000-2006 Netfilter Core Team                    
[   13.322428] cryptodev: driver 1.9 loaded.                                    
[   13.329380] Loading modules backported from Linux version v4.19-rc5-0-g6bf4c5
[   13.337051] Backport generated by backports.git v4.19-rc5-1-0-g05571dcd      
[   13.345754] ip_tables: (C) 2000-2006 Netfilter Core Team                     
[   13.358691] nf_conntrack version 0.5.0 (8192 buckets, 32768 max)             
[   13.407326] xt_time: kernel timezone is -0000                                
[   13.459990] bus=0x2, slot = 0x1, irq=0xff                                    
[   13.464224] mt7603e 0000:02:00.0: ASIC revision: 76030010                    
[   13.478390] mt7603e 0000:02:00.0: Firmware Version: ap_pcie                  
[   13.483962] mt7603e 0000:02:00.0: Build Time: 20160107100755                 
[   13.525645] mt7603e 0000:02:00.0: firmware init done                         
[   13.761061] bus=0x1, slot = 0x0, irq=0xff                                    
[   13.765351] mt76x2e 0000:01:00.0: ASIC revision: 76120044                    
[   14.474522] mt76x2e 0000:01:00.0: ROM patch build: 20141115060606a           
[   14.488122] mt76x2e 0000:01:00.0: Firmware Version: 0.0.00                   
[   14.493603] mt76x2e 0000:01:00.0: Build: 1                                   
[   14.497770] mt76x2e 0000:01:00.0: Build Time: 201507311614____               
[   14.525655] mt76x2e 0000:01:00.0: Firmware running!                          
[   14.580671] PPP generic driver version 2.4.2                                 
[   14.586990] NET: Registered protocol family 24                               
[   14.594418] kmodloader: done loading kernel modules from /etc/modules.d/*    
[   22.331066] mtk_soc_eth 1e100000.ethernet: PPE started                       
[   22.343451] br-lan: port 1(eth0.1) entered blocking state                    
[   22.348932] br-lan: port 1(eth0.1) entered disabled state                    
[   22.355018] device eth0.1 entered promiscuous mode                           
[   22.359927] device eth0 entered promiscuous mode                             
[   22.368683] br-lan: port 1(eth0.1) entered blocking state                    
[   22.374105] br-lan: port 1(eth0.1) entered forwarding state                  
[   22.380155] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready             
[   23.356351] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready        
[   24.136672] CPU 3 Unable to handle kernel paging request at virtual address 4
[   24.147334] Oops[#1]:                                                        
[   24.149655] CPU: 3 PID: 1567 Comm: hostapd Not tainted 4.14.82 #0            
[   24.155772] task: 8fe0b840 task.stack: 8e490000                              
[   24.160309] $ 0   : 00000000 00000001 ffffffff fffffffe                      
[   24.165545] $ 4   : 8f751560 8e45fc40 00000000 8e45fd70                      
[   24.170782] $ 8   : 00000001 00007c00 811ffca0 00000f03                      
[   24.176034] $12   : 00000000 50230008 ffffffff 40000000                      
[   24.181294] $16   : 8e45f480 8e45f000 8f750bc0 8e45f480                      
[   24.186523] $20   : 00000001 8e45f75c ffffffff 00000000                      
[   24.191733] $24   : 0fe20200 8000ceec                                        
[   24.196947] $28   : 8e490000 8e491d10 7fcac3f8 8ec03464                      
[   24.202159] Hi    : 0000000a                                                 
[   24.205020] Lo    : 66666669                                                 
[   24.207929] epc   : 8ece0654 mt76x02_add_interface+0x6c/0x88 [mt76x02_lib]   
[   24.214915] ra    : 8ec03464 drv_add_interface+0x7c/0x94 [mac80211]          
[   24.221163] Status: 11007c03 KERNEL EXL IE                                   
[   24.225341] Cause : 4080000c (ExcCode 03)                                    
[   24.229328] BadVA : 00000018                                                 
[   24.232192] PrId  : 0001992f (MIPS 1004Kc)                                   
[   24.236264] Modules linked in: pppoe ppp_async pppox ppp_generic nf_conntracr
[   24.307107]  xfrm_ipcomp xfrm_algo dm_crypt dm_mirror dm_region_hash dm_log n
[   24.326642] Process hostapd (pid: 1567, threadinfo=8e490000, task=8fe0b840, )
[   24.334775] Stack : 00000000 00000000 8f750bc0 8e45f000 8f750bc0 8ec03464 8f8
[   24.343109]         8e45f000 8f750bc0 8e45f488 8ec18290 8e45f000 00001003 8e0
[   24.351445]         8e45f000 8e45f030 8ec5f318 00000000 00000000 00008914 800
[   24.359781]         7fcac3f8 8034e534 00000000 00000000 0000000c 8e491ee8 8e0
[   24.368117]         8e45f000 00001003 00000001 8034e87c 8e491ee8 7fcac114 000
[   24.376452]         ...                                                      
[   24.378894] Call Trace:                                                      
[   24.381343] [<8ece0654>] mt76x02_add_interface+0x6c/0x88 [mt76x02_lib]       
[   24.387892] [<8ec03464>] drv_add_interface+0x7c/0x94 [mac80211]              
[   24.393831] [<8ec18290>] ieee80211_do_open+0x3a4/0x9e8 [mac80211]            
[   24.400012] [<8034e534>] __dev_open+0xdc/0x14c                               
[   24.404446] [<8034e87c>] __dev_change_flags+0xe8/0x1b0                       
[   24.409563] [<8034e96c>] dev_change_flags+0x28/0x70                          
[   24.414421] [<803c7f84>] devinet_ioctl+0x2f8/0x884                           
[   24.419221] [<8032a4e0>] sock_ioctl+0x2fc/0x358                              
[   24.423753] [<80126e58>] do_vfs_ioctl+0x774/0x81c                            
[   24.428439] [<80126f50>] SyS_ioctl+0x50/0xa0                                 
[   24.432706] [<80019578>] syscall_common+0x34/0x58                            
[   24.437392] Code: 24a70130  a0a20185  a0a30184 <acc70018> 0fddcc4d  8ca50120 
[   24.447122]                                                                  
[   24.449154] ---[ end trace 55ea9016a9fb29d4 ]---                             
[   24.455679] Kernel panic - not syncing: Fatal exception                      
[   24.462439] Rebooting in 3 seconds..                                         

Some additional observations:

Reverted to MT76-2018-21-11; no KP, but crashes upon enable Wifi.

BUT:

OVERLAYFS is complaining: not support tmpfile (didn't see this until I did a git pull yesterday, my old build system was maybe 5 to 7 days old).

Also happen on R6220 using MT7621 :frowning: And one more thing is that enable 802.11w on MT wifi make them very slow ~7Mb/s (no error in syslog)

@nbd updated Makefile for MT76. As soon as I can build a new version I will report back.

Having a unrelated problem compiling the backport/mac80211 now. (Backport mac80211 compile error)

Lastest (2018-12-04) seems to have fixed this problem.