Repository navigation
Conversation
ujfalusi
requested review from
bardliao,
lyakh,
ranj063 and
singalsu
as code owners
October 22, 2026 11:33
There was a problem hiding this comment.
🟡 Changes recommended
Concurrent debugfs reads can access freed memory, and unchecked allocation failures can publish incomplete topology lists.
2 open issues
What changed in this PR
This PR updates SOF’s fw_profile/tplg_name debugfs entry to report loaded topology files rather than a placeholder when function topologies are used.
Changes:
- Collect loaded topology filenames, separated by newlines and without the shared path prefix.
- Publish the collected list after successful topology completion, retaining the selected name as the initial value.
| File | Description |
|---|---|
| sound/soc/sof/topology.c | Collects filenames and publishes the loaded topology list. |
| sound/soc/sof/sof-priv.h | Adds storage for the loaded topology names. |
| sound/soc/sof/debug.c | Initializes the name storage and exposes it through debugfs. |
Review effort: Balanced
bardliao
previously approved these changes
Oct 22, 2026
ujfalusi
force-pushed
the
peter/sof/pr/show-all-loaded-topologies
branch
from
October 23, 2026 06:09
a50e45e to
fde6d64
Compare
Collaborator
Author
|
Changes since v1:
@harajend , this might impact CI as now with function (and feature) topologies the tplg_name will contain all the loaded topology files in the order they were loaded. |
snd_sof_load_topology() can fail after one or more topology files have been loaded: requesting a subsequent topology file, allocating the path of a feature topology, sof_complete() or snd_ctl_led_request() can fail at that point. snd_soc_tplg_component_load() only removes the topology objects when the load itself fails. When the component probe fails the ASoC core does not call the component remove callback, so the loaded topology objects are left behind referencing freed DAPM data. Call snd_soc_tplg_component_remove() whenever snd_sof_load_topology() fails. If the error came from snd_soc_tplg_component_load() the objects have been removed already and the second call is harmless. Drop the comments which claimed that the topology is removed on request_firmware() failure. Fixes: 6d5997c ("ASoC: SOF: topology: load multiple topologies") Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The fw_profile/tplg_name debugfs file exposes the topology file name selected for the platform. When function topologies are used, the selected name is a placeholder (sof-<platform>-dummy.tplg) which does not tell which topology files have actually been loaded. Replace the static name with a list of the loaded topology files, one per line, set by snd_sof_load_topology() after a successful load and cleared again when the loading fails or when the topology is removed in sof_pcm_remove(). The topology path prefix is dropped from the names as it is exposed separately via fw_profile/tplg_path. The file is backed by a seq_file reader instead of debugfs_create_str() so that the list can be replaced under a mutex without racing with concurrent readers. While no topology is loaded the selected topology name is shown. For monolithic topologies the content of the file is unchanged. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
ujfalusi
force-pushed
the
peter/sof/pr/show-all-loaded-topologies
branch
from
October 23, 2026 07:24
fde6d64 to
210ddc3
Compare
Collaborator
Author
|
Changes since v2:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


The
fw_profile/tplg_namedebugfs file exposes the topology file name selectedfor the platform. When function topologies are used, the selected name is a
placeholder (
sof-<platform>-dummy.tplg) which does not tell which topologyfiles have actually been loaded.
The second patch replaces the static name with a list of the loaded topology
files, one per line (the topology path prefix is dropped as it is exposed via
fw_profile/tplg_path). The list is set after a successful topology load andcleared again when the loading fails or the topology is removed; while no
topology is loaded the selected topology name is shown. For monolithic
topologies the content of the file is unchanged.
The first patch is a preparatory fix:
snd_sof_load_topology()can fail afterone or more topology files have been loaded (subsequent
request_firmware(),feature topology path allocation,
sof_complete(),snd_ctl_led_request()),but the loaded topology objects were only removed when
snd_soc_tplg_component_load()itself failed. Since the component removecallback is not called for a failed probe, they were left behind referencing
freed DAPM data. Remove the topology on any load error.
Example with function topologies:
Note: tools reading
tplg_nameand expecting a single file name will getmultiple lines on function topology systems (the dummy name never existed on
disk, so such tools did not work there before either).