Skip to content

kernel/user partition, Phase 4 part 5: remove the last unused kernel-only includes - #11480

Merged
lgirdwood merged 4 commits into
thesofproject:mainfrom
lgirdwood:kernel-user/phase4e
Nov 18, 2026
Merged

lgirdwood merged 4 commits into
thesofproject:mainfrom
lgirdwood:kernel-user/phase4e

Conversation

@lgirdwood

@lgirdwood lgirdwood commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Phase 4 of #11306 (kernel / user-space partition), fifth part: remove the last kernel-only includes that user-space code does not use, and shrink the leak baseline from 22 to 16 sources.

Patches

  1. iadk: the IADK system agent, KPB service and timestamping service only use the APP_TASK_DATA partition marker. They include rtos/userspace_data.h, which defines it, instead of the kernel-only rtos/userspace_helper.h.
  2. rtos: wait: rtos/wait.h uses nothing from rtos/timer.h; its delays use k_busy_wait(). Dropping the include keeps the platform timestamp and cycle counter header out of the user-space sources that use the delays. zephyr/wrapper.c used the cycle counter through it and now includes rtos/timer.h.
  3. platform: intel: ace: move auth/intel_status_logger_iface.h to src/platform.
    • It only defines the status logger callback types. sof/auth_api_iface.h uses them, and sof/lib_manager.h includes that, so the IPC4 user-space handler and the native system service got a header from the kernel platform directory.
    • intel_status_logger_api.h, which included it by a path relative to the old directory, now includes it by its include name.
    • The src/platform README lists it.
  4. Baseline: remove the six sources that are now clean: the three IADK services, the native system service, the IPC4 user-space handler and the detect test sample.

What is left

With this, no user-space source includes a kernel-only header that it does not use. The 16 sources left in the baseline call kernel functions, which needs system calls or design changes rather than header work. They are the remaining Phase 5 items:

Kernel API Sources
irq_local_disable()/irq_local_enable() copier, DAI, pipeline graph and schedule, IPC helpers (2), LL scheduler
platform_host_timestamp(), platform_dai_timestamp(), platform_dai_wallclock() pipeline stream and xrun, DAI, IPC4 DAI
cycle counter (sof_cycle_get_64(), perf_cnt) KPB, component, LL scheduler
clock and core load (clock_get_freq(), core_kcps_*(), CLK_MAX_CPU_HZ) pipeline graph and stream
sa_set_panic_on_delay(), watchdog_feed() pipeline schedule, LL domain
pm_runtime_*(), HEAP_HP_BUFFER_BLOCK_SIZE KPB
user_stack_free() DP scheduler
memory map notifier (to be removed in Phase 5), DRAM tester

Functional change

None.

Testing

  • Include checker: with --strict, it passes for each of the 12 CI build configurations, built locally as CI does (repro-build.conf, -Werror), and for every other configuration below. Across all of them, exactly the 16 baseline sources leak.
  • Per commit, compared with main:
    • Builds: tgl, tgl-h, mtl, lnl, ptl, wcl, nvl, imx8, imx8x, imx8m, imx8m_cm7, imx8ulp, imx95 and qemu_xtensa, and the extra CI configurations:
      • native_sim IPC3/IPC4 stub builds;
      • imx93 64-bit;
      • PTL with each userspace overlay;
      • PTL with CONFIG_SOF_USERSPACE_PROXY=n;
      • PTL and MTL with os_linux_overlay.conf;llext_relocatable.conf;
      • PTL and TGL with app/debug_stream_overlay.conf, and PTL with that overlay and user-space LL.
    • Comparisons: objects, LLEXT modules and firmware images (sections, symbols, SYS_INIT() order), and the per-function disassembly. No object changes at any commit. The only image difference is sof_init() on imx8m_cm7, imx93 and imx95, which embeds the git hash.
    • Signing: rimage runs for every Intel platform, and the generated configs are unchanged.
    • Cadence xt-clang (RI-2022.10): MTL, PTL and NVL compile.
    • ZTest: the unit tests pass, run as in CI (20 of 20 configurations).
    • Host: the host library and the cmocka unit tests build and pass.
  • At the tip:
    • the testbench and the tools pass;
    • the host library and the cmocka unit tests pass for all nine defconfigs and the library config;
    • the platforms that already fail on main (acp_6_0, acp_7_0, acp_7_x, mt8186, mt8188, mt8195, mt8196, mt8365) have unchanged error sets.

All of the above was run on 72e797d (current main).

Changes since the last push

🤖 Generated with Claude Code

lrgirdwo and others added 4 commits November 18, 2026 10:03
The IADK system agent, KPB service and timestamping service only use
the APP_TASK_DATA partition marker, which rtos/userspace_data.h
defines. rtos/userspace_helper.h is the kernel-only header for the
memory domain and stack helpers, and includes rtos/userspace_data.h.
Include only what these sources use.

No functional change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Liam Girdwood <[email protected]>
rtos/wait.h uses nothing from rtos/timer.h: its delays use Zephyr's
k_busy_wait(). Drop the include, which brought the platform timestamp
and cycle counter header into the user-space sources that use the
delays.

zephyr/wrapper.c used the cycle counter through this header, so it
includes rtos/timer.h.

No functional change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Liam Girdwood <[email protected]>
sof/auth_api_iface.h, which sof/lib_manager.h includes, uses the
status logger callback types of auth/intel_status_logger_iface.h. So
the user-space sources that include the library manager header, the
IPC4 user-space handler and the native system service, got a header
from the kernel platform directory. It only defines callback types.

Move it to src/platform, and include it by its include name in
intel_status_logger_api.h, which included it by a path relative to
the old directory.

No functional change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Liam Girdwood <[email protected]>
Six sources no longer include kernel-only headers in any
configuration: the three IADK service sources, the native system
service, the IPC4 user-space handler and the detect test sample.
Remove them from the leak baseline.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Liam Girdwood <[email protected]>
@lgirdwood

Copy link
Copy Markdown
Member Author

unrelated CI issues with docker.

@lgirdwood
lgirdwood merged commit edc53eb into thesofproject:main Nov 18, 2026
43 of 45 checks passed
@lgirdwood
lgirdwood deleted the kernel-user/phase4e branch November 18, 2026 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants