From patchwork Tue Oct 14 03:26:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Marsh X-Patchwork-Id: 5077761 X-Patchwork-Delegate: tiwai@suse.de Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A2D0A9F30B for ; Tue, 14 Oct 2014 03:27:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B9B9C20154 for ; Tue, 14 Oct 2014 03:27:13 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 7A5E72012D for ; Tue, 14 Oct 2014 03:27:12 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 90950260461; Tue, 14 Oct 2014 05:27:05 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 3A41C260428; Tue, 14 Oct 2014 05:26:55 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 557ED260435; Tue, 14 Oct 2014 05:26:53 +0200 (CEST) Received: from ipmail05.adl6.internode.on.net (ipmail05.adl6.internode.on.net [150.101.137.143]) by alsa0.perex.cz (Postfix) with ESMTP id 2E9DF26041C for ; Tue, 14 Oct 2014 05:26:43 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmUGACWXPFQOAiO//2dsb2JhbABSCYMOU1jLdodMCQKBGBcBfYQDAQEDAScRHiIBBQsIAw4TFg8JAwIBAgEnHgYNAQUCAogyB8VZAQEBAQYBAQEBHo9jBwoBUAeESwEEj1+DIYM7iD48gwqIGYUGg36ECiovgQ+BOwEBAQ Received: from ppp14-2-35-191.lns21.adl2.internode.on.net (HELO localhost) ([14.2.35.191]) by ipmail05.adl6.internode.on.net with ESMTP; 14 Oct 2014 13:56:39 +1030 Received: from localhost ([127.0.0.1] ident=amarsh04) by localhost with esmtp (Exim 4.84) (envelope-from ) id 1Xdskv-0007l8-4Z; Tue, 14 Oct 2014 13:56:37 +1030 Message-ID: <543C97EC.4040000@internode.on.net> Date: Tue, 14 Oct 2014 13:56:36 +1030 From: Arthur Marsh User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Icedove/24.8.1 MIME-Version: 1.0 To: Takashi Iwai References: <543B2438.1050002@internode.on.net> <543BB942.5060602@internode.on.net> <543BCDE9.7010308@internode.on.net> <543C153A.4060607@internode.on.net> In-Reply-To: Cc: alsa-devel@alsa-project.org Subject: Re: [alsa-devel] lock-up when loading desktop X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Takashi Iwai wrote, on 14/10/14 07:27: >> # git reset --hard HEAD~ >> HEAD is now at 77c688a Merge branch 'for-linus' of >> git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs >> am64:/usr/src/linux# git revert 7af142f752116e86adbe2073f2922d8265a77709 >> [master 927ab0d] Revert "ALSA: pcm: Uninline snd_pcm_stream_lock() and >> _unlock()" >> Committer: root >> Your name and email address were configured automatically based >> on your username and hostname. Please check that they are accurate. >> You can suppress this message by setting them explicitly: >> >> git config --global user.name "Your Name" >> git config --global user.email you@example.com >> >> After doing this, you may fix the identity used for this commit with: >> >> git commit --amend --reset-author >> >> 2 files changed, 73 insertions(+), 72 deletions(-) >> am64:/usr/src/linux# git revert 257f8cce5d40b811d229ed71602882baa0012808 >> [master e59721c] Revert "ALSA: pcm: Allow nonatomic trigger operations" >> Committer: root >> Your name and email address were configured automatically based >> on your username and hostname. Please check that they are accurate. >> You can suppress this message by setting them explicitly: >> >> git config --global user.name "Your Name" >> git config --global user.email you@example.com >> >> After doing this, you may fix the identity used for this commit with: >> >> git commit --amend --reset-author >> >> 3 files changed, 19 insertions(+), 116 deletions(-) >> am64:/usr/src/linux# git diff v3.17.. sound/core/pcm_native.c >> am64:/usr/src/linux# git reset --hard HEAD~ >> HEAD is now at 927ab0d Revert "ALSA: pcm: Uninline snd_pcm_stream_lock() >> and _unlock()" >> am64:/usr/src/linux# git reset --hard v3.17 >> Checking out files: 100% (6352/6352), done. >> HEAD is now at bfe01a5 Linux 3.17 >> am64:/usr/src/linux# git checkout -b sound-test >> Switched to a new branch 'sound-test' >> am64:/usr/src/linux# git merge fd1a2a90d08b0052fa52bd36cebd0592c9e537c2 >> Updating bfe01a5..fd1a2a9 >> Fast-forward >> [big list of files] >> >> /usr/src/linux# patch -p1 <../sound.patch >> patching file sound/core/pcm_native.c > > Wait... which patch is this? This one: --- goto __error1; > Could you test without this (but with > the patch below)? OK. > I looked at the relevant code now, and this indeed seems like a > deadlock. But it's nothing new, the code is a decade old. I wonder > why it appears out of sudden. Maybe the change of the spin lock path > triggers. > > The patch below is the fix, just removing the superfluous spinlock. > >> I can supply a dmesg output of the machine with the test kernel before >> attempting anything that might cause a lock-up if it's of use to you. >> >> PS, how do I get my git repositary out of "sound-test" branch and return >> to Linus' git head? > > Just do "git checkout master" Thanks! > > > Takashi > > --- > diff --git a/sound/pci/emu10k1/emu10k1_callback.c b/sound/pci/emu10k1/emu10k1_callback.c > index 3f3ef38d9b6e..874cd76c7b7f 100644 > --- a/sound/pci/emu10k1/emu10k1_callback.c > +++ b/sound/pci/emu10k1/emu10k1_callback.c > @@ -85,6 +85,8 @@ snd_emu10k1_ops_setup(struct snd_emux *emux) > * get more voice for pcm > * > * terminate most inactive voice and give it as a pcm voice. > + * > + * voice_lock is already held. > */ > int > snd_emu10k1_synth_get_voice(struct snd_emu10k1 *hw) > @@ -92,12 +94,10 @@ snd_emu10k1_synth_get_voice(struct snd_emu10k1 *hw) > struct snd_emux *emu; > struct snd_emux_voice *vp; > struct best_voice best[V_END]; > - unsigned long flags; > int i; > > emu = hw->synth; > > - spin_lock_irqsave(&emu->voice_lock, flags); > lookup_voices(emu, hw, best, 1); /* no OFF voices */ > for (i = 0; i < V_END; i++) { > if (best[i].voice >= 0) { > @@ -113,11 +113,9 @@ snd_emu10k1_synth_get_voice(struct snd_emu10k1 *hw) > vp->emu->num_voices--; > vp->ch = -1; > vp->state = SNDRV_EMUX_ST_OFF; > - spin_unlock_irqrestore(&emu->voice_lock, flags); > return ch; > } > } > - spin_unlock_irqrestore(&emu->voice_lock, flags); > > /* not found */ > return -ENOMEM; > I'll apply the above patch only first and report the results. Thanks again, Arthur. diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 85fe1a216225..9c7cbd1b839e 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -2275,6 +2275,9 @@ static int snd_pcm_open(struct file *file, struct snd_pcm *pcm, int stream) int err; wait_queue_t wait; + if (WARN_ON(pcm->nonatomic)) + return -EINVAL; + if (pcm == NULL) { err = -ENODEV;