[alsa-devel] Question about struct snd_soc_dai() :: cpu_dai->codec

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Wed Jul 27 08:36:17 CEST 2016


Hi Takashi-san

Thank you for your help

> > > My current headache is ALSA SoC's each modules (= Card/Codec/CPU/Platform)
> > > doesn't care about "unbind/rmmod".
> > > For example, if someone unbinded/rmmoded "Codec", Card or other modules
> > > doesn't know about it. Thus, user can continue to use this sound card,
> > > and kernel will be Oops.
> > 
> > Are you sure about this? Have you tried removing a module?
> > 
> > During card probe, asoc will hold a reference to the component. See the
> > calls to try_module_get(). This will prevent from unloading under normal
> > cases.
> 
> For unloading the module, yes, it should have been prevented by
> managing the module refcount.  However, unbinding can't be stopped by
> that.  It's a known problem.
> 
> Morimoto-san, do you see the issue really via module unloading, or is
> it only via unbinding?

I tried, I thought this issue was for both unload/unbind, but it was only for unbinding.
is this correct ?

	# insmod cpu driver

	> insmod home/snd-soc-rcar.ko 
	[   94.853449] asoc-simple-graph-dpcm-card asoc-simple-graph-dpcm-card.0.auto: snd-soc-dummy-dai <-> rsnd-dai.0 mapping ok
	[   94.864466] asoc-simple-graph-dpcm-card asoc-simple-graph-dpcm-card.0.auto: snd-soc-dummy-dai <-> rsnd-dai.1 mapping ok
	[   94.876047] asoc-simple-graph-dpcm-card asoc-simple-graph-dpcm-card.0.auto: ak4642-hifi <-> snd-soc-dummy-dai mapping ok
	[   94.888157] rcar_sound ec500000.sound: probed

	# check it

	> lsmod
	Module                  Size  Used by    Not tainted
	snd_soc_rcar           47695  2 
	...

	# try rmmod

	> rmmod snd_soc_rcar
	rmmod: can't unload 'snd_soc_rcar': Resource temporarily unavailable

	# try playback, it still working

	> aplay xxxx.wav

	# try unbind

	> echo ec500000.sound > /sys/devices/platform/ec500000.sound/driver/unbind 

	# sound card will die

	> aplay xxxx.wav 
	[  230.236466] Unable to handle kernel NULL pointer dereference at virtual address 00000014
	[  230.244580] pgd = eea60000
	[  230.247320] [00000014] *pgd=6e9a3835, *pte=00000000, *ppte=00000000
	[  230.253628] Internal error: Oops: 17 [#1] SMP ARM
	[  230.258335] Modules linked in: snd_soc_rcar regmap_mmio
	...
	[  230.607462] 1fe0: 00000005 bed645b0 b6e2745d b6e28b86 60000030 bed64600 0645484d 82551041
	[  230.615643] Backtrace: 
	[  230.618105] [<c02eab58>] (pinctrl_select_state) from [<c02ead14>] (pinctrl_pm_select_state+0x28/0x58)
	[  230.627330]  r9:ee814f00 r8:ee8b8b98 r7:00000000 r6:ee927900 r5:ef2ba410 r4:ee8c9000
	[  230.635131] [<c02eacec>] (pinctrl_pm_select_state) from [<c02ead64>] (pinctrl_pm_select_default_state+0x20/0x2c)
	[  230.645311]  r7:00000000 r6:ee88b200 r5:ef378800 r4:ee8c9000
	[  230.651016] [<c02ead44>] (pinctrl_pm_select_default_state) from [<c040ab90>] (soc_pcm_open+0x34/0x798)
	[  230.660331] [<c040ab5c>] (soc_pcm_open) from [<c040c0e4>] (dpcm_fe_dai_open+0xbc/0x524)
	[  230.668340]  r10:ee8c9000 r9:ee8b8bb0 r8:ee8b8b98 r7:00000280 r6:ee8c9000 r5:00000001
	[  230.676222]  r4:ef378800
	...


More information about the Alsa-devel mailing list