Repository navigation
telemetry: do not scan the stacks of user-mode threads - #11549
Conversation
The thread telemetry refresh runs in a kernel thread and read the stack of every thread to measure its high-water mark. For a user-mode thread this leaves kernel-ring DTLB entries for its stack. Its window handlers then fault on them and the DSP hangs. Skip the scan for user-mode threads and report 0, unless XTENSA_MMU_FLUSH_AUTOREFILL_DTLBS_ON_SWAP is enabled. Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
There was a problem hiding this comment.
🔵 Needs a closer look
The safe-scan exception depends on Zephyr Xtensa DTLB flushing code absent from this snapshot, requiring target validation with the option enabled and disabled to confirm user threads resume without DSP hangs.
No open issues 🎉
What changed in this PR
This PR prevents telemetry stack scans from leaving kernel-ring DTLB entries that can cause user-mode threads to fault and hang the DSP.
Changes:
- Skip user-mode stack scans unless
XTENSA_MMU_FLUSH_AUTOREFILL_DTLBS_ON_SWAPis enabled. - Document that skipped stack high-water measurements are reported as 0.
| File | Description |
|---|---|
src/kernel/debug/telemetry/telemetry.c |
Gates user-mode stack scans on the DTLB-flush configuration. |
src/kernel/debug/telemetry/Kconfig |
Documents when user-mode stack measurements are skipped. |
src/include/sof/debug/telemetry/telemetry.h |
Clarifies that stack_usage is 0 when scanning is skipped. |
Review effort: Balanced
PR 11549: test resultsRun date: 2026-11-27 09:22 UTC Tested commit: 4cdd784ffd1e6204b826dfa38d5c2eb2dd2eea50 |
lgirdwood
left a comment
There was a problem hiding this comment.
@abonislawski @kv2019i the lack of DTLB flush on swap has potential to get us in other places too as we integrate more userspace (thinking around some syscalls where we pass objects around). XTENSA_MMU_FLUSH_AUTOREFILL_DTLBS_ON_SWAP is the safe mode, but has anyone measured the cost of enabling this ?
|
@lgirdwood This PR with one next one should unblock Internal CI pipeline. This one should be merge first. |
The thread telemetry refresh runs in a kernel thread and read the stack of every thread to measure its high-water mark. For a user-mode thread this leaves kernel-ring DTLB entries for its stack. Its window handlers then fault on them and the DSP hangs.
Skip the scan for user-mode threads and report 0, unless XTENSA_MMU_FLUSH_AUTOREFILL_DTLBS_ON_SWAP is enabled.