Repository navigation
gk7205v500: keep 64 MB boards on the media-memory carve-out - #2620
Conversation
load_goke moves a command line that names no allocator to CMA for the next boot. That was measured on a 128 MB V510, where Linux went from 28 MB to 125 MB (#2526); it was never run on a 64 MB board, which is what most gk7205v500 cameras carry (OpenIPC/majestic#350). There the zone is 32 MB either way and a 4 MP pipeline fills most of it, so CMA lends Linux little while every media allocation depends on migrating pages out of the zone. 64 MB and less now stay on the carve-out. A board that was already switched keeps its CMA bootargs; to move it back, drop mmz_allocator= and mmz= from bootargs and set mem= back to osmem (mem=32M), as removing the allocator alone would leave mem=64M and no room for the zone.
PR Summary by QodoKeep 64 MB gk7205v500 boards on the media-memory carve-out
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo
1. Other cameras inherit a 64 MB policy
|
…nger reserve a frame (#604) * memory-tuning: wide sensors on 64 MB boards, and snapshots that no longer reserve a frame - New section, Wide sensors on 64 MB boards: where a 32 MB media region goes on a gk7205v500 + SC401AI (2560x1440) with two streams, why builds before mid-October 2026 had no main stream there (OpenIPC/majestic#350, OpenIPC/firmware#2587), what the streamer does when the pool does not fit, and what to turn off if it still does not. The figures are labelled as estimates; they were not measured on a gk7205v500. - The capture path's width limit is per chip: 2304 on the ev200/ev300 and gk7205v200/v300, 3072 on the gk7205v500 family. - Kernel 4.9: the gk7205v500 firmware moves boards to CMA at boot except those with 64 MB or less (OpenIPC/firmware#2620), and how to move a 64 MB board that was already switched back to the fixed split. Removing the allocator alone leaves the media region nothing. - jpeg.enabled and jpeg.tuned: on current HiSilicon and Goke builds, other than hi3516cv100 and hi3516cv6xx, snapshots reserve no frame, so turning JPEG off frees none and jpeg.tuned is ignored. Measured on a gk7205v200 with a 1080p sensor: 16632 KB of media memory with JPEG on and off, and 18680 KB while snapshots are being served. The old figures stay in the table, marked as older builds. * memory-tuning, majestic-streamer, majestic-config: review fixes - The fixed-split recipe now sets mem=32M whatever mem= held before, ${osmem} included, which may itself have been set to the whole DDR. Tested with BusyBox sed on a numeric mem=, a variable and a mem= in the middle of the line. - The other places that promised a frame back from jpeg.enabled: false now say where that holds: majestic-streamer's JPEG section, the one-frame-per-channel paragraph, majestic-config's comment. - Parameterised snapshots on current HiSilicon and Goke builds need no jpeg.tuned and no restart. Measured on a gk7205v300 with a 2592x1944 sensor and jpeg.tuned unset: 640x360, q30 and 1280x720 served; a size above the frame came back at 2592x1944; 16x16 refused with 400; a crop came back at 1:1 with width/height not applied. The cap and the restart are kept for hi3516cv100, hi3516cv6xx and older builds.
Problem
load_gokeswitches any gk7205v500 command line that names no allocator to CMA for the next boot. That switch was measured on one 128 MB V510, where Linux went from 28 MB to 125 MB (#2526). It was never run on a 64 MB board, which is what most gk7205v500 cameras carry. The 64 MB reporter in OpenIPC/majestic#350 objects to their board being moved to CMA.At 64 MB the media zone is 32 MB with CMA or without it, and a 4 MP pipeline uses most of it. So CMA can lend Linux only the little the zone leaves free. In exchange, every media allocation depends on the kernel first migrating movable pages out of the zone.
What this is not. It is not a fix for an observed CMA failure. Both of the #350 reporter's logs, with CMA and without, fail with the same
ERR_VPSS_NOMEM/ERR_VENC_NOMEM. That failure is majestic putting a 2560-wide sensor on VI offline, which is being fixed in majestic. This PR returns 64 MB boards to the configuration they had before #2526, until CMA is measured there.Hardware tested on
Not run on a camera. The lab has no 64 MB gk7205v500. The only gk7205v500-family board (a 128 MB V510) was unreachable. A 128 MB board would only show that nothing changes for it.
The evidence below is the function itself, run in busybox with stubbed
fw_printenv/fw_setenv,/proc/cmdlineand/proc/meminfo. A board with this image would also show it: on a fresh 64 MB install,load_gokeno longer printsMedia memory: switching to CMA, andfw_printenv bootargskeepsmem=32M. Confirmation from anyone with a 64 MB board is welcome.Evidence
check_allocator()extracted fromload_goke, with/procpaths redirected to test files andosmem=32M.Before (origin/master):
After:
A 64 MB board that has already been switched keeps its CMA bootargs. To move it back, drop
mmz_allocator=andmmz=from bootargs and setmem=back to osmem (mem=32M). Removing the allocator alone leavesmem=64M, and the carve-out then has no room for the zone.Scope
general/package/all-patches/linux/(those go to OpenIPC/linux)general/overlay/or in a sharedload_<vendor>script hardcodes a value specific to my boardLD_PRELOAD, and no binaries that cannot be rebuilt from source