Skip to content

telemetry: do not scan the stacks of user-mode threads - #11549

Open
abonislawski wants to merge 1 commit into
thesofproject:mainfrom
abonislawski:telemetry_user_stack_scan
Open

abonislawski wants to merge 1 commit into
thesofproject:mainfrom
abonislawski:telemetry_user_stack_scan

Conversation

@abonislawski

Copy link
Copy Markdown
Member

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.

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>
Copilot AI balanced review requested due to automatic review settings November 27, 2026 08:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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_SWAP is 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

@intel-sofci

intel-sofci commented Nov 27, 2026 •

Copy link
Copy Markdown

PR 11549: test results

Run date: 2026-11-27 09:22 UTC

Tested commit: 4cdd784ffd1e6204b826dfa38d5c2eb2dd2eea50

mtl pass rate lnl pass rate ptl pass rate wcl pass rate nvl pass rate

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.

3 participants