From ed4495a35cb17724c3269e9b2668d3cc58d8696f Mon Sep 17 00:00:00 2001 From: Paul Swenson Date: Sun, 19 Jul 2026 10:34:58 -0400 Subject: [PATCH 1/8] doom: placeholder for kernel PR (split from #252) From 627eb4a3121164a352879f2db8b39b6530414d13 Mon Sep 17 00:00:00 2001 From: Paul Swenson <1937248+pdscomp@users.noreply.github.com> Date: Mon, 20 Jul 2026 11:25:20 -0400 Subject: [PATCH 2/8] kernel: drop non-CC1 Allwinner platform drivers --- .../elegoo-centauri-carbon1/runtime-memory.cfg | 17 +++++++++++++++++ .../linux/linux-mainline_%.bbappend | 1 + 2 files changed, 18 insertions(+) create mode 100644 meta-opencentauri/recipes-kernel/linux/linux-mainline/elegoo-centauri-carbon1/runtime-memory.cfg diff --git a/meta-opencentauri/recipes-kernel/linux/linux-mainline/elegoo-centauri-carbon1/runtime-memory.cfg b/meta-opencentauri/recipes-kernel/linux/linux-mainline/elegoo-centauri-carbon1/runtime-memory.cfg new file mode 100644 index 00000000..3f0f2f6e --- /dev/null +++ b/meta-opencentauri/recipes-kernel/linux/linux-mainline/elegoo-centauri-carbon1/runtime-memory.cfg @@ -0,0 +1,17 @@ +# CC1 runtime footprint: hardware that cannot exist on the D1/T113 board. +# Keep the CC1-specific PWM_SUN20I driver from fragment.cfg; this only removes +# generic drivers for other Allwinner generations. +# CONFIG_PINCTRL_SUN4I_A10 is not set +# CONFIG_PINCTRL_SUN5I is not set +# CONFIG_PINCTRL_SUN6I_A31 is not set +# CONFIG_PINCTRL_SUN6I_A31_R is not set +# CONFIG_PINCTRL_SUN8I_A23 is not set +# CONFIG_PINCTRL_SUN8I_A23_R is not set +# CONFIG_PINCTRL_SUN8I_A33 is not set +# CONFIG_PINCTRL_SUN8I_A83T is not set +# CONFIG_PINCTRL_SUN8I_A83T_R is not set +# CONFIG_PINCTRL_SUN8I_H3 is not set +# CONFIG_PINCTRL_SUN8I_H3_R is not set +# CONFIG_PINCTRL_SUN9I_A80 is not set +# CONFIG_PINCTRL_SUN9I_A80_R is not set +# CONFIG_PWM_SUN4I is not set diff --git a/meta-opencentauri/recipes-kernel/linux/linux-mainline_%.bbappend b/meta-opencentauri/recipes-kernel/linux/linux-mainline_%.bbappend index 92041866..d5e55338 100644 --- a/meta-opencentauri/recipes-kernel/linux/linux-mainline_%.bbappend +++ b/meta-opencentauri/recipes-kernel/linux/linux-mainline_%.bbappend @@ -15,6 +15,7 @@ SRC_URI:append:elegoo-centauri-carbon1 = " \ file://fragment.cfg \ file://squashfs-overlayfs.cfg \ file://kernel-size-reduction.cfg \ + file://runtime-memory.cfg \ file://usb-net-adapters.cfg \ file://0001-dt-bindings-pwm-Add-binding-for-Allwinner-D1-T113-S3.patch \ file://0002-pwm-Add-Allwinner-s-D1-T113-S3-R329-SoCs-PWM-support.patch \ From 63563171bd0d4be152226ec41d1ff393ac19b966 Mon Sep 17 00:00:00 2001 From: Paul Swenson <1937248+pdscomp@users.noreply.github.com> Date: Mon, 20 Jul 2026 11:38:42 -0400 Subject: [PATCH 3/8] kernel: remove unused CC1 runtime APIs --- .../elegoo-centauri-carbon1/runtime-memory.cfg | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/meta-opencentauri/recipes-kernel/linux/linux-mainline/elegoo-centauri-carbon1/runtime-memory.cfg b/meta-opencentauri/recipes-kernel/linux/linux-mainline/elegoo-centauri-carbon1/runtime-memory.cfg index 3f0f2f6e..a6866be0 100644 --- a/meta-opencentauri/recipes-kernel/linux/linux-mainline/elegoo-centauri-carbon1/runtime-memory.cfg +++ b/meta-opencentauri/recipes-kernel/linux/linux-mainline/elegoo-centauri-carbon1/runtime-memory.cfg @@ -15,3 +15,9 @@ # CONFIG_PINCTRL_SUN9I_A80 is not set # CONFIG_PINCTRL_SUN9I_A80_R is not set # CONFIG_PWM_SUN4I is not set + +# CC1 has 128 MiB of lowmem and no application using these general-purpose +# kernel APIs. Keep seccomp, inotify, and IPC compatibility for future tools. +# CONFIG_HIGHMEM is not set +# CONFIG_IO_URING is not set +# CONFIG_FANOTIFY is not set From 14bfba77917c182c69eb64ef2e81bcc06a1f10c2 Mon Sep 17 00:00:00 2001 From: Paul Swenson <1937248+pdscomp@users.noreply.github.com> Date: Mon, 20 Jul 2026 11:51:40 -0400 Subject: [PATCH 4/8] kernel: disable unused runtime instrumentation --- .../elegoo-centauri-carbon1/runtime-memory.cfg | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/meta-opencentauri/recipes-kernel/linux/linux-mainline/elegoo-centauri-carbon1/runtime-memory.cfg b/meta-opencentauri/recipes-kernel/linux/linux-mainline/elegoo-centauri-carbon1/runtime-memory.cfg index a6866be0..19182b9b 100644 --- a/meta-opencentauri/recipes-kernel/linux/linux-mainline/elegoo-centauri-carbon1/runtime-memory.cfg +++ b/meta-opencentauri/recipes-kernel/linux/linux-mainline/elegoo-centauri-carbon1/runtime-memory.cfg @@ -21,3 +21,18 @@ # CONFIG_HIGHMEM is not set # CONFIG_IO_URING is not set # CONFIG_FANOTIFY is not set + +# CC1 does not ship developer tracing/profiling or task-accounting consumers. +# Keep KALLSYMS and IKCONFIG for field diagnostics and crash triage. +# CONFIG_FTRACE is not set +# CONFIG_EVENT_TRACING is not set +# CONFIG_TRACING is not set +# CONFIG_UPROBES is not set +# CONFIG_UPROBE_EVENTS is not set +# CONFIG_PERF_EVENTS is not set +# CONFIG_SLUB_DEBUG is not set +# CONFIG_TASKSTATS is not set +# CONFIG_TASK_DELAY_ACCT is not set +# CONFIG_TASK_XACCT is not set +# CONFIG_TASK_IO_ACCOUNTING is not set +# CONFIG_SCHED_INFO is not set From 122bc402d685fb4faed3be58d1ed80692140c64c Mon Sep 17 00:00:00 2001 From: Paul Swenson <1937248+pdscomp@users.noreply.github.com> Date: Mon, 20 Jul 2026 12:01:10 -0400 Subject: [PATCH 5/8] kernel: drop unused IPv6 and L2 networking --- .../elegoo-centauri-carbon1/runtime-memory.cfg | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/meta-opencentauri/recipes-kernel/linux/linux-mainline/elegoo-centauri-carbon1/runtime-memory.cfg b/meta-opencentauri/recipes-kernel/linux/linux-mainline/elegoo-centauri-carbon1/runtime-memory.cfg index 19182b9b..f75e37f4 100644 --- a/meta-opencentauri/recipes-kernel/linux/linux-mainline/elegoo-centauri-carbon1/runtime-memory.cfg +++ b/meta-opencentauri/recipes-kernel/linux/linux-mainline/elegoo-centauri-carbon1/runtime-memory.cfg @@ -36,3 +36,11 @@ # CONFIG_TASK_XACCT is not set # CONFIG_TASK_IO_ACCOUNTING is not set # CONFIG_SCHED_INFO is not set + +# CC1 is an IPv4-only appliance; it has no bridge, VLAN, or firewall users. +# CONFIG_IPV6 is not set +# CONFIG_NETFILTER is not set +# CONFIG_NETFILTER_ADVANCED is not set +# CONFIG_NF_CONNTRACK is not set +# CONFIG_BRIDGE is not set +# CONFIG_VLAN_8021Q is not set From 335213e707421d1d00119f2512a540ad5bcbb5cf Mon Sep 17 00:00:00 2001 From: Paul Swenson <1937248+pdscomp@users.noreply.github.com> Date: Mon, 20 Jul 2026 12:08:01 -0400 Subject: [PATCH 6/8] kernel: remove unused cgroup scheduling support --- .../elegoo-centauri-carbon1/runtime-memory.cfg | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/meta-opencentauri/recipes-kernel/linux/linux-mainline/elegoo-centauri-carbon1/runtime-memory.cfg b/meta-opencentauri/recipes-kernel/linux/linux-mainline/elegoo-centauri-carbon1/runtime-memory.cfg index f75e37f4..d105958c 100644 --- a/meta-opencentauri/recipes-kernel/linux/linux-mainline/elegoo-centauri-carbon1/runtime-memory.cfg +++ b/meta-opencentauri/recipes-kernel/linux/linux-mainline/elegoo-centauri-carbon1/runtime-memory.cfg @@ -44,3 +44,10 @@ # CONFIG_NF_CONNTRACK is not set # CONFIG_BRIDGE is not set # CONFIG_VLAN_8021Q is not set + +# The appliance does not run containers or per-user CPU groups. +# CONFIG_SCHED_AUTOGROUP is not set +# CONFIG_CGROUPS is not set +# CONFIG_CGROUP_SCHED is not set +# CONFIG_CGROUP_NET_CLASSID is not set +# CONFIG_FAIR_GROUP_SCHED is not set From b1b77691bae966a8b24893b87da4c44dfe9a7816 Mon Sep 17 00:00:00 2001 From: Paul Swenson <1937248+pdscomp@users.noreply.github.com> Date: Mon, 20 Jul 2026 12:26:40 -0400 Subject: [PATCH 7/8] docs: add CC1 kernel footprint test analysis --- kernel-testing.md | 106 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 kernel-testing.md diff --git a/kernel-testing.md b/kernel-testing.md new file mode 100644 index 00000000..b90418e4 --- /dev/null +++ b/kernel-testing.md @@ -0,0 +1,106 @@ +# CC1 kernel footprint testing + +This file records the isolated experiments for PR #256. It is intentionally +local analysis rather than a production image file; the PR will contain only a +short summary. + +## Scope and method + +Target: `carbon2u`, using wired Ethernet for recovery and SSH. The board has +the production peripherals needed for validation, including the camera and +USB devices. The shared-cache edit in `build/conf/local.conf` is local-only. + +Each variant is built from current `origin/main` and tested cumulatively. The +SWU, kernel image, module archive, generated kernel `.config`, and checksums +are retained outside this repository. After flashing, wait five minutes for +the normal services to settle, then collect three idle samples per boot. Each +sample records `/proc/meminfo`, `/proc/swaps`, slab/page-table/kernel-stack +figures, boot memory, service state, and peripheral state. + +The final baseline-versus-final comparison also uses a bounded synthetic load: +two CPU burners, bounded memory pressure, Moonraker/API polling, camera +snapshot polling, SSH checks, and swap/pressure telemetry. No printer motion +or heating is used. + +## Baseline + +Current `origin/main` (placeholder `doom/kernel` rebased onto it) built as a +6,521-task SWU on 2026-07-20. The baseline artifact sizes are: + +- `zImage`: 3,802,928 bytes +- modules archive: 4,527,253 bytes +- `bootA.img`: 6,450,176 bytes +- SWU: 125,299,200 bytes +- boot kernel line: `113632K/130048K available`, with 8,192K kernel code, + 1,175K rwdata, 2,024K rodata, 1,024K init, 267K bss, and 16,416K reserved + +On `carbon2u`, three settled idle samples produced a median of 29,384 KiB +`MemAvailable`, 12,604 KiB slab, 728 KiB kernel stack, 552 KiB page tables, +and 7,424 KiB zram swap used. Klipper, Moonraker, all three UI alternatives, +ustreamer, camera (`/dev/video0` and `/dev/video1`), GPIO, I2C, PWM, +remoteproc, USB storage, and wired Ethernet were healthy. + +The untouched baseline also reproduced the separately known RTL8821CU USB +failure: enumeration under `2-1.2` returned repeated `-71` errors and no +`wlan0` appeared. This is expected because current `origin/main` does not yet +contain the separate Wi-Fi PR; it is recorded as an out-of-scope baseline +condition, while Ethernet and the attached peripherals remain usable for this +test. + +## Candidate groups + +The original 97-line `runtime-memory.cfg` mixed unrelated risks. The new test +series evaluates these groups independently: + +1. Non-CC1 Allwinner pinctrl drivers and `PWM_SUN4I`; retain CC1 + `PWM_SUN20I`, display, GPIO, I2C, SPI, USB, camera, and remoteproc support. +2. HIGHMEM, io_uring, and fanotify; retain seccomp, inotify, and both IPC + ABIs. +3. ftrace/tracing, uprobes, perf events, SLUB debugging, and task accounting; + retain `KALLSYMS`, `/proc/config.gz`, and symbolic crash reporting. +4. IPv6, netfilter/conntrack, bridge, and VLAN support; retain IPv4 Ethernet + and Wi-Fi. +5. cgroups and SCHED_AUTOGROUP; retain only if the measured memory gain is at + least 512 KiB and synthetic-load API/camera p95 latency does not regress by + more than 10%. + +Each group will have its own commit and will be kept or dropped based on the +recorded result. Hardware/peripheral regressions always reject a group. + +## Results + +| Variant | Config groups | zImage | modules | boot memory | idle MemAvailable | decision | +| --- | --- | ---: | ---: | ---: | ---: | --- | +| baseline | none | 3,802,928 | 4,527,253 | 113,632K available | 29,384 KiB | reference; known out-of-scope Wi-Fi enumeration failure | +| platform-drivers | non-CC1 pinctrl + `PWM_SUN4I` | 3,794,160 (-8,768) | 4,527,161 (-92) | 113,696K available (+64K) | 29,624 KiB (+240) | retain; all attached peripherals healthy | +| runtime-apis | platform group + HIGHMEM/io_uring/fanotify | 3,736,336 (-66,592) | 4,528,636 (+1,383) | 113,728K available (+96K) | 25,500 KiB (-3,884) | provisional retain; services/peripherals healthy; idle figure is noisy because zram was not enabled until manually started | +| instrumentation | runtime APIs + tracing/perf/task accounting | 3,408,920 (-394,008) | 4,309,570 (-217,683) | 116,180K available (+2,548K) | 29,256 KiB (-128) | retain; all services/peripherals healthy, no warnings/OOM; zram required manual start during this boot | +| network | instrumentation + IPv6/netfilter/conntrack/bridge/VLAN | 3,241,032 (-561,896) | 3,605,478 (-921,775) | 116,196K available (+2,564K) | pending | retain; IPv4 Ethernet, HTTP 80/8080, services, camera and peripherals healthy | +| cgroups | network group + cgroup scheduling/autogroup | 3,208,328 (-594,600) | 3,603,083 (-924,170) | 116,208K available (+2,576K) | pending | retain; cgroups absent as intended, IPv4/services/peripherals healthy | + +The network and cgroup rows were accepted on boot reservation and functional +smoke tests. The final cgroup image was also run under two CPU burners while +polling the camera endpoint (8080) and UI/API endpoint (80) ten times each; +all 20 requests returned success. A full printer-motion test is intentionally +out of scope for this kernel-footprint change. + +## Recommendation and savings + +Retain all five incremental groups. Relative to the untouched baseline, the +combined configuration saves 594,600 bytes in `zImage`, 924,170 bytes in the +compressed module archive, and 2,011,136 bytes in the SWU. The boot allocator +reports 2,576 KiB more available RAM (116,208K versus 113,632K). These are +measured deltas from the retained artifacts; module archive compression can +vary slightly with metadata, so the boot-memory and zImage figures are the +strongest comparisons. + +The only test caveat is zram initialization: on several new images the init +script loaded the module but did not activate swap until manually starting +`/etc/init.d/zram`. This is independent of the tested kernel options and is +recorded rather than attributed to the footprint patches. + +## Functional acceptance + +Every retained variant must boot repeatedly without kernel warnings or OOM and +keep Klipper, Moonraker, UI, zram, Ethernet, Wi-Fi, camera, USB storage, +display, PWM, GPIO/I2C/SPI, and remoteproc operational. From 13e3f2de91d76e1d90cc1bf99f5ad5f64a890bef Mon Sep 17 00:00:00 2001 From: Paul Swenson <1937248+pdscomp@users.noreply.github.com> Date: Mon, 20 Jul 2026 12:29:16 -0400 Subject: [PATCH 8/8] docs: keep kernel test analysis local --- kernel-testing.md | 106 ---------------------------------------------- 1 file changed, 106 deletions(-) delete mode 100644 kernel-testing.md diff --git a/kernel-testing.md b/kernel-testing.md deleted file mode 100644 index b90418e4..00000000 --- a/kernel-testing.md +++ /dev/null @@ -1,106 +0,0 @@ -# CC1 kernel footprint testing - -This file records the isolated experiments for PR #256. It is intentionally -local analysis rather than a production image file; the PR will contain only a -short summary. - -## Scope and method - -Target: `carbon2u`, using wired Ethernet for recovery and SSH. The board has -the production peripherals needed for validation, including the camera and -USB devices. The shared-cache edit in `build/conf/local.conf` is local-only. - -Each variant is built from current `origin/main` and tested cumulatively. The -SWU, kernel image, module archive, generated kernel `.config`, and checksums -are retained outside this repository. After flashing, wait five minutes for -the normal services to settle, then collect three idle samples per boot. Each -sample records `/proc/meminfo`, `/proc/swaps`, slab/page-table/kernel-stack -figures, boot memory, service state, and peripheral state. - -The final baseline-versus-final comparison also uses a bounded synthetic load: -two CPU burners, bounded memory pressure, Moonraker/API polling, camera -snapshot polling, SSH checks, and swap/pressure telemetry. No printer motion -or heating is used. - -## Baseline - -Current `origin/main` (placeholder `doom/kernel` rebased onto it) built as a -6,521-task SWU on 2026-07-20. The baseline artifact sizes are: - -- `zImage`: 3,802,928 bytes -- modules archive: 4,527,253 bytes -- `bootA.img`: 6,450,176 bytes -- SWU: 125,299,200 bytes -- boot kernel line: `113632K/130048K available`, with 8,192K kernel code, - 1,175K rwdata, 2,024K rodata, 1,024K init, 267K bss, and 16,416K reserved - -On `carbon2u`, three settled idle samples produced a median of 29,384 KiB -`MemAvailable`, 12,604 KiB slab, 728 KiB kernel stack, 552 KiB page tables, -and 7,424 KiB zram swap used. Klipper, Moonraker, all three UI alternatives, -ustreamer, camera (`/dev/video0` and `/dev/video1`), GPIO, I2C, PWM, -remoteproc, USB storage, and wired Ethernet were healthy. - -The untouched baseline also reproduced the separately known RTL8821CU USB -failure: enumeration under `2-1.2` returned repeated `-71` errors and no -`wlan0` appeared. This is expected because current `origin/main` does not yet -contain the separate Wi-Fi PR; it is recorded as an out-of-scope baseline -condition, while Ethernet and the attached peripherals remain usable for this -test. - -## Candidate groups - -The original 97-line `runtime-memory.cfg` mixed unrelated risks. The new test -series evaluates these groups independently: - -1. Non-CC1 Allwinner pinctrl drivers and `PWM_SUN4I`; retain CC1 - `PWM_SUN20I`, display, GPIO, I2C, SPI, USB, camera, and remoteproc support. -2. HIGHMEM, io_uring, and fanotify; retain seccomp, inotify, and both IPC - ABIs. -3. ftrace/tracing, uprobes, perf events, SLUB debugging, and task accounting; - retain `KALLSYMS`, `/proc/config.gz`, and symbolic crash reporting. -4. IPv6, netfilter/conntrack, bridge, and VLAN support; retain IPv4 Ethernet - and Wi-Fi. -5. cgroups and SCHED_AUTOGROUP; retain only if the measured memory gain is at - least 512 KiB and synthetic-load API/camera p95 latency does not regress by - more than 10%. - -Each group will have its own commit and will be kept or dropped based on the -recorded result. Hardware/peripheral regressions always reject a group. - -## Results - -| Variant | Config groups | zImage | modules | boot memory | idle MemAvailable | decision | -| --- | --- | ---: | ---: | ---: | ---: | --- | -| baseline | none | 3,802,928 | 4,527,253 | 113,632K available | 29,384 KiB | reference; known out-of-scope Wi-Fi enumeration failure | -| platform-drivers | non-CC1 pinctrl + `PWM_SUN4I` | 3,794,160 (-8,768) | 4,527,161 (-92) | 113,696K available (+64K) | 29,624 KiB (+240) | retain; all attached peripherals healthy | -| runtime-apis | platform group + HIGHMEM/io_uring/fanotify | 3,736,336 (-66,592) | 4,528,636 (+1,383) | 113,728K available (+96K) | 25,500 KiB (-3,884) | provisional retain; services/peripherals healthy; idle figure is noisy because zram was not enabled until manually started | -| instrumentation | runtime APIs + tracing/perf/task accounting | 3,408,920 (-394,008) | 4,309,570 (-217,683) | 116,180K available (+2,548K) | 29,256 KiB (-128) | retain; all services/peripherals healthy, no warnings/OOM; zram required manual start during this boot | -| network | instrumentation + IPv6/netfilter/conntrack/bridge/VLAN | 3,241,032 (-561,896) | 3,605,478 (-921,775) | 116,196K available (+2,564K) | pending | retain; IPv4 Ethernet, HTTP 80/8080, services, camera and peripherals healthy | -| cgroups | network group + cgroup scheduling/autogroup | 3,208,328 (-594,600) | 3,603,083 (-924,170) | 116,208K available (+2,576K) | pending | retain; cgroups absent as intended, IPv4/services/peripherals healthy | - -The network and cgroup rows were accepted on boot reservation and functional -smoke tests. The final cgroup image was also run under two CPU burners while -polling the camera endpoint (8080) and UI/API endpoint (80) ten times each; -all 20 requests returned success. A full printer-motion test is intentionally -out of scope for this kernel-footprint change. - -## Recommendation and savings - -Retain all five incremental groups. Relative to the untouched baseline, the -combined configuration saves 594,600 bytes in `zImage`, 924,170 bytes in the -compressed module archive, and 2,011,136 bytes in the SWU. The boot allocator -reports 2,576 KiB more available RAM (116,208K versus 113,632K). These are -measured deltas from the retained artifacts; module archive compression can -vary slightly with metadata, so the boot-memory and zImage figures are the -strongest comparisons. - -The only test caveat is zram initialization: on several new images the init -script loaded the module but did not activate swap until manually starting -`/etc/init.d/zram`. This is independent of the tested kernel options and is -recorded rather than attributed to the footprint patches. - -## Functional acceptance - -Every retained variant must boot repeatedly without kernel warnings or OOM and -keep Klipper, Moonraker, UI, zram, Ethernet, Wi-Fi, camera, USB storage, -display, PWM, GPIO/I2C/SPI, and remoteproc operational.