Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Clemens Ladisch <clemens@ladisch.de>
Cc: Jaroslav Kysela <perex@suse.cz>,
	"alsa-devel@lists.sourceforge.net"
	<alsa-devel@lists.sourceforge.net>
Subject: Re: [PATCH] MPU-401 fixes
Date: Wed, 07 May 2003 11:03:32 +0200	[thread overview]
Message-ID: <s5hsmrrb02j.wl@alsa2.suse.de> (raw)
In-Reply-To: <Pine.HPX.4.33n.0305071010500.25787-100000@studcom.urz.uni-halle.de>

At Wed, 07 May 2003 10:31:46 +0200 (METDST),
Clemens Ladisch wrote:
> 
> Jaroslav Kysela wrote:
> > On Tue, 6 May 2003, Takashi Iwai wrote:
> > > > Ok, I'm now using the spin_trylock check in the trigger function and
> > > > RX_LOOP and TX_LOOP protectors are removed now. Hopefully, it finally
> > > > solves our problem.
> > >
> > > i'm afraid no.  as mentioned before, we need to consider to avoid two
> > > things:
> > >
> > > 1. (infinite) recursive call of trigger() (via input_read())
> > > 2. double spinlocks around input_read() from irq handler and
> > >    the suceeding call of trigger()
> > >
> > > introducing spin_trylock() solves the case #2 but not case #1,
> > > since spin_trylock() always returns 1 on UP.
> > > for #1, an extra (formerly RX_LOOP bit) flag is still necessary.
> >
> > I see. So the protectors are back in trigger() callbacks.
> 
> Now the recursive call sequence describe by Takashi is still possible:
> 
> >	irq
> >	-> snd_mpu401_uart_interrupt()
> >	-> lock
> >	-> snd_mpu401_uart_input_read()
> >		-> snd_rawmidi_receive()
> >			-> rawmidi->event()
> >				-> rawmidi->trigger() (in seq_midi.c)
> >					-> snd_mpu401_uart_input_trigger()
> 
> ... so the interrupt probably should set the bit, too. OTOH the recursion
> isn't infinite anymore, so the current code really doesn't need any more
> fixing.

yep, i agree that the flag should be set in the interrupt route, too.

i believe my last change (rev. 1.25) should work fine.
it sets the flag in input_read() (i.e. in spinlock).  instead of
spin_trylock() the bit is checked but it's safe because
- input_read is protected by spinlock between interrupt() and
  input_trigger()
- recursive call and double spinlocks of input_read() is avoided
  by checking the bit


ciao,

Takashi


-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com

      reply	other threads:[~2003-05-07  9:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-05  6:33 [PATCH] MPU-401 fixes Clemens Ladisch
2003-05-05 10:32 ` Jaroslav Kysela
2003-05-05 11:19   ` Clemens Ladisch
2003-05-05 14:15     ` Takashi Iwai
2003-05-05 15:51       ` Clemens Ladisch
2003-05-06 11:33         ` Takashi Iwai
2003-05-06 15:09         ` Jaroslav Kysela
2003-05-06 16:33           ` Takashi Iwai
2003-05-07  7:56             ` Jaroslav Kysela
2003-05-07  8:31               ` Clemens Ladisch
2003-05-07  9:03                 ` 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=s5hsmrrb02j.wl@alsa2.suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=clemens@ladisch.de \
    --cc=perex@suse.cz \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox