In an effort to test this I've done my first full build of OpenWRT.
I followed the standard environment setup instructions, checked out the v23.03.3 tag and then cherry-picked the patch commit. From there I continued following the "quick" build instructions, using the build configuration from the relevant 23.03.3 target.
I've flashed the firmware and everything seems fine, but Is there any way to verify that the firmware I built actually contains the patch that I cherry-picked?
I just installed current snapshot OpenWrt SNAPSHOT r22392-e7c399bee6 / LuCI Master git-23.074.82619-6ad6a24
and one of my APs froze within an hour.
It was not just wifi, I was unable to log in and had to restart.
This matches your observation.
I've disabled WED for now.
I'm testing with it now and while my APs are not crashing in the same way as before, I am noticing decreased throughput at the moment. Curious if others are seeing the same as well.
FWIW, I still have WED enabled, but am also testing with /proc/sys/net/core/backlog_threaded enabled (set to 1) per this:
Update 1 Yeah, something odd is going on for me. I disabled /proc/sys/net/core/backlog_threaded for now to not have that new variable introduced. When I see flows offloaded, performance seems pretty good--on par with other testing I've been doing with WED thus far. But sometimes the same device, running the same test, will not have its flows offloaded and my RT3200 CPUs reflect that heavily. In those cases, I'm seeing lower throughput than before the commits I tested yesterday (07b5508, fbcfb7f, d0a0696, and aa27771). Back-to-back tests indicate inconsistencies with which flows are offloaded or not.
I feel like I'm probably going to have to bisect again and see if there was another regression in between. sigh. If anyone else is NOT seeing what I'm describing, it could be something else going on in my test environment and knowing that might save me some bisecting time.
Update 2 To put some numbers behind my statements before...
I found the throughput "regression" I was noting is not necessarily new to this build. In fact, I went back and confirmed this same behavior was happening on d0a0690 (and maybe prior even to that) as well.
Testing with iperf3:
From a well-connected 1gb ethernet host (192.168.xx.5)
To the same wireless AX client (192.168.xx.109), located at the same location from test to test
I found it too, but probably need to spend hours on the documentation to figure out how gdb works. There isn't just an example, instead there are hundreds of pages of technical documentation.
Thank you - that was helpful. The answer is no, the patch didn't apply. I have no idea why not though. Do patches need to be listed somewhere in order to get applied to a particular target?
I haven't read OpenWRT documentation on how to apply a specific patch, so I can't answer that. But I'm well versed with git manipulation, so I just do my own patching.
If you run the patch again, you can check that file before you compile. If it's not there, then the patch maybe didn't run? If it did and you run "make world", check it again afterwards and the patch should still be there. If it downloads over it... well, it shouldn't, because each package has a git repo and SHA256 checksum, and packages do not re-download/unpack as long as they haven't changed, leaving source files as is.
That is the “official” way to apply patches in the OpenWrt build system. Generally you would place patches in the appropriate package/ or target/ subdirectory so they’re not wiped out from build_dir/ during certain clean operations. @hnyman explains that in more detail on post #6 here.
Awesome find on the gdb front! This looks like a remote debugging session.
I think the aarch64 gdb might be able to just point at the source code and show which line number is being referenced from a stack trace function/offset.
(I'm doing taxes this weekend so haven't had a chance yet to dig into gdb)
Agreed on the point about gdb being able to show a line number from source (given an offset), but I was thinking the remote ability of gdb might lend itself to attaching to running processes on the AP and view real-time backtrace info (among other things).
Perhaps that's not the right use-case for kernel/driver debugging. Just something that seemed interesting to potentially explore.
you might also need to provide the default library path with set solib-search-path like this: set solib-search-path ./staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/usr/lib/
(Example of analysing post-morted crash dump core: http://lists.openwrt.org/pipermail/openwrt-devel/2021-September/036506.html
EDIT:
Old example of the the basic items in debugging "collectd":
on router: gdbserver :9000 collectd -f
on buildhost: ./scripts/remote-gdb 192.168.1.1:9000 ./staging_dir/target-mips_34kc_musl-1.1.11/root-ar71xx/usr/sbin/collectd
I found out last week how to use gdb properly to get the code where a crash occurs. Because openwrt uses -O2 optimization by default during the compile, it will inline a lot of functions, so the function names in the stack dump are often not the real function, especially if the offset is above 0x100.
Here's an example usage, run from the build server:
(gdb) add-symbol-file ~/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/backports-6.1-rc8/net/mac80211/mac80211.o
add symbol table from file "/home/osboxes/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/backports-6.1-rc8/net/mac80211/mac80211.o"
(y or n) y
Reading symbols from /home/osboxes/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/backports-6.1-rc8/net/mac80211/mac80211.o...
(gdb) l *ieee80211_sta_ps_transition+0x448
0x23a20 is in ieee80211_rx_8023 (/home/osboxes/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/backports-6.1-rc8/net/mac80211/rx.c:4771).
4766 */
4767 xmit_skb->priority += 256;
4768 xmit_skb->protocol = htons(ETH_P_802_3);
4769 skb_reset_network_header(xmit_skb);
4770 skb_reset_mac_header(xmit_skb);
4771 dev_queue_xmit(xmit_skb);
4772 }
4773
4774 if (!skb)
4775 return;
Unfortunately there is still two other crashes that have not been added by Felix that I submitted. One for three is just a start. My branch has all the found fixes so far. He does not like the spinlock I added, but if it doesn't crash, and the documentation calls for synchronization, then... well.. I don't know. I could very well be wrong and it could be something else, but noone has offered up an alternative, and my spinlocks follow what the ieee80211 documentation calls for. Though, Felix would probably know if that documentation is incorrect. He may have written most of it after all.
I've just found another issue, this one possibly affecting the WED stopping. There are tokens not being released over time, and I need to track down why.... Once I have this I believe the RT3200 will be stable.
Let's get back to this WED issue. First an update, I'm compiling with the latest OpenWRT build as of 4/3/2023. Using my branch for the mt76 portion, it no longer crashes, but it has a new issue. The speed gets slower, and slower, and slower, until I can't even connect. I added a debug file in the /sys/ folder so I can view internal counters real time.
The first thing I've found is the token_count gets stuck at some point above zero. This is probably when WED stops working. The question is... when and why? This is my next target. I have a feeling once this is fixed, the WED will be fixed as well.
I added the extra debug code to my branch if you want to pull the latest. You can then do this:
root@router:~# cd /sys/kernel/brain2000
root@router:/sys/kernel/brain2000# cat brain2000_mt76-\>token_count
token_count=0
sta_rc_list=0
sta_poll_list=0
twt_list=0
This monitoring will help us to see what doesn't get cleaned up when issues start happening.
I'm finding the token_count gets stuck above 0 after a while, even if I do a wifi down wifi up. The only way to get it back down to 0 is to run rmmod and modprobe to reload the mt7915e driver.