Skip to content

Fix swapped module/instance IDs in IPC4 performance reports - #11613

Open
gjanca wants to merge 3 commits into
thesofproject:mainfrom
gjanca:mod_inst_swap
Open

gjanca wants to merge 3 commits into
thesofproject:mainfrom
gjanca:mod_inst_swap

Conversation

@gjanca

@gjanca gjanca commented Dec 3, 2026

Copy link
Copy Markdown

Encode module resource_id as [module_id | instance_id] in IPC4 reports
Internal component IDs use IPC4_COMP_ID(module_id, instance_id) [instance_id | module_id],
whereas IPC4 GLOBAL_PERF_DATA (param 18) and EXTENDED_GLOBAL_PERF_DATA (param 30) expect (module_id << 16) | instance_id.
Convert module entries via perf_report_module_id() when serializing reports, leaving core-summary records (resource_id = core_id) unchanged.

Zero-initialize ADSP_PMW component slots
Unconditionally clear perf_data during init, slot allocation perf_data_getnext(),
slot release perf_data_free(), and perf_data_item_comp_init() so reserved
flag bits (rsvd) and accumulators cannot retain stale SRAM values when
slots are reused or components are created while measurements are disabled.

Convert internal component IDs to the IPC4 report format in both
the standard and extended performance reports. Put the module ID
in bits 31:16 and the instance ID in bits 15:0 so report readers
decode both fields correctly. Leave core resource IDs unchanged.

Signed-off-by: Grzegorz Janca <grzegorz.janca@intel.com>
Clear perf_data slots unconditionally during performance_monitor_init(),
perf_data_getnext(), perf_data_free(), and perf_data_item_comp_init().

Previously, slot clearing depended on
CONFIG_SOF_TELEMETRY_MODULE_RESOURCES and reserved flag bits were left
untouched, allowing stale SRAM contents to leak into GLOBAL_PERF_DATA
when components were created while measurements were disabled.

Signed-off-by: Grzegorz Janca <grzegorz.janca@intel.com>
Use LIB_MANAGER_PACK_MODULE_ID(lib_id, mod_id) when building comp_id
for ipc4_get_comp_dev() in enable_performance_counters().

Without packing lib_id, loaded-library module instances (lib_id > 0)
were not found and their performance counters were not reinitialized
when measurements transitioned from disabled to started.

Signed-off-by: Grzegorz Janca <grzegorz.janca@intel.com>
Copilot AI balanced review requested due to automatic review settings December 3, 2026 16:09
@sofci

sofci commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

reply test this please to run this test once

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.

🟢 Approval recommended

No active review issues are reported for the IPC4 performance-report identifier and telemetry-slot cleanup changes.

No open issues 🎉

What changed in this PR

Corrects module identifiers in IPC4 performance reports and prevents stale data in component telemetry slots.

Changes:

  • Encodes report IDs as (module_id << 16) | instance_id, leaving core-summary IDs unchanged.
  • Clears component performance data during initialization, allocation, and release.
  • Includes library IDs when locating components to enable performance counters.
File Description
src/​kernel/​debug/​telemetry/​performance_monitor.c Fixes report ID encoding, component lookup, and performance-slot clearing.

Review effort: Balanced

@lgirdwood

Copy link
Copy Markdown
Member

test this please

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.

4 participants