Skip to content

sof-top: notify user when local kernel devices are missing or inaccessible - #10

Merged
lgirdwood merged 2 commits into
mainfrom
feat/sof-top-local-device-notices
Dec 4, 2026
Merged

lgirdwood merged 2 commits into
mainfrom
feat/sof-top-local-device-notices

Conversation

@lgirdwood

Copy link
Copy Markdown
Member

Summary

Adds clear user-facing diagnostics across sof-top (GTK4 UI + headless render), sof-top-cli, and backend.py whenever either local SOF kernel interface (/dev/sof-dsp0 vs SOF DebugFS /sys/kernel/debug/sof + PCI/ALSA SysFS) is absent or inaccessible:

  • Backend probe (probe_local_sof_device):
    • Checks /dev/sof-dsp0 accessibility (R_OK | W_OK) alongside DebugFS and PCI/ALSA SysFS discovery.
    • Populates explicit warning and reason messages for partial or completely missing local interfaces (missing /dev/sof-dsp0, permission-denied /dev/sof-dsp0, missing/unmounted DebugFS, permission-denied DebugFS, or SysFS/DebugFS absent).
  • Local backend (LocalCdevBackend):
    • Separates non-fatal connection/telemetry notices into last_note so healthy read-only/CDEV telemetry keeps summary.last_error == "" in sof-top-cli.
    • Fixes auto mode fallback to /dev/sof-dsp0 when SysFS/DebugFS discovery returns false but /dev/sof-dsp0 exists.
    • Improves explicit /dev/sof-dsp* open failure messages with hints when SysFS/DebugFS is available.
  • CLI (sof-top-cli) & UI (sof-top):
    • Prints non-fatal device notices as WARNING: to stderr in sof-top-cli and sof-top --render-png (keeping stdout JSON clean).
    • Warns on stderr when --wake or --hold-d0 is ignored in read-only mode.
    • Surfaces device warnings in the sof-top GTK4 UI Local Device dropdown tooltip, disabled PM button tooltips, connection status banner, and polling status bar Note:.

Verification

  • make -C sof-top check (py_compile) passes.
  • Mocked verification covering all combinations (neither interface present, DebugFS without /dev/sof-dsp0 + --wake, /dev/sof-dsp0-only auto fallback, permission-denied DebugFS/cdev, both interfaces present cleanly, UI headless render warnings, and missing explicit /dev/sof-dsp99).
  • Live smoke tests on Dragon Fly (sof-arl-s): verified non-sudo --wake read-only warning, missing /dev/sof-dsp99 error, and sudo --local /dev/sof-dsp0 --wake full CDEV telemetry.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Polling permission notices remain hidden from CLI and headless output, and unavailable SysFS/DebugFS selections produce misleading connection errors.

2 open issues
What changed in this PR

Adds diagnostics for missing or inaccessible local SOF interfaces across the backend, CLI, and GTK/headless UI.

Changes:

  • Separates non-fatal notices from telemetry errors.
  • Adds CDEV fallback when automatic SysFS/DebugFS discovery fails.
  • Displays device warnings and explains ignored power-management options.
File Description
sof-top/​sof-top-cli Prints connection and ignored-option warnings to stderr.
sof-top/​sof-top Adds warnings to GTK status/tooltips and headless output.
sof-top/​backend.py Expands interface diagnostics, separates notices, and adds automatic CDEV fallback.

Review effort: Balanced

Comment thread sof-top/backend.py Resolved
Comment thread sof-top/backend.py Resolved
@lgirdwood
lgirdwood marked this pull request as ready for review December 4, 2026 15:50
…sible

Surface clear warnings and status messages across backend probing, CLI
(sof-top-cli), and GTK4 UI (sof-top) whenever either /dev/sof-dsp0 or
SOF DebugFS/SysFS is absent or lacks permissions:

- backend.probe_local_sof_device(): check /dev/sof-dsp0 accessibility
  (R_OK|W_OK) alongside DebugFS/SysFS presence and emit explicit
  'warning' / 'reason' diagnostics for missing or inaccessible devices.
- backend.LocalCdevBackend: track non-fatal device notices in 'last_note'
  without polluting 'last_error' on healthy read-only/cdev connections,
  auto-fallback to /dev/sof-dsp0 in 'auto' mode when SysFS/DebugFS are
  absent, and provide clearer errors when explicit /dev/sof-dsp* fails.
- sof-top-cli & sof-top --render-png: print backend 'last_note' as a
  stderr WARNING and warn explicitly when --wake / --hold-d0 is ignored
  in read-only mode.
- sof-top GTK4 UI: include missing/inaccessible device notices in the
  Local Device dropdown tooltip, disabled PM button tooltips, status bar
  connection banner, and polling status bar Note field.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
lgirdwood pushed a commit that referenced this pull request Dec 4, 2026
- backend.py: Report unavailable SysFS/DebugFS clearly and suggest
  --local /dev/sof-dsp0 or --local auto when only CDEV is present, set
  last_note/last_error on CDEV polls, initialize RemoteTcpBackend.last_note,
  and add shared emit_new_backend_notes() helper.
- sof-top-cli, sof-top: Emit newly discovered polling permission notes
  (e.g. fw_regs/exception EACCES) once to stderr via
  emit_new_backend_notes() while keeping last_error for failures.
- sof-top/tests/test_local_device_notices.py: Add unit tests covering
  local device probing, CDEV fallback/errors, and polling note dedup.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
@lgirdwood
lgirdwood force-pushed the feat/sof-top-local-device-notices branch from 091c0eb to d237e1c Compare December 4, 2026 15:53
- backend.py: Report unavailable SysFS/DebugFS clearly and suggest
  --local /dev/sof-dsp0 or --local auto when only CDEV is present, set
  last_note/last_error on CDEV polls, add RemoteTcpBackend.last_note,
  and add shared emit_new_backend_notes() helper.
- sof-top-cli, sof-top: Emit newly discovered polling permission notes
  (e.g. fw_regs/exception EACCES) once to stderr via
  emit_new_backend_notes() while keeping last_error for failures.
- sof-top/tests/test_local_device_notices.py: Add unit tests covering
  local device probing, CDEV fallback/errors, and polling note dedup.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
@lgirdwood
lgirdwood force-pushed the feat/sof-top-local-device-notices branch from d237e1c to 273c33d Compare December 4, 2026 15:53
@lgirdwood
lgirdwood merged commit e24b8f6 into main Dec 4, 2026
11 checks passed
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