Skip to content

dts: fix memory allocation failed and move the pipeline to different core - #11230

Open
joechengxperi wants to merge 3 commits into
thesofproject:mainfrom
joechengxperi:dts-ptl-issue-fix-main
Open

joechengxperi wants to merge 3 commits into
thesofproject:mainfrom
joechengxperi:dts-ptl-issue-fix-main

Conversation

@joechengxperi

Copy link
Copy Markdown
Contributor

This PR is to resolve the issue Google reported that audio device would lost when there are two applications running and switch endpoint simultaneously.

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.

Copilot review overview

🟡 Changes recommended

Replace the undefined heap symbol with SOF_ZEPHYR_VIRTUAL_HEAP_REGION_SIZE.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
What changed in this PR

This PR adds DTS-specific SoundWire topologies, configurable core placement, and a PTL heap adjustment to address endpoint switching and allocation failures.

Changes:

  • Adds DTS SDCA topology targets.
  • Applies DTS_CORE_ID to DTS pipelines and widgets.
  • Adds PTL virtual-heap configuration.
File Summary
tools/​topology/​topology2/​production/​tplg-targets-sdca-generic.cmake Adds DTS SDCA topology targets.
tools/​topology/​topology2/​platform/​intel/​sdw-jack-dts.conf Applies configurable core affinity to jack DTS pipelines.
tools/​topology/​topology2/​platform/​intel/​sdw-amp-dts.conf Applies configurable core affinity to amplifier DTS pipelines.
tools/​topology/​topology2/​cavs-sdw.conf Defines the default DTS core.
app/​overlays/​ptl/​dts_overlay.conf Attempts to configure the PTL virtual heap, but uses an undefined Kconfig symbol and does not change the heap size.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread app/overlays/ptl/dts_overlay.conf Outdated
CONFIG_LLEXT_HEAP_SIZE=64
CONFIG_KCPS_DYNAMIC_CLOCK_CONTROL=n
CONFIG_SOF_STACK_SIZE=8192
CONFIG_SOF_ZEPHYR_VIRTUAL_HEAP_SIZE=0x80000

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@joechengxperi This should change CONFIG_SOF_ZEPHYR_HEAP_SIZE due to a recent rename. See commit 5cf6f9c

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@kv2019i
I've updated it now. And I have one question. I will have to create another PR to merge this to ptl-008-drop-stable. I just checked there is no this commit 5cf6f9c in ptl-008-drop-stable. Will this commit 5cf6f9c be cherry-picked to ptl-008-drop-stable? Thanks.
cc @macchian

{
index 21
core_id $DTS_CORE_ID
core $DTS_CORE_ID

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think only one of them is needed and I think it's core, could you check?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yes, it's confusing the tplg compiler doesn't catch this, but for the pipeline widget, only "core" is needed.

But I won't block because of this, "core" is the pipeline level token (SOF_TKN_SCHED_CORE for Linux kernel) and "core_id" is the widget token (SOF_TKN_COMP_CORE_ID in Linux kernel). For a pipeline, both can be set, but only "core" is needed as Linux driver will force same values.

This is confusing I admit and we should improve this for topology developers.

core_id $DTS_CORE_ID

Object.Widget.pipeline.1 {
core $DTS_CORE_ID

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

right, I think pipeline widgets use core, while processing components use core_id

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Patches 2/3 are good to merge now, there are some inflight memory changes now so teh fiest patch could merge then be deleted in a few weeks. @kv2019i whats the current status ?

@kv2019i kv2019i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please fix the Kconfig name due to recent rename. Minor comments otherwise (other comments not blocking).

Comment thread app/overlays/ptl/dts_overlay.conf Outdated
CONFIG_LLEXT_HEAP_SIZE=64
CONFIG_KCPS_DYNAMIC_CLOCK_CONTROL=n
CONFIG_SOF_STACK_SIZE=8192
CONFIG_SOF_ZEPHYR_VIRTUAL_HEAP_SIZE=0x80000

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@joechengxperi This should change CONFIG_SOF_ZEPHYR_HEAP_SIZE due to a recent rename. See commit 5cf6f9c

{
index 21
core_id $DTS_CORE_ID
core $DTS_CORE_ID

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yes, it's confusing the tplg compiler doesn't catch this, but for the pipeline widget, only "core" is needed.

But I won't block because of this, "core" is the pipeline level token (SOF_TKN_SCHED_CORE for Linux kernel) and "core_id" is the widget token (SOF_TKN_COMP_CORE_ID in Linux kernel). For a pipeline, both can be set, but only "core" is needed as Linux driver will force same values.

This is confusing I admit and we should improve this for topology developers.

SDW_AMP_FEEDBACK=false,SDW_SPK_STREAM=Playback-SmartAmp,NUM_HDMIS=0,\
DEEP_BUF_SPK=true"

"cavs-sdw\;sof-sdca-jack-id0-dts\;SDW_JACK_OUT_STREAM=Playback-SimpleJack,\

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

FYI @bardliao @ujfalusi I have no objections to this. Just noting there has been work ongoing to standardize how to extended SDCA topologies (and/or use feature topologies).

DTS library would allocate memory failed when there are multiples apps
are launched and endpoint switches at the same time.

Incease the size to avoid this issue

Signed-off-by: Joe Cheng <joe.cheng@xperi.com>
Add DTS_CORE_ID and let the pipeline could run on approriate core

Signed-off-by: Joe Cheng <joe.cheng@xperi.com>
Enable DTS topology for SDCA and set to different cores for
speaker/heapdhone pipeline to avoid resource not enough

Signed-off-by: Joe Cheng <joe.cheng@xperi.com>
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.

5 participants