From: Kuninori Morimoto Subject: Re: [PATCH] ASoC: soc-core: call snd_soc_unbind_card() under mutex_lock; Date: 11 Jun 2019 09:27:45 +0900 Message-ID: <87o9355b95.wl-kuninori.morimoto.gx@renesas.com> References: <87imtev0l2.wl-kuninori.morimoto.gx@renesas.com> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa1.perex.cz (Postfix) with ESMTP id 7A118F8070E for ; Tue, 11 Jun 2019 02:27:49 +0200 (CEST) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" To: Ranjani Sridharan Cc: Linux-ALSA , Mark Brown List-Id: alsa-devel@alsa-project.org Hi Ranjani Thank you for your feedback > Thanks, Morimoto-san. I submitted a solution to fix the deadlock just a > couple of days ago as well ( > https://mailman.alsa-project.org/pipermail/alsa-devel/2019-June/150764.html > ). > > I am fine with either solution though. Hmm... If my understanding was correct, mutex_lock under snd_soc_unbind_card() is not good / not enough. My patch can solve these, but please double check it. # To be honest, current ALSA SoC is very difficult to read. # Thus, I'm working to cleanup code, actually. I want to post it. # I'm waiting for posted patches to be applied 1) snd_soc_unbind_card() is used from snd_soc_component_del_unlocked() which is used from __snd_soc_unregister_component(). It is using mutex_lock() already __snd_soc_unregister_component() => mutex_lock() snd_soc_component_del_unlocked() snd_soc_unbind_card() => mutex_lock() soc_remove_link_components() => mutex_unlock() (*2) soc_cleanup_card_resources() => mutex_unlock() (2) soc_cleanup_card_resources() also calls soc_remove_link_components() (see above (*2)) soc_cleanup_card_resources() soc_remove_dai_links() => soc_remove_link_components()