Kernel 6.6 and IPQ807x

Hi,

I had previously opened this thread regarding a potential memory leak back in the fall (kernel 6.1), which seemed to get resolved once irq assignment was done. That irq script was committed to master, and all was good.

I wanted to create this thread in case there's something afoot again... I just flashed the 6.6 kernel master (running build 0cb3e86), and after ~3 hours my Xiaomi AX3600's memory was down to about 35MB free. I rebooted, and right now after ~4 hours uptime I'm down to 45MB free.

htop doesn't show any processes with major memory consumption, and irqs are being distributed as they should be.

I guess https://oftc.irclog.whitequark.org/openwrt-devel/2024-03-30#33063325; might be related.

1 Like

Ooof.
Yeah if it is, that’s a fairly hefty hit for low memory devices.

Yeah, SWIOTLB now reserving 64M is quite an annoyance that I am looking into how to resolve without too many hacks.

There is dynamic SWIOTLB now but it still requires overriding the default 64M value but its only supported via cmdline which we dont have a way to do at once for all boards

2 Likes

I’ve let the AX3600 do its thing for the past 3.5 days with 6.6. It hasn’t OOM’d despite the low available memory, floating between 20 and 35MB.

Too early to tell, 6.6 may be more stable than 6.1 for this arch…. If only/when we get the mem back it’s going to be good…

Yeah, working on swiotlb

2 Likes

I wonder what swiotlb is doing exactly on devices running OpenWrt?

What I've read its only purpose (for ARM devices) is to avoid giving "untrusted" USB devices DMA access. For Android devices I've read that qcom is using it to disguise their proprietary stuff. I can also see that Xiaomi is enabling swiotlb for the AX3600 on kernel cmd explicit for this device on stock fw.

I've tested swiotlb=1024 which results in a total amount of 2MB allocated. I've tested swiotlb=noforce also. It did nothing in terms of mem usage or stability at all on AX3600 running plain OpenWrt/kernel 6.6 with one device streaming the whole days. The device is fluctuating between ~10MB to 30MB avail. RAM during the days with kernel 6.6 anyway (regardless of "on" vs. "off" vs. "2MB"). The missing 64MB would propably hit only if we have applications in use consuming lot of RAM and/or a certain amount of clients are connected. For now we would have directly after boot: ~110-120MB of free RAM. By disabling swiotlb we have ~170-180MB free after boot.

I did not test on my 1GB RAM device. There it does not matter at all (imo). Kernel 6.6 is doing almost nothing in regard maxing out RAM usage. I've never seen such low values like on AX3600. Not even almost. Beside that I would not even think about disabling swiotlb there given it is providing an USB connector which could have an influence.

There already is a patch circulating disabling swiotlb (via bootarg) outright for ipq807x:

_https://github.com/AgustinLorenzo/openwrt/commit/661c1c4733f06d89050078a713f74708eedacf6d

I would propably not bother about 1gb devices and rather limit it to a certain lower amount (if those low valuse would make sense) instead disabling it completely. Assuming it is used by USB or other devices connected.

This has been fixed a while ago:

It will now reserved 1MB instead of the default 64MB.

1 Like

Obviously I've missed that. ;D Sry for bringing this back and causing confusion for others and ty for telling me.

1 Like