Skip to content

Topology loading needs pm_runtime_get() held. #193

Closed

Description

@lgirdwood

It looks like there may be a race between topology loading and runtime PM entry. Can we make sure that pm_runtime_get() is called for duration of topology loading.

[    5.445558] sof-audio sof-audio: ipc tx: 0x30130000: GLB_TPLG_MSG: PIPE_COMPLETE
[    5.445615] sof-audio sof-audio: ipc tx succeeded: 0x30130000: GLB_TPLG_MSG: PIPE_COMPLETE
[    5.445623] sof-audio sof-audio: tplg: complete pipeline PIPELINE.2.SSP2.OUT id 13
[    5.445632] sof-audio sof-audio: ipc tx: 0x30130000: GLB_TPLG_MSG: PIPE_COMPLETE
[    5.445693] sof-audio sof-audio: ipc tx succeeded: 0x30130000: GLB_TPLG_MSG: PIPE_COMPLETE
[    5.445700] sof-audio sof-audio: tplg: complete pipeline PIPELINE.1.SSP4.OUT id 6
[    5.445709] sof-audio sof-audio: ipc tx: 0x30130000: GLB_TPLG_MSG: PIPE_COMPLETE
[    5.445768] sof-audio sof-audio: ipc tx succeeded: 0x30130000: GLB_TPLG_MSG: PIPE_COMPLETE
[    5.445792] sof-audio sof-audio: error: failed to enter PM idle -11

Activity

  1. added
    bugSomething isn't working
    APLApplies to ApolloLake platform
    on Oct 18, 2018
  2. mengdonglin commented on Oct 19, 2018

    @mengdonglin

    @lgirdwood Would you provide more info here so validation can reproduce and follow up?

    • topology
    • the steps to reproduce this issue

    I think you're using UP2, latest sof-dev, and sof master branch.

  3. lgirdwood commented on Oct 19, 2018

    @lgirdwood
    MemberAuthor

    Leafhill, I've only seen it once and it looks like an obvious runtime PM get() is needed during the duration of all topology loading.

  4. plbossart commented on Nov 1, 2018

    @plbossart
    Member

    @lgirdwood did you mean something like this:

    int snd_sof_load_topology(struct snd_sof_dev *sdev, const char *file)
    {
    	const struct firmware *fw;
    	struct snd_soc_tplg_hdr *hdr;
    	int ret;
    
    	dev_dbg(sdev->dev, "loading topology:%s\n", file);
    
    	ret = request_firmware(&fw, file, sdev->dev);
    	if (ret < 0) {
    		dev_err(sdev->dev, "error: tplg %s load failed with %d\n",
    			file, ret);
    		return ret;
    	}
    
    	ret = pm_runtime_get_sync(sdev->dev);
    	if (ret < 0) {
    		dev_err(sdev->dev, "error: topology load pm_runtime_get_sync failed with %d\n",
    			ret);
    		return ret;
    	}
    
    	hdr = (struct snd_soc_tplg_hdr *)fw->data;
    	ret = snd_soc_tplg_component_load(sdev->component,
    					  &sof_tplg_ops, fw,
    					  SND_SOC_TPLG_INDEX_ALL);
    	if (ret < 0) {
    		dev_err(sdev->dev, "error: tplg component load failed %d\n",
    			ret);
    		ret = -EINVAL;
    	}
    
    	ret = pm_runtime_put(sdev->dev);
    	if (ret < 0)
    		dev_err(sdev->dev, "error: topology load pm_runtime_put failed with %d\n",
    			ret);
    
    	release_firmware(fw);
    	return ret;
    }
  5. lgirdwood commented on Nov 1, 2018

    @lgirdwood
    MemberAuthor
  6. plbossart commented on Nov 1, 2018

    @plbossart
    Member

    ok, will push this code then. Thanks

  7. ranj063 commented on Nov 1, 2018

    @ranj063
    Collaborator

    @plbossart we enable runtime pm on sof device after the topology is loaded. To make the change above, maybe we need to change that as well?

  8. lgirdwood commented on Nov 1, 2018

    @lgirdwood
    MemberAuthor

    @ranj063 is that a recent update ? If not then why did we get D3 entry during topology loading as above log.

  9. ranj063 commented on Nov 1, 2018

    @ranj063
    Collaborator

    @lgirdwood no this is not a recent change. Let me look into this today and I will comment on @plbossart 's pull request

  10. xiulipan commented on Nov 2, 2018

    @xiulipan

    @ranj063
    How about the resume process?
    We will reload the tplg after the DSP is resumed, which means that

    [ 5.445792] sof-audio sof-audio: error: failed to enter PM idle -11
    May not happen at the first boot.

    I believe this PR is good for the following resume tplg load.

  11. ranj063 commented on Nov 9, 2018

    @ranj063
    Collaborator

    #249 fixes this issue

  12. added a commit that references this issue on May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

APLApplies to ApolloLake platformP1Blocker bugs or important featuresbugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions