Commit dde1c652 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: pcm: Fix false lockdep warnings

As PCM core handles the multiple linked streams in parallel, lockdep
gets confused (partly because of weak annotations) and spews the
false-positive warnings.  This hasn't been a problem for long time but
the latest PCM lock path update seems to have woken up a sleeping
dog.

Here is an attempt to paper over this issue: pass the lock subclass
just calculated from the depth in snd_pcm_action_group().  Also, a
(possibly) wrong lock subclass set in snd_pcm_action_lock_mutex() is
dropped, too.
Reported-and-tested-by: default avatarArthur Marsh <arthur.marsh@internode.on.net>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent b1974f96
...@@ -781,16 +781,15 @@ static int snd_pcm_action_group(struct action_ops *ops, ...@@ -781,16 +781,15 @@ static int snd_pcm_action_group(struct action_ops *ops,
{ {
struct snd_pcm_substream *s = NULL; struct snd_pcm_substream *s = NULL;
struct snd_pcm_substream *s1; struct snd_pcm_substream *s1;
int res = 0; int res = 0, depth = 1;
snd_pcm_group_for_each_entry(s, substream) { snd_pcm_group_for_each_entry(s, substream) {
if (do_lock && s != substream) { if (do_lock && s != substream) {
if (s->pcm->nonatomic) if (s->pcm->nonatomic)
mutex_lock_nested(&s->self_group.mutex, mutex_lock_nested(&s->self_group.mutex, depth);
SINGLE_DEPTH_NESTING);
else else
spin_lock_nested(&s->self_group.lock, spin_lock_nested(&s->self_group.lock, depth);
SINGLE_DEPTH_NESTING); depth++;
} }
res = ops->pre_action(s, state); res = ops->pre_action(s, state);
if (res < 0) if (res < 0)
...@@ -906,8 +905,7 @@ static int snd_pcm_action_lock_mutex(struct action_ops *ops, ...@@ -906,8 +905,7 @@ static int snd_pcm_action_lock_mutex(struct action_ops *ops,
down_read(&snd_pcm_link_rwsem); down_read(&snd_pcm_link_rwsem);
if (snd_pcm_stream_linked(substream)) { if (snd_pcm_stream_linked(substream)) {
mutex_lock(&substream->group->mutex); mutex_lock(&substream->group->mutex);
mutex_lock_nested(&substream->self_group.mutex, mutex_lock(&substream->self_group.mutex);
SINGLE_DEPTH_NESTING);
res = snd_pcm_action_group(ops, substream, state, 1); res = snd_pcm_action_group(ops, substream, state, 1);
mutex_unlock(&substream->self_group.mutex); mutex_unlock(&substream->self_group.mutex);
mutex_unlock(&substream->group->mutex); mutex_unlock(&substream->group->mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment