All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: 강신형 <s47.kang@samsung.com>
Cc: <kuninori.morimoto.gx@renesas.com>, <alsa-devel@alsa-project.org>,
	<lgirdwood@gmail.com>, <pierre-louis.bossart@linux.intel.com>,
	<broonie@kernel.org>, <cpgs@samsung.com>,
	<pilsun.jang@samsung.com>, <seungbin.lee@samsung.com>,
	<donghee.moon@samsung.com>
Subject: Re: [PATCH] ALSA: core: Replace mutex_lock with mutex_trylock
Date: Thu, 09 Nov 2023 15:16:41 +0100	[thread overview]
Message-ID: <87o7g3roza.wl-tiwai@suse.de> (raw)
In-Reply-To: <87edh0ctc5.wl-tiwai@suse.de>

On Wed, 08 Nov 2023 13:39:22 +0100,
Takashi Iwai wrote:
> 
> On Wed, 08 Nov 2023 13:14:15 +0100,
> 강신형 wrote:
> > 
> > > Thanks for the patch.  But this change may break the current working
> > > behavior; e.g. when two proc reads are running concurrently, one would
> > > be aborted unexpectedly.
> > > 
> > > IIUC, the problem is the call of proc_remove(), and this call itself
> > > can be outside the global mutex.
> > > 
> > > Could you check whether the patch below works instead?  (Note that
> > > it's only compile-tested.)  It makes the proc_remove() called at
> > > first, then clearing the internal entries.  The function was renamed
> > > accordingly for avoiding confusion, too.
> > > 
> > > 
> > > Takashi
> > 
> > You are right. My patch is just for avoiding the deadlock. 
> > It may lead to other problem instead the deadlock(e.g. USB sound card
> > registration failure)
> > Your patch works well without any problems.
> > But I can't confirm that the problem is solved or not.
> > because the issue has occurred only once until now.
> > (Test method: USB insertion / removal during a call)
> 
> Maybe you can reproduce it more easily by adding some delay
> (e.g. ssleep(2)) before mutex_lock() in snd_info_entry_open().

... in our case, it's rather snd_info_text_entry_open().

> Then it's easier to cause a race.

I could actually reproduce the bug with the extra delay, and confirmed
that my patch works around it.
I'm going to submit a proper patch.


Takashi

      reply	other threads:[~2023-11-09 14:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20231107081810epcas2p27a897426580fce6f0884cffb256b2aaf@epcas2p2.samsung.com>
2023-11-07  8:17 ` [PATCH] ALSA: core: Replace mutex_lock with mutex_trylock 강신형
2023-11-07 14:08   ` Takashi Iwai
2023-11-08 12:14     ` 강신형
2023-11-08 12:39       ` Takashi Iwai
2023-11-09 14:16         ` Takashi Iwai [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o7g3roza.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=cpgs@samsung.com \
    --cc=donghee.moon@samsung.com \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=lgirdwood@gmail.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=pilsun.jang@samsung.com \
    --cc=s47.kang@samsung.com \
    --cc=seungbin.lee@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.