From: Takashi Iwai Subject: Re: [PATCH] MPU401 lockups Date: Mon, 25 Jun 2007 12:23:30 +0200 Message-ID: References: <200706251344.50051.mypal_hh@utl.ru> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 0AB2F243BE for ; Mon, 25 Jun 2007 12:23:39 +0200 (CEST) In-Reply-To: <200706251344.50051.mypal_hh@utl.ru> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Serge Nikolaenko Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org At Mon, 25 Jun 2007 13:44:49 +1100, Serge Nikolaenko wrote: > > [1 ] > Hello, > > The attachement is the fix for mpu to prevent lockups/freezes. Added mutexes > with down_trylock() calls, to prevent blocking. Using mutex in the irq handler is scary (even though you're using trylock). What about simply using spin_lock_irqsave() instead of spin_lock() in _snd_mpu401_uart_interrupt() (maybe in uart_interrupt_tx(), too) ? Takashi > Midi in/out not tested - I don't have no midi devices at the moment. > > My soundcard is ESI Juli@. MB integrated midi is disabled in bios. > > Last system messages after system freeze when running wine/jackd: > > kernel: cmd: 0xff failed at 0xac0c (status = 0xb, data = 0x0) > ... > kernel: BUG: soft lockup detected on CPU#0! > kernel: > kernel: Call Trace: > kernel: [] softlockup_tick+0xdb/0xf6 > kernel: [] update_process_times+0x42/0x68 > kernel: [] smp_local_timer_interrupt+0x34/0x55 > kernel: [] smp_apic_timer_interrupt+0x51/0x69 > kernel: [] apic_timer_interrupt+0x66/0x70 > kernel: [] :snd_mpu401_uart:mpu401_read_port+0x4/0x8 > kernel: > [] :snd_mpu401_uart:_snd_mpu401_uart_interrupt+0x4c/0x70 > kernel: > [] :snd_mpu401_uart:snd_mpu401_uart_interrupt+0x13/0x1a > kernel: [] :snd_ice1724:snd_vt1724_interrupt+0x4e/0x13a > kernel: [] handle_IRQ_event+0x25/0x53 > kernel: [] handle_fasteoi_irq+0x92/0xd1 > kernel: [] do_IRQ+0xff/0x16d > kernel: [] ret_from_intr+0x0/0xa > kernel: [] proc_info_read+0x0/0xb9 > kernel: [] proc_info_read+0x2/0xb9 > kernel: [] vfs_read+0xcb/0x173 > kernel: [] sys_read+0x45/0x6e > kernel: [] system_call+0x7e/0x83 > [2 mpu401_mutex.diff ] > diff -urN a/sound/drivers/mpu401/mpu401_uart.c b/sound/drivers/mpu401/mpu401_uart.c > --- a/sound/drivers/mpu401/mpu401_uart.c 2006-12-06 01:58:01.000000000 +1000 > +++ b/sound/drivers/mpu401/mpu401_uart.c 2007-06-22 18:21:57.000000000 +1100 > @@ -46,6 +46,9 @@ > static void snd_mpu401_uart_input_read(struct snd_mpu401 * mpu); > static void snd_mpu401_uart_output_write(struct snd_mpu401 * mpu); > > +DECLARE_MUTEX(mpu_tx_mutex); > +DECLARE_MUTEX(mpu_interrupt_mutex); > + > /* > > */ > @@ -103,6 +106,8 @@ > snd_mpu401_uart_output_write(mpu); > spin_unlock(&mpu->output_lock); > } > + > + up(&mpu_tx_mutex); > } > > static void _snd_mpu401_uart_interrupt(struct snd_mpu401 *mpu) > @@ -116,9 +121,16 @@ > spin_unlock(&mpu->input_lock); > } > if (! (mpu->info_flags & MPU401_INFO_TX_IRQ)) > + { > /* ok. for better Tx performance try do some output > when input is done */ > + if (!down_trylock(&mpu_tx_mutex)) > + { > uart_interrupt_tx(mpu); > + } > + } > + > + up(&mpu_interrupt_mutex); > } > > /** > @@ -134,7 +146,10 @@ > > if (mpu == NULL) > return IRQ_NONE; > - _snd_mpu401_uart_interrupt(mpu); > + if (!down_trylock(&mpu_interrupt_mutex)) > + { > + _snd_mpu401_uart_interrupt(mpu); > + } > return IRQ_HANDLED; > } > > @@ -153,7 +168,10 @@ > > if (mpu == NULL) > return IRQ_NONE; > - uart_interrupt_tx(mpu); > + if (!down_trylock(&mpu_tx_mutex)) > + { > + uart_interrupt_tx(mpu); > + } > return IRQ_HANDLED; > } > > [3 ] > _______________________________________________ > Alsa-devel mailing list > Alsa-devel@alsa-project.org > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel