Skip to content

More module unload fixes - #788

Merged
plbossart merged 4 commits into
thesofproject:topic/sof-devfrom
ranj063:module_unload2
Apr 5, 2019
Merged

plbossart merged 4 commits into
thesofproject:topic/sof-devfrom
ranj063:module_unload2

Conversation

@ranj063

@ranj063 ranj063 commented Apr 4, 2019

Copy link
Copy Markdown
Collaborator

No description provided.

@plbossart plbossart 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.

Some styles issues and one fundamental doubt on the unbind_card() changes.

Comment thread sound/soc/intel/skylake/skl-pcm.c Outdated

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.

remove line, run checkpatch.pl --strict!

Comment thread sound/soc/soc-core.c Outdated

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.

not sure if the comment adds any value.

Comment thread sound/soc/soc-core.c Outdated

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.

this patch is the one I am most scared of. I don't see a moral equivalent in snd_soc_bind_card that would add link components and don't know the internals of the ASoC code enough to judge if this is legit or not. Either you find a self-explanatory way of doing this or you have to run this by Mark Brown.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@plbossart let me submit a RFC patchset to the mailing list to get some feedback. What I did find was as far as I could tell none of the component drivers implement the remove() callback. So I doubt this will break anything. But I'll check with him anyway.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@plbossart that was easy. the most controversial one was the first one to be accepted. I'll clean up this PR based on Mark's feedback. I'll drop the first one and keep the rest.

@plbossart

Copy link
Copy Markdown
Member

@xiulipan this looks like an across-the-board CI fail. No activity in 1 hour?

@ranj063

ranj063 commented Apr 5, 2019

Copy link
Copy Markdown
Collaborator Author

I've submitted the first 3 patches upstream for comments and I will update the PR based on feedback.

ranj063 added 3 commits April 4, 2019 20:13
Topology is not unloaded in the core during unregister_component()
anymore. So, add the remove() callback that will unload the
topology.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
When the card is registered by the machine driver,
dai link components are probed after the snd_card is
created. This is done in snd_soc_bind_card() which calls
snd_soc_instantiate_card() to first create the snd_card
and then probes the link components by calling
soc_probe_link_components(). The snd_card is used by the
component driver to add the kcontrols associated
with dapm widgets to the card.

When the machine driver is unregistered, the snd_card
is freed when the card resources are cleaned up.
But the snd_card needs to be valid while unloading the
topology dapm widgets in order to remove the kcontrols
from the card.

Since, unloading topology is done when the component
driver is removed, the link components should be removed
in snd_soc_unbind_card(). This will ensure that the kcontrols
are removed before the card resources are cleaned up and
the snd_card itself is freed.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Topology should be removed when the link components are
removed when the machine driver is unregistered. This will
prevent the NULL pointer derefernce encountered when
removing widget kcontrol's from the sound card.

So, remove the topology in the remove() callback for the
SOF component driver.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Previously, we couldn't make the component driver
resource-managed because topology unloading was done by the
core when the component driver was unregistered. But this has
been fixed to allow topology removal during the component
driver remove() callback and there aren't any
NULL pointer dereferences anymore.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
@kv2019i

kv2019i commented Apr 5, 2019

Copy link
Copy Markdown
Collaborator

This looks clean and Mark seems to have applied the complex one already. Nice!

@plbossart plbossart 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.

Nicely done @ranj063. You must have set some sort of record to get a complicated patch upstream :-)

@plbossart
plbossart merged commit ab16eb9 into thesofproject:topic/sof-dev Apr 5, 2019
@ranj063
ranj063 deleted the module_unload2 branch April 5, 2019 22:48
@xiulipan

xiulipan commented Apr 6, 2019

Copy link
Copy Markdown

@plbossart
Since both travis and jenkins are strating the test on April 5 11:40 AM CST. If you see some delay about the CI task. I think maybe some network issue with the GitHub is happening.

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