From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S263664AbUFNRXm (ORCPT ); Mon, 14 Jun 2004 13:23:42 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S263614AbUFNRXm (ORCPT ); Mon, 14 Jun 2004 13:23:42 -0400 Received: from cantor.suse.de ([195.135.220.2]:62856 "EHLO Cantor.suse.de") by vger.kernel.org with ESMTP id S263685AbUFNRXH (ORCPT ); Mon, 14 Jun 2004 13:23:07 -0400 Date: Mon, 14 Jun 2004 19:20:11 +0200 Message-ID: From: Takashi Iwai To: Andrew Morton Cc: David Ford , linux-kernel@vger.kernel.org Subject: Re: sound driver (opti) spinlock bug, 2.6.7-rc3 In-Reply-To: <20040612171947.31218266.akpm@osdl.org> References: <40CB632B.2070706@blue-labs.org> <20040612171947.31218266.akpm@osdl.org> User-Agent: Wanderlust/2.10.1 (Watching The Wheels) SEMI/1.14.5 (Awara-Onsen) FLIM/1.14.5 (Demachiyanagi) APEL/10.6 MULE XEmacs/21.4 (patch 15) (Security Through Obscurity) (i386-suse-linux) MIME-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org At Sat, 12 Jun 2004 17:19:47 -0700, Andrew Morton wrote: > > David Ford wrote: > > > > sound/isa/opti9xx/opti92x-ad1848.c:428: > > spin_lock(sound/isa/opti9xx/opti92x-ad1848.c:cf40eea0) already locked by > > sound/isa/opti9xx/opti92x-ad1848.c/604 > > Like this? > > The locking in there seems fairly optimistic - looks like someone did a > cli() translation on it. Oh my. Apparently this driver has been never used/tested on SMP/preempt practically since long ago. I checked the code quickly now, and it Looks like it has other deadlocks. Could you try the patch below? Takashi --- linux/sound/isa/opti9xx/opti92x-ad1848.c 23 Apr 2004 15:01:17 -0000 1.40 +++ linux/sound/isa/opti9xx/opti92x-ad1848.c 14 Jun 2004 17:18:09 -0000 @@ -474,7 +474,6 @@ static int __devinit snd_opti9xx_configu unsigned char dma_bits; unsigned char mpu_port_bits = 0; unsigned char mpu_irq_bits; - unsigned long flags; switch (chip->hardware) { #ifndef OPTi93X @@ -601,13 +600,11 @@ __skip_base: dma_bits |= 0x04; #endif /* CS4231 || OPTi93X */ - spin_lock_irqsave(&chip->lock, flags); #ifndef OPTi93X outb(irq_bits << 3 | dma_bits, chip->wss_base); #else /* OPTi93X */ snd_opti9xx_write(chip, OPTi9XX_MC_REG(3), (irq_bits << 3 | dma_bits)); #endif /* OPTi93X */ - spin_unlock_irqrestore(&chip->lock, flags); __skip_resources: if (chip->hardware > OPTi9XX_HW_82C928) { @@ -767,15 +764,10 @@ static void snd_opti93x_mce_down(opti93x static void snd_opti93x_mute(opti93x_t *chip, int mute) { - unsigned long flags; - - spin_lock_irqsave(&chip->lock, flags); - mute = mute ? 1 : 0; - if (chip->mute == mute) { - spin_unlock_irqrestore(&chip->lock, flags); + if (chip->mute == mute) return; - } + chip->mute = mute; snd_opti93x_mute_reg(chip, OPTi93X_CD_LEFT_INPUT, mute); @@ -800,8 +792,6 @@ static void snd_opti93x_mute(opti93x_t * snd_opti93x_mute_reg(chip, OPTi93X_MIC_RIGHT_INPUT, mute); snd_opti93x_mute_reg(chip, OPTi93X_OUT_LEFT, mute); snd_opti93x_mute_reg(chip, OPTi93X_OUT_RIGHT, mute); - - spin_unlock_irqrestore(&chip->lock, flags); } @@ -873,10 +863,8 @@ static unsigned char snd_opti93x_get_for static void snd_opti93x_playback_format(opti93x_t *chip, unsigned char fmt) { - unsigned long flags; unsigned char mask; - spin_lock_irqsave(&chip->lock, flags); snd_opti93x_mute(chip, 1); snd_opti93x_mce_up(chip); @@ -885,14 +873,10 @@ static void snd_opti93x_playback_format( snd_opti93x_mce_down(chip); snd_opti93x_mute(chip, 0); - spin_unlock_irqrestore(&chip->lock, flags); } static void snd_opti93x_capture_format(opti93x_t *chip, unsigned char fmt) { - unsigned long flags; - - spin_lock_irqsave(&chip->lock, flags); snd_opti93x_mute(chip, 1); snd_opti93x_mce_up(chip); @@ -904,7 +888,6 @@ static void snd_opti93x_capture_format(o snd_opti93x_mce_down(chip); snd_opti93x_mute(chip, 0); - spin_unlock_irqrestore(&chip->lock, flags); }