All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
	Mark Brown <broonie@kernel.org>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>,
	Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Subject: Re: [alsa-devel] [PATCH v3 06/19] ASoC: soc-core: add soc_unbind_dai_link()
Date: Mon, 11 Nov 2019 23:21:14 -0600	[thread overview]
Message-ID: <8ed58ca1-0f9d-63e8-ba5d-28ee5209aee5@linux.intel.com> (raw)
In-Reply-To: <877e4e3jni.wl-kuninori.morimoto.gx@renesas.com>



On 11/5/19 12:46 AM, Kuninori Morimoto wrote:
> 
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> It is easy to read code if it is cleanly using paired function/naming,
> like start <-> stop, register <-> unregister, etc, etc.
> But, current ALSA SoC code is very random, unbalance, not paired, etc.
> It is easy to create bug at the such code, and it will be difficult to
> debug.
> 
> ALSA SoC has soc_bind_dai_link(), but its paired soc_unbind_dai_link()
> is not implemented.
> More confusable is that soc_remove_pcm_runtimes() which should be
> soc_unbind_dai_link() is implemented without synchronised
> to soc_bind_dai_link().
> 
> This patch cleanup this unbalance.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

Morimoto-san, this patch seems to introduce a regression in our SOF 
module removal tests. Without a couple of load/unload modules cycles, we 
hit a kernel oops while freeing the card.

see https://github.com/thesofproject/linux/issues/1466 for some logs.

This issue did not happen with our November 6 rebase on Mark's tree, and 
showed up today. I couldn't really bisect the whole tree due to other 
issues, so manually applied your patches on top of this 11/06 tree and 
bisected from there.

I will need to confirm this finding (it's quite late for me) but looking 
at the code I wonder if the move of pcm_runtime deletion is correct?


> ---
> v2 -> v3
> 	- no change
> 	- add Reviewed-by
> 
>   sound/soc/soc-core.c | 22 ++++++++++++----------
>   1 file changed, 12 insertions(+), 10 deletions(-)
> 
> diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
> index e8ff6f2..1e8dd19 100644
> --- a/sound/soc/soc-core.c
> +++ b/sound/soc/soc-core.c
> @@ -470,14 +470,6 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime(
>   	return NULL;
>   }
>   
> -static void soc_remove_pcm_runtimes(struct snd_soc_card *card)
> -{
> -	struct snd_soc_pcm_runtime *rtd, *_rtd;
> -
> -	for_each_card_rtds_safe(card, rtd, _rtd)
> -		soc_free_pcm_runtime(rtd);
> -}
> -
>   struct snd_soc_pcm_runtime *snd_soc_get_pcm_runtime(struct snd_soc_card *card,
>   		const char *dai_link)
>   {
> @@ -1037,6 +1029,16 @@ static int soc_dai_link_sanity_check(struct snd_soc_card *card,
>   	return 0;
>   }
>   
> +static void soc_unbind_dai_link(struct snd_soc_card *card,
> +				struct snd_soc_dai_link *dai_link)
> +{
> +	struct snd_soc_pcm_runtime *rtd;
> +
> +	rtd = snd_soc_get_pcm_runtime(card, dai_link->name);
> +	if (rtd)
> +		soc_free_pcm_runtime(rtd);
> +}
> +
>   static int soc_bind_dai_link(struct snd_soc_card *card,
>   	struct snd_soc_dai_link *dai_link)
>   {
> @@ -1466,6 +1468,8 @@ void snd_soc_remove_dai_link(struct snd_soc_card *card,
>   		card->remove_dai_link(card, dai_link);
>   
>   	list_del(&dai_link->list);
> +
> +	soc_unbind_dai_link(card, dai_link);
>   }
>   EXPORT_SYMBOL_GPL(snd_soc_remove_dai_link);
>   
> @@ -1974,8 +1978,6 @@ static void soc_cleanup_card_resources(struct snd_soc_card *card)
>   	for_each_card_links_safe(card, link, _link)
>   		snd_soc_remove_dai_link(card, link);
>   
> -	soc_remove_pcm_runtimes(card);
> -
>   	/* remove auxiliary devices */
>   	soc_remove_aux_devices(card);
>   	soc_unbind_aux_dev(card);
> 
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  parent reply	other threads:[~2019-11-12  5:22 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-05  6:45 [alsa-devel] [PATCH v3 00/19] ASoC: soc-core cleanup - step 4 Kuninori Morimoto
2019-11-05  6:45 ` [alsa-devel] [PATCH v3 01/19] ASoC: soc-core: move soc_init_dai_link() Kuninori Morimoto
2019-11-05 23:51   ` [alsa-devel] Applied "ASoC: soc-core: move soc_init_dai_link()" to the asoc tree Mark Brown
2019-11-05  6:45 ` [alsa-devel] [PATCH v3 02/19] ASoC: soc-core: tidyup soc_init_dai_link() Kuninori Morimoto
2019-11-05 23:51   ` [alsa-devel] Applied "ASoC: soc-core: tidyup soc_init_dai_link()" to the asoc tree Mark Brown
2019-11-11 14:43   ` [PATCH v3 02/19] ASoC: soc-core: tidyup soc_init_dai_link() Jon Hunter
2019-11-11 14:43     ` [alsa-devel] " Jon Hunter
2019-11-12  0:24     ` Kuninori Morimoto
2019-11-12  0:24       ` [alsa-devel] " Kuninori Morimoto
2019-11-12 10:51       ` Jon Hunter
2019-11-12 10:51         ` [alsa-devel] " Jon Hunter
2019-11-13  0:29         ` Kuninori Morimoto
2019-11-13  0:29           ` [alsa-devel] " Kuninori Morimoto
2019-11-05  6:46 ` [alsa-devel] [PATCH v3 03/19] ASoC: soc-core: typo fix at soc_dai_link_sanity_check() Kuninori Morimoto
2019-11-05 23:51   ` [alsa-devel] Applied "ASoC: soc-core: typo fix at soc_dai_link_sanity_check()" to the asoc tree Mark Brown
2019-11-05  6:46 ` [alsa-devel] [PATCH v3 04/19] ASoC: soc-core: remove duplicated soc_is_dai_link_bound() Kuninori Morimoto
2019-11-05 23:51   ` [alsa-devel] Applied "ASoC: soc-core: remove duplicated soc_is_dai_link_bound()" to the asoc tree Mark Brown
2019-11-05  6:46 ` [alsa-devel] [PATCH v3 05/19] ASoC: soc-core: call soc_bind_dai_link() under snd_soc_add_dai_link() Kuninori Morimoto
2019-11-05 23:51   ` [alsa-devel] Applied "ASoC: soc-core: call soc_bind_dai_link() under snd_soc_add_dai_link()" to the asoc tree Mark Brown
2019-11-05  6:46 ` [alsa-devel] [PATCH v3 06/19] ASoC: soc-core: add soc_unbind_dai_link() Kuninori Morimoto
2019-11-05 23:51   ` [alsa-devel] Applied "ASoC: soc-core: add soc_unbind_dai_link()" to the asoc tree Mark Brown
2019-11-12  5:21   ` Pierre-Louis Bossart [this message]
2019-11-12  5:37     ` [alsa-devel] [PATCH v3 06/19] ASoC: soc-core: add soc_unbind_dai_link() Kuninori Morimoto
2019-11-12  5:50       ` Kuninori Morimoto
2019-11-12  6:42         ` Kuninori Morimoto
2019-11-12 17:11           ` Pierre-Louis Bossart
2019-11-12 19:03             ` Mark Brown
2019-11-12 21:08               ` Pierre-Louis Bossart
2019-11-13  4:37                 ` Kuninori Morimoto
2019-11-13  5:57                   ` Takashi Iwai
2019-11-13  6:33                     ` Kuninori Morimoto
2019-11-13 16:05                   ` Pierre-Louis Bossart
2019-11-14  0:18                     ` Kuninori Morimoto
2019-11-14  1:03                       ` Kuninori Morimoto
2019-11-16  0:19                         ` Pierre-Louis Bossart
2019-11-18  0:47                           ` Kuninori Morimoto
2019-11-18 15:14                             ` Pierre-Louis Bossart
2019-11-05  6:46 ` [alsa-devel] [PATCH v3 07/19] ASoC: soc-core: move snd_soc_lookup_component() Kuninori Morimoto
2019-11-05 23:51   ` [alsa-devel] Applied "ASoC: soc-core: move snd_soc_lookup_component()" to the asoc tree Mark Brown
2019-11-05  6:46 ` [alsa-devel] [PATCH v3 08/19] ASoC: soc-core: tidyup snd_soc_lookup_component() Kuninori Morimoto
2019-11-05 23:51   ` [alsa-devel] Applied "ASoC: soc-core: tidyup snd_soc_lookup_component()" to the asoc tree Mark Brown
2019-11-05  6:46 ` [alsa-devel] [PATCH v3 09/19] ASoC: soc-core: add snd_soc_del_component_unlocked() Kuninori Morimoto
2019-11-05 23:51   ` [alsa-devel] Applied "ASoC: soc-core: add snd_soc_del_component_unlocked()" to the asoc tree Mark Brown
2019-11-05  6:46 ` [alsa-devel] [PATCH v3 10/19] ASoC: soc-core: remove snd_soc_component_add/del() Kuninori Morimoto
2019-11-05 23:51   ` [alsa-devel] Applied "ASoC: soc-core: remove snd_soc_component_add/del()" to the asoc tree Mark Brown
2019-11-05  6:46 ` [alsa-devel] [PATCH v3 11/19] ASoC: soc-core: use snd_soc_lookup_component() at snd_soc_unregister_component() Kuninori Morimoto
2019-11-05 23:51   ` [alsa-devel] Applied "ASoC: soc-core: use snd_soc_lookup_component() at snd_soc_unregister_component()" to the asoc tree Mark Brown
2019-11-05  6:46 ` [alsa-devel] [PATCH v3 12/19] ASoC: soc-core: move snd_soc_register_dai() Kuninori Morimoto
2019-11-05 23:51   ` [alsa-devel] Applied "ASoC: soc-core: move snd_soc_register_dai()" to the asoc tree Mark Brown
2019-11-05  6:47 ` [alsa-devel] [PATCH v3 13/19] ASoC: soc-core: move snd_soc_unregister_dais() Kuninori Morimoto
2019-11-05 23:51   ` [alsa-devel] Applied "ASoC: soc-core: move snd_soc_unregister_dais()" to the asoc tree Mark Brown
2019-11-05  6:47 ` [alsa-devel] [PATCH v3 14/19] ASoC: soc-core: add snd_soc_unregister_dai() Kuninori Morimoto
2019-11-05 23:51   ` [alsa-devel] Applied "ASoC: soc-core: add snd_soc_unregister_dai()" to the asoc tree Mark Brown
2019-11-05  6:47 ` [alsa-devel] [PATCH v3 15/19] ASoC: soc-core: have legacy_dai_naming at snd_soc_register_dai() Kuninori Morimoto
2019-11-05 23:51   ` [alsa-devel] Applied "ASoC: soc-core: have legacy_dai_naming at snd_soc_register_dai()" to the asoc tree Mark Brown
2019-11-05  6:47 ` [alsa-devel] [PATCH v3 16/19] ASoC: soc-core: don't call snd_soc_dapm_new_dai_widgets() at snd_soc_register_dai() Kuninori Morimoto
2019-11-05 23:51   ` [alsa-devel] Applied "ASoC: soc-core: don't call snd_soc_dapm_new_dai_widgets() at snd_soc_register_dai()" to the asoc tree Mark Brown
2019-11-05  6:47 ` [alsa-devel] [PATCH v3 17/19] ASoC: soc-core: call snd_soc_register_dai() from snd_soc_register_dais() Kuninori Morimoto
2019-11-05 23:51   ` [alsa-devel] Applied "ASoC: soc-core: call snd_soc_register_dai() from snd_soc_register_dais()" to the asoc tree Mark Brown
2019-11-05  6:47 ` [alsa-devel] [PATCH v3 18/19] ASoC: soc-core: remove topology specific operation Kuninori Morimoto
2019-11-05 23:51   ` [alsa-devel] Applied "ASoC: soc-core: remove topology specific operation" to the asoc tree Mark Brown
2019-11-05  6:47 ` [alsa-devel] [PATCH v3 19/19] ASoC: soc.h: dobj is used only when SND_SOC_TOPOLOGY Kuninori Morimoto
2019-11-05 23:51   ` [alsa-devel] Applied "ASoC: soc.h: dobj is used only when SND_SOC_TOPOLOGY" to the asoc tree Mark Brown
2019-11-05 16:18 ` [alsa-devel] [PATCH v3 00/19] ASoC: soc-core cleanup - step 4 Ranjani Sridharan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8ed58ca1-0f9d-63e8-ba5d-28ee5209aee5@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=ranjani.sridharan@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.