From: Takashi Iwai <tiwai@suse.de>
To: Jaroslav Kysela <perex@suse.cz>
Cc: Clemens Ladisch <clemens@ladisch.de>,
"alsa-devel@lists.sourceforge.net"
<alsa-devel@lists.sourceforge.net>
Subject: Re: trying out usb hotplugs
Date: Fri, 29 Nov 2002 12:42:37 +0100 [thread overview]
Message-ID: <s5h4ra0a9g2.wl@alsa2.suse.de> (raw)
In-Reply-To: <Pine.LNX.4.33.0211291150340.532-100000@pnote.perex-int.cz>
At Fri, 29 Nov 2002 12:24:50 +0100 (CET),
Jaroslav wrote:
>
> On Fri, 29 Nov 2002, Takashi Iwai wrote:
>
> > At Fri, 29 Nov 2002 10:39:22 +0100 (CET),
> > Jaroslav wrote:
> > >
> > > On Fri, 29 Nov 2002, Takashi Iwai wrote:
> > >
> > > > At Fri, 29 Nov 2002 08:52:43 +0100 (MET),
> > > > Clemens Ladisch wrote:
> > > > >
> > > > > Takashi Iwai wrote:
> > > > > > Martin Langer wrote:
> > > > > > > usb hotplug works perfect if my usbmidi client isn't aconnected to another
> > > > > > > midi client. But the aconnected usb midi device still remains in the clients
> > > > > > > list, after hotpluging out.
> > > > > >
> > > > > > yep, when the connection exists, the connected devices (on both
> > > > > > sides) are regarded as active.
> > > > >
> > > > > The sequencer design allows asynchronous removal of clients.
> > > >
> > > > yes, but this may still try to send some bytes to the unplugged
> > > > rawmidi device at the disconnection. i'll change rawmidi code to
> > > > ignore that.
> > >
> > > Well, I'm trying to solve these "hotplug" problems. Unfortunately, it
> > > seems difficult to detect, if another task is in the middle of our
> > > callback. I think that we'll end up using mutexes.
> >
> > hmm, but mutex costs too much even for non-pluggable devices...
> >
> > in the case of rawmidi and oss-mixer, we can put "disconnected" flag
> > and ignore the access if the flag is on at the rawmidi and oss-mixer
> > routines, so that the control doesn't reach to low-level functions.
>
> Well, but if you check this flag at the beginning, then you don't know, if
> hardware is away in the middle of operation. The point is, that we have
> to finish the last operation and clean structures "when no task is
> inside".
yes. the unplugging may happen at any time, since it's a physical
action and cannot be locked by a kernel :)
this means, the invalid access in the middle of the code cannot be
avoided by a program code unless all function is atomic.
thus, the low-level stuff should take it into account if the card is
pluggable, anyway, for example, avoiding a possible infinte loop,
etc.
in the case of usb, the real critical part depends on the usb core and
controller routine. i hope it's ok.
the "disconnection-check-and-ignore" method is not perfect, but, if
the low level stuff doesn't go crazy even at the disconnected state,
the result wouldn't be so critical.
btw, the oss-emulation problem seems to be on the different point.
the oss-emulation accesses directly to the records without taking any
reference counters. thus snd_*_can_unregister() passes the check even
the control (or pcm) files are still open.
i'll keep on debugging this.
Takashi
-------------------------------------------------------
This SF.net email is sponsored by: Get the new Palm Tungsten T
handheld. Power & Color in a compact size!
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en
next prev parent reply other threads:[~2002-11-29 11:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-28 0:27 trying out usb hotplugs Martin Langer
2002-11-28 12:11 ` Takashi Iwai
2002-11-29 7:52 ` Clemens Ladisch
2002-11-29 9:06 ` Takashi Iwai
2002-11-29 9:39 ` Jaroslav Kysela
2002-11-29 10:07 ` Takashi Iwai
2002-11-29 11:24 ` Jaroslav Kysela
2002-11-29 11:42 ` Takashi Iwai [this message]
2002-11-29 12:12 ` Takashi Iwai
2002-11-29 14:05 ` Jaroslav Kysela
2002-11-29 14:14 ` Takashi Iwai
2002-11-29 14:52 ` Takashi Iwai
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=s5h4ra0a9g2.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