Debug stream debugfs - #5154
Debug stream debugfs#5154jsarha wants to merge 6 commits into
Conversation
ujfalusi
left a comment
There was a problem hiding this comment.
@jsarha, what I would do is:
rename the ipc4-telemetry.c to ipc4-debugfs.c or something generic and use this to export the raw slots on the needed base.
You can have a single exported function as entry point, you can even move here the sof_ipc4_find_debug_slot_offset_by_type() function...
I know, mtrace is also uses debug slot, but it has been special cased out...
The ipc4-telemetry.h should remain as it is.
672baba to
68be79a
Compare
@ujfalusi I took a shot at this. I still try make sure the zephyr tool can still read the execption file. |
ok, we can park now and see how well existing tools work - if slow or inconsistent we can continue here. |
I think this is useful in situations where no Python runtime is available. @ranj063 @ujfalusi @bardliao lets move forward with this. |
68be79a to
2bd0077
Compare
|
Rephrased the first commit message a bit and resurrected ipc4-telemetry.h in the last commit (and updated the message accordingly), which is currently actually used. The code still works with debug_stream.py. |
|
@lgirdwood should we still get this merged? @ujfalusi should I rebase, the PR getting old, again? |
|
@jsarha Is this PR still valid? |
Yes it is, or at least it was. But its not mandatory as debug_stream.py is able to use cavstool.py 's /dev/kmem code to get access to the debug window slot in question. |
|
@jsarha Can you resolve the conflicts? Then we can merge it. |
7d84e22 to
8969765
Compare
|
@lyakh Would you like to approve this PR again? So that we will take your Reviewed-by tag |
There was a problem hiding this comment.
Pull request overview
This PR updates the SOF IPC4 debug-window tooling by exposing the firmware “debug stream” slot (and reworking the existing exception/telemetry slot exposure) via dedicated read-only debugfs nodes.
Changes:
- Add a generic IPC4 debug-slot → debugfs mapping helper and use it to create
exceptionanddebug_streamdebugfs files at FW-ready time. - Remove the older IPC4 telemetry-specific debugfs implementation in favor of the new generic helper.
- Add the IPC4 debug-slot type constant for the debug stream slot.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| sound/soc/sof/Makefile | Swap IPC4 telemetry debugfs object for the new generic debug-slot debugfs object. |
| sound/soc/sof/ipc4.c | Create debugfs nodes for telemetry/exception and debug stream slots; rate-limit missing-slot debug logging. |
| sound/soc/sof/ipc4-telemetry.h | Drop the now-removed exception debugfs node creation prototype. |
| sound/soc/sof/ipc4-telemetry.c | Remove telemetry-specific debugfs implementation (replaced by generic helper). |
| sound/soc/sof/ipc4-priv.h | Add prototype for the new generic debug-slot debugfs node helper. |
| sound/soc/sof/ipc4-debug-slot-debugfs.c | New generic debug-slot debugfs read implementation. |
| include/sound/sof/ipc4/header.h | Define SOF_IPC4_DEBUG_SLOT_DEBUG_STREAM slot type. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| } | ||
|
|
||
| sof_ipc4_create_exception_debugfs_node(sdev); | ||
| /* sizeof(u32)is for skiping the first separator magic number */ |
There was a problem hiding this comment.
🟡 Changes recommended
A critical bounds-check overflow issue and a moderate comment issue remain unresolved.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (2)
sound/soc/sof/ipc4-debug-slot-debugfs.c:52
- Descriptor 15 is documented as a partial slot at page 0 + 1024, so this unconditional 4 KiB mailbox read crosses into the next page and exposes unrelated data when the requested type is placed there. Compute the actual slot length from the descriptor and use it both for the read limit and the debugfs file size.
sof_mailbox_read(sdev, offset + doffset, buf, SOF_IPC4_DEBUG_SLOT_SIZE - doffset);
sound/soc/sof/ipc4.c:743
- Fix the missing spacing and the misspelling in this newly added comment.
/* sizeof(u32)is for skiping the first separator magic number */
- Files reviewed: 7/7 changed files
- Comments generated: 1
- Review effort level: Lite
Adds sof_ipc4_create_debug_slot_ro_debugfs_node() -function for mapping a SOF Intel ipc4 debug window slot as debugfs file. The actual slot is specified with slot_type parameter. The alternatives are defined in include/sound/sof/ipc4/header.h and the slot is found with sof_ipc4_find_debug_slot_offset_by_type(). It also takes the data_offset parameter that specifies where the payload data in the slot begins. The portion that is mapped to the debugfs file is everything after the offset. The last parameter is the name of the file. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
Add new debug window slot type for debug-stream protocol. For details see src/debug/debug_stream/debug_stream_slot.h under SOF sources [1]. [1] https://github.com/thesofproject/sof Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
Maps debug-stream debug window slot as read-only debugfs file with sof_ipc4_create_debug_slot_ro_debugfs_node() -function. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
… file Remove sof_ipc4_create_exception_debugfs_node() and ipc4-telemetry.c, and use sof_ipc4_create_debug_slot_ro_debugfs_node() instead for mapping "exception" debugfs file. In running system the SOF_IPC4_DEBUG_SLOT_TELEMETRY is used for telemetry data, but if configured, Zephyr exception data is dumped in the same debug window slot, right after the separator word. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
sof_ipc4_find_debug_slot_offset_by_type() prints a dev_dbg message every time a slot type is not found. When debugfs files are polled while the DSP is suspended, this fires on every access and spams the kernel log. Use dev_dbg_ratelimited() to suppress repeated messages. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
d9665cc to
3b36e5a
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The partial descriptor read can expose unrelated data, and the new comment contains a spelling error.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (1)
sound/soc/sof/ipc4.c:744
- Correct the spelling in this newly added comment: “skiping” should be “skipping”.
/* sizeof(u32) is for skiping the first separator magic number */
- Files reviewed: 7/7 changed files
- Comments generated: 1
- Review effort level: Lite
| buf = kzalloc(SOF_IPC4_DEBUG_SLOT_SIZE - doffset, GFP_KERNEL); | ||
| if (!buf) | ||
| return -ENOMEM; | ||
|
|
||
| sof_mailbox_read(sdev, offset + doffset, buf, SOF_IPC4_DEBUG_SLOT_SIZE - doffset); |
This commit simply maps the identified debug-stream debug window slot as a debugfs file.