[alsa-devel] some lock needed for flush_delayed_work ?
Hi ALSA ML
I got below error when I unbind/bind CPU DAI. It seems we need to have some kind of lock ? I think => message came from
linux/kernel/locking/lockdep.c :: assign_lock_key
... [ 6.392640] asoc-audio-graph-card sound: ASoC: CPU DAI not registered => [ 6.399430] INFO: trying to register non-static key. => [ 6.404393] the code is fine but needs lockdep annotation. => [ 6.409875] turning off the locking correctness validator. [ 6.415362] CPU: 2 PID: 193 Comm: test-bind-unbin Not tainted 5.3.0-rc1+ #625 [ 6.422495] Hardware name: Renesas H3ULCB Kingfisher board based on r8a7795 ES2.0+ (DT) [ 6.430497] Call trace: [ 6.432949] dump_backtrace+0x0/0x140 [ 6.436609] show_stack+0x24/0x30 [ 6.439927] dump_stack+0xc4/0x10c [ 6.443328] register_lock_class+0x4e0/0x618 [ 6.447594] __lock_acquire+0x7c/0x1de8 [ 6.451426] lock_acquire+0xdc/0x1e0 [ 6.455000] del_timer_sync+0x60/0xe8 [ 6.458660] flush_delayed_work+0x2c/0x70 [ 6.462671] soc_cleanup_card_resources+0x50/0x348 [ 6.467459] snd_soc_bind_card+0x1e4/0x990 [ 6.471551] snd_soc_add_component+0x248/0x310 [ 6.475992] snd_soc_register_component+0x54/0x70 [ 6.480696] devm_snd_soc_register_component+0x60/0xb8 [ 6.485833] rsnd_probe+0x164/0x448 [ 6.489321] platform_drv_probe+0x58/0xa8 [ 6.493330] really_probe+0xec/0x2a0 [ 6.496902] driver_probe_device+0x5c/0xf0 [ 6.500996] device_driver_attach+0x74/0x80 [ 6.505177] bind_store+0xdc/0x120 [ 6.508575] drv_attr_store+0x40/0x58 [ 6.512237] sysfs_kf_write+0x50/0x78 [ 6.515896] kernfs_fop_write+0xf0/0x1e8 [ 6.519819] __vfs_write+0x48/0x90 [ 6.523218] vfs_write+0xac/0x1b8 [ 6.526529] ksys_write+0x74/0xf8 [ 6.529840] __arm64_sys_write+0x24/0x30 [ 6.533762] el0_svc_common.constprop.0+0x98/0x170 [ 6.538550] el0_svc_compat_handler+0x2c/0x38 [ 6.542904] el0_svc_compat+0x8/0x10
Thank you for your help !! Best regards --- Kuninori Morimoto
On Tue, 03 Sep 2019 10:00:22 +0200, Kuninori Morimoto wrote:
Hi ALSA ML
I got below error when I unbind/bind CPU DAI. It seems we need to have some kind of lock ?
No, this kind of error usually is due to the missing initialization of the lock object. In this case, the work hasn't been initialized before calling the flush_delayed_work().
I suppose it's an error path at snd_soc_bind_card(), and the patch like below might fix the issue.
Takashi
--- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -371,6 +371,7 @@ struct snd_pcm_substream *snd_soc_get_dai_substream(struct snd_soc_card *card, EXPORT_SYMBOL_GPL(snd_soc_get_dai_substream);
static const struct snd_soc_ops null_snd_soc_ops; +static void codec2codec_close_delayed_work(struct work_struct *work);
static struct snd_soc_pcm_runtime *soc_new_pcm_runtime( struct snd_soc_card *card, struct snd_soc_dai_link *dai_link) @@ -382,6 +383,7 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime( return NULL;
INIT_LIST_HEAD(&rtd->component_list); + INIT_DELAYED_WORK(&rtd->delayed_work, codec2codec_close_delayed_work); rtd->card = card; rtd->dai_link = dai_link; if (!rtd->dai_link->ops) @@ -1573,9 +1575,6 @@ static int soc_probe_link_dais(struct snd_soc_card *card, rtd->num_codecs, rtd); if (ret < 0) return ret; - } else { - INIT_DELAYED_WORK(&rtd->delayed_work, - codec2codec_close_delayed_work); }
return 0;
Hi Takashi
Thank you for your feedback
I got below error when I unbind/bind CPU DAI. It seems we need to have some kind of lock ?
No, this kind of error usually is due to the missing initialization of the lock object. In this case, the work hasn't been initialized before calling the flush_delayed_work().
I suppose it's an error path at snd_soc_bind_card(), and the patch like below might fix the issue.
I double checked this issue. It seems below 2 things happend in the same time. Thank you. Your feedback/hint helped it. Good things is that there is no issue at upstream code.
1) latest ASoC branch had delayed_work update 2) my local patch didn't care about it
Thank you for your help !! Best regards --- Kuninori Morimoto
participants (2)
-
Kuninori Morimoto
-
Takashi Iwai