From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751969AbbAOGOI (ORCPT ); Thu, 15 Jan 2015 01:14:08 -0500 Received: from cantor2.suse.de ([195.135.220.15]:44181 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751433AbbAOGOF (ORCPT ); Thu, 15 Jan 2015 01:14:05 -0500 Date: Thu, 15 Jan 2015 07:14:02 +0100 Message-ID: From: Takashi Iwai To: jiwang Cc: Fabio Estevam , Lars-Peter Clausen , Mark Brown , "alsa-devel@alsa-project.org" , "Frkuska, Joshua" , "linux-kernel@vger.kernel.org" , "lgirdwood@gmail.com" Subject: Re: [alsa-devel] unload Audio drivers while playback stream is active case kernel crash In-Reply-To: <54B744D1.3040809@mentor.com> References: <857E9EDCA6C0904DB3357321AA9123EB0108B66919@NA-MBX-01.mgc.mentorg.com> <20150113215412.GS4160@sirena.org.uk> <54B625A8.8090406@metafoo.de> <54B63E4F.2010506@metafoo.de> <20150114120228.GT4160@sirena.org.uk> <54B6679F.1030706@metafoo.de> <54B744D1.3040809@mentor.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.4 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At Thu, 15 Jan 2015 13:40:49 +0900, jiwang wrote: > > Hi > On 01/14/2015 10:43 PM, Fabio Estevam wrote: > > On Wed, Jan 14, 2015 at 10:57 AM, Lars-Peter Clausen wrote: > > > >> My personal opinion on this is that disallowing module removal while a > >> driver registered by the module when is in use, while there is no technical > >> reason to do so, is a anti-feature. Whether in ALSA or elsewhere. > >> > >> But looking at the source it seems that this is a core feature of ALSA and > >> at least for the card module itself it will do the ref-counting when a > >> stream is started/stopped. And we even support setting the owner of a card > >> in ASoC. It's just that pretty much no ASoC card driver bothers to set the > >> owner field in the snd_soc_card struct. So this particular problem can be > >> fixed by updating the imx-wm8962 driver to set the owner field. > > Thanks, Lars_Peter. This fixes the issue: > > > > root@freescale /$ modprobe -r snd_soc_imx_wm8962 > > modprobe: can't unload module snd_soc_imx_wm8962: Resource temporarily > > unavailable > > > > Will send a patch with your suggestion soon. > I think by set owner field in imx_wm8962 machine driver can fix the > crash I saw on sabreSD board, > but as this is a generic issue which I suppose should exist on other > boards with different > machine drivers. > > Can we have a more generic fix to this issue? > Or shall we set owner field for all machine drivers? This is two folds. The lack of card's owner field is a bug of each driver. Another is the missing of a hotplug-safe cleanup in ASoC core. Takashi