All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH]usx2y: prevent oops & dead keyboard on hot usb unplugging
@ 2005-04-19 21:22 karsten wiese
  2005-04-20  9:17 ` Takashi Iwai
  0 siblings, 1 reply; 22+ messages in thread
From: karsten wiese @ 2005-04-19 21:22 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Clemens Ladisch, Devel Alsa


--- Takashi Iwai <tiwai@suse.de> wrote:
> At Sat, 16 Apr 2005 02:31:06 +0200 (CEST),
> karsten wiese wrote:
> > 
> > --- Clemens Ladisch <clemens@ladisch.de> wrote:
> > > Takashi Iwai wrote:
> > > > karsten wiese wrote:
> > > > > (-: You apply my patch now?
> > > >
> > > > No, not enough :)  This is exactly why
> > > snd_card_free_in_thread() was
> > > > introduced.
> > > >
> > > > As I asked, please make sure that the files are all
> > > released before
> > > > snd_card_free().  Otherwise the disconnect callback
> > > hangs at this
> > > > point because of this check.
> > > 
> > > Most programs close the device file when an error
> occurs,
> > > so you have
> > > to test it with something like this to keep the file
> > > open:
> > > 
> > > #include <stdio.h>
> > > int main()
> > > {
> > >   fopen("/dev/snd/hwC1D0", "rb");
> > >   getchar();
> > > }
> > > 
> > Tested with it, see attached shell log (copied+pasted).
> > Any more tests needed?
> 
> Did you check whether the release fops callback
> (e.g. snd_hwdep_release) is called?

Yes: All snd_*_release() functions call 
snd_card_file_remove() and snd_card_file_remove() definitly
was called as usX2Y_usb_disconnect() finished correctly,
when the client closed it's fd(s).
Only snd_card_file_remove() calls
wake_up(&card->shutdown_sleep).
Only other places where snd_card_file_remove() is called
are the snd_*_open() functions error paths, but those where
not involved, as lsof stabily showed that /dev/snd/hwC1D0
was held open by a.out (the client).

Karsten


	

	
		
___________________________________________________________ 
Gesendet von Yahoo! Mail - Jetzt mit 250MB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de


-------------------------------------------------------
This SF.Net email is sponsored by: New Crystal Reports XI.
Version 11 adds new functionality designed to reduce time involved in
creating, integrating, and deploying reporting solutions. Free runtime info,
new features, or free trial, at: http://www.businessobjects.com/devxi/728

^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: [PATCH]usx2y: prevent oops & dead keyboard on hot usb unplugging
@ 2005-04-19 22:14 karsten wiese
  0 siblings, 0 replies; 22+ messages in thread
From: karsten wiese @ 2005-04-19 22:14 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Clemens Ladisch, Devel Alsa


--- Takashi Iwai <tiwai@suse.de> wrote:
> At Sat, 16 Apr 2005 02:31:06 +0200 (CEST),
> karsten wiese wrote:
> > 
> > [1  <text/plain; iso-8859-1 (8bit)>]
> > 
> > --- Clemens Ladisch <clemens@ladisch.de> wrote:
> > > Takashi Iwai wrote:
> > > > karsten wiese wrote:
> > > > > (-: You apply my patch now?
> > > >
> > > > No, not enough :)  This is exactly why
> > > snd_card_free_in_thread() was
> > > > introduced.
> > > >
> > > > As I asked, please make sure that the files are all
> > > released before
> > > > snd_card_free().  Otherwise the disconnect callback
> > > hangs at this
> > > > point because of this check.
> > > 
> > > Most programs close the device file when an error
> occurs,
> > > so you have
> > > to test it with something like this to keep the file
> > > open:
> > > 
> > > #include <stdio.h>
> > > int main()
> > > {
> > >   fopen("/dev/snd/hwC1D0", "rb");
> > >   getchar();
> > > }
> > > 
> > Tested with it, see attached shell log (copied+pasted).
> > Any more tests needed?
> > I bet a kasten bier that it oopses reliably on first
> try,
> > if I revert to snd_card_free_in_thread() nothing else
> > changed.
> > And I'll inform you , if any oops should show when i
> shut
> > down (pc is still in the state like @ the end of the
> log).
> > 
> > Regards,
> > Karsten
> > 
> > P.S.: how about adding a kernelversion depending macro
> for
> > backward compatibility,... when was
> > snd_card_free_in_thread() introduced?
> 
> Agreed.  The problem is that how to know which version
> has still this
> problem..?  At least, 2.4 kernel must have a problem
> without
> snd_card_free_in_thread().

>From memory I've been hitting the keyboard dead bug since
quite a long time ago. So as a first estimate I suggest 
"kernelversion >= 2.6.0" as condition for use of
snd_card_free().

Karsten


	

	
		
___________________________________________________________ 
Gesendet von Yahoo! Mail - Jetzt mit 250MB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de


-------------------------------------------------------
This SF.Net email is sponsored by: New Crystal Reports XI.
Version 11 adds new functionality designed to reduce time involved in
creating, integrating, and deploying reporting solutions. Free runtime info,
new features, or free trial, at: http://www.businessobjects.com/devxi/728

^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: [PATCH]usx2y: prevent oops & dead keyboard on hot usb unplugging
@ 2005-04-16  0:31 karsten wiese
  2005-04-19  9:23 ` Takashi Iwai
  2005-04-19  9:32 ` Takashi Iwai
  0 siblings, 2 replies; 22+ messages in thread
From: karsten wiese @ 2005-04-16  0:31 UTC (permalink / raw)
  To: Clemens Ladisch, Takashi Iwai; +Cc: karsten wiese, Devel Alsa

[-- Attachment #1: Type: text/plain, Size: 1335 bytes --]


--- Clemens Ladisch <clemens@ladisch.de> wrote:
> Takashi Iwai wrote:
> > karsten wiese wrote:
> > > (-: You apply my patch now?
> >
> > No, not enough :)  This is exactly why
> snd_card_free_in_thread() was
> > introduced.
> >
> > As I asked, please make sure that the files are all
> released before
> > snd_card_free().  Otherwise the disconnect callback
> hangs at this
> > point because of this check.
> 
> Most programs close the device file when an error occurs,
> so you have
> to test it with something like this to keep the file
> open:
> 
> #include <stdio.h>
> int main()
> {
>   fopen("/dev/snd/hwC1D0", "rb");
>   getchar();
> }
> 
Tested with it, see attached shell log (copied+pasted).
Any more tests needed?
I bet a kasten bier that it oopses reliably on first try,
if I revert to snd_card_free_in_thread() nothing else
changed.
And I'll inform you , if any oops should show when i shut
down (pc is still in the state like @ the end of the log).

Regards,
Karsten

P.S.: how about adding a kernelversion depending macro for
backward compatibility,... when was
snd_card_free_in_thread() introduced?


	

	
		
___________________________________________________________ 
Gesendet von Yahoo! Mail - Jetzt mit 250MB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: test-snd_card_free-open_hw1 --]
[-- Type: text/x-java; name=test-snd_card_free-open_hw1, Size: 9137 bytes --]

[ka@p4 debug]$ /home/ka/kernel/linux-2.6.12-rc2/sound/usb/usx2y/a.out

[root@p4 ~]# lsof /dev/snd/*
COMMAND  PID USER   FD   TYPE DEVICE SIZE  NODE NAME
kmix    3797   ka   11u   CHR  116,0       4515 /dev/snd/controlC0
a.out   7124   ka    4r   CHR 116,36      24757 /dev/snd/hwC1D0

[root@p4 ~]# dmesg | tail -n5
[4297447.497000] CLASS: registering class device: ID = 'pcmC1D2c'
[4297447.497000] kobject pcmC1D2c: registering. parent: sound, set: class_obj
[4297447.497000] fill_kobj_path: path = '/class/sound/pcmC1D2c'
[4297447.497000] class_hotplug - name = pcmC1D2c
[4297447.497000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2'

#switch off us428

[root@p4 ~]# dmesg | tail -n29
[4297447.497000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2'
[4298506.550000] hub 3-0:1.0: state 5 ports 2 chg 0000 evt 0004
[4298506.550000] uhci_hcd 0000:00:10.1: port 2 portsc 008a,00
[4298506.550000] hub 3-0:1.0: port 2, status 0100, change 0003, 12 Mb/s
[4298506.550000] usb 3-2: USB disconnect, address 6
[4298506.550000] usb 3-2: usb_disable_device nuking all URBs
[4298506.550000] usb 3-2: unregistering interface 3-2:1.0
[4298506.550000] usX2Y_usb_disconnect(f1946c00,e8483c00)
[4298506.550000] CLASS: Unregistering class device. ID = 'mixer1'
[4298506.550000] fill_kobj_path: path = '/class/sound/mixer1'
[4298506.550000] class_hotplug - name = mixer1
[4298506.569000] kobject mixer1 @ f74b1f90: cleaning up
[4298506.569000] device class 'mixer1': release.
[4298506.569000] CLASS: Unregistering class device. ID = 'adsp1'
[4298506.569000] fill_kobj_path: path = '/class/sound/adsp1'
[4298506.569000] class_hotplug - name = adsp1
[4298506.588000] kobject adsp1 @ e79a5790: cleaning up
[4298506.588000] device class 'adsp1': release.
[4298506.588000] CLASS: Unregistering class device. ID = 'dsp1'
[4298506.588000] fill_kobj_path: path = '/class/sound/dsp1'
[4298506.588000] class_hotplug - name = dsp1
[4298506.608000] kobject dsp1 @ f7841110: cleaning up
[4298506.608000] device class 'dsp1': release.
[4298506.608000] CLASS: Unregistering class device. ID = 'audio1'
[4298506.608000] fill_kobj_path: path = '/class/sound/audio1'
[4298506.608000] class_hotplug - name = audio1
[4298506.629000] kobject audio1 @ f6c9da90: cleaning up
[4298506.629000] device class 'audio1': release.
[4298507.572000] uhci_hcd 0000:00:10.1: suspend_hc

[root@p4 ~]# lsof /dev/snd/*
COMMAND  PID USER   FD   TYPE DEVICE SIZE  NODE NAME
kmix    3797   ka   11u   CHR  116,0       4515 /dev/snd/controlC0
a.out   7124   ka    4r   CHR 116,36      24757 /dev/snd/hwC1D0


#way 1 , see below what happens when us428 is switched on while "/dev/snd/hwC1D0" is still open

#control-c to quit a.out
[ka@p4 debug]$

[root@p4 ~]# dmesg | tail -n78
[4298507.572000] uhci_hcd 0000:00:10.1: suspend_hc
[4298653.844000] CLASS: Unregistering class device. ID = 'controlC1'
[4298653.844000] fill_kobj_path: path = '/class/sound/controlC1'
[4298653.844000] class_hotplug - name = controlC1
[4298653.844000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2'
[4298653.865000] kobject controlC1 @ f6e2c310: cleaning up
[4298653.865000] device class 'controlC1': release.
[4298653.865000] CLASS: Unregistering class device. ID = 'pcmC1D2p'
[4298653.865000] fill_kobj_path: path = '/class/sound/pcmC1D2p'
[4298653.865000] class_hotplug - name = pcmC1D2p
[4298653.865000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2'
[4298653.886000] kobject pcmC1D2p @ e743c410: cleaning up
[4298653.886000] device class 'pcmC1D2p': release.
[4298653.886000] CLASS: Unregistering class device. ID = 'pcmC1D2c'
[4298653.886000] fill_kobj_path: path = '/class/sound/pcmC1D2c'
[4298653.886000] class_hotplug - name = pcmC1D2c
[4298653.886000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2'
[4298653.906000] kobject pcmC1D2c @ e743c390: cleaning up
[4298653.906000] device class 'pcmC1D2c': release.
[4298653.906000] CLASS: Unregistering class device. ID = 'hwC1D1'
[4298653.906000] fill_kobj_path: path = '/class/sound/hwC1D1'
[4298653.906000] class_hotplug - name = hwC1D1
[4298653.906000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2'
[4298653.927000] kobject hwC1D1 @ e79a5610: cleaning up
[4298653.927000] device class 'hwC1D1': release.
[4298653.927000] CLASS: Unregistering class device. ID = 'pcmC1D1c'
[4298653.927000] fill_kobj_path: path = '/class/sound/pcmC1D1c'
[4298653.927000] class_hotplug - name = pcmC1D1c
[4298653.927000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2'
[4298653.944000] kobject pcmC1D1c @ e79a5810: cleaning up
[4298653.944000] device class 'pcmC1D1c': release.
[4298653.944000] CLASS: Unregistering class device. ID = 'pcmC1D0p'
[4298653.944000] fill_kobj_path: path = '/class/sound/pcmC1D0p'
[4298653.944000] class_hotplug - name = pcmC1D0p
[4298653.944000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2'
[4298653.950000] kobject pcmC1D0p @ f0e06710: cleaning up
[4298653.950000] device class 'pcmC1D0p': release.
[4298653.950000] CLASS: Unregistering class device. ID = 'pcmC1D0c'
[4298653.950000] fill_kobj_path: path = '/class/sound/pcmC1D0c'
[4298653.950000] class_hotplug - name = pcmC1D0c
[4298653.950000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2'
[4298653.968000] kobject pcmC1D0c @ f0e06990: cleaning up
[4298653.968000] device class 'pcmC1D0c': release.
[4298653.968000] CLASS: Unregistering class device. ID = 'midi1'
[4298653.968000] fill_kobj_path: path = '/class/sound/midi1'
[4298653.968000] class_hotplug - name = midi1
[4298653.994000] kobject midi1 @ e8be1790: cleaning up
[4298653.994000] device class 'midi1': release.
[4298653.994000] CLASS: Unregistering class device. ID = 'dmmidi1'
[4298653.994000] fill_kobj_path: path = '/class/sound/dmmidi1'
[4298653.994000] class_hotplug - name = dmmidi1
[4298654.013000] kobject dmmidi1 @ e8be1690: cleaning up
[4298654.013000] device class 'dmmidi1': release.
[4298654.013000] CLASS: Unregistering class device. ID = 'midiC1D0'
[4298654.013000] fill_kobj_path: path = '/class/sound/midiC1D0'
[4298654.013000] class_hotplug - name = midiC1D0
[4298654.013000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2'
[4298654.031000] kobject midiC1D0 @ e8be1310: cleaning up
[4298654.031000] device class 'midiC1D0': release.
[4298654.031000] CLASS: Unregistering class device. ID = 'hwC1D0'
[4298654.031000] fill_kobj_path: path = '/class/sound/hwC1D0'
[4298654.031000] class_hotplug - name = hwC1D0
[4298654.031000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2'
[4298654.049000] kobject hwC1D0 @ f6e2c090: cleaning up
[4298654.049000] device class 'hwC1D0': release.
[4298654.049000] usX2Y_usb_disconnect() leaving
[4298654.049000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2/3-2:1.0'
[4298654.049000] usb 3-2:1.0: hotplug
[4298654.067000] kobject 3-2:1.0 @ f5423178: cleaning up
[4298654.067000] usb 3-2: unregistering device
[4298654.067000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2'
[4298654.067000] usb 3-2: hotplug
[4298654.099000] kobject 3-2 @ f1946c88: cleaning up
[4298654.206000] hub 3-0:1.0: debounce: port 2: total 100ms stable 100ms status 0x100
[4298654.206000] hub 1-0:1.0: state 5 ports 8 chg 0000 evt 0010
[4298654.206000] ehci_hcd 0000:00:10.4: GetStatus port 4 status 001002 POWER sig=se0  CSC
[4298654.206000] hub 1-0:1.0: port 4, status 0100, change 0001, 12 Mb/s
[4298654.311000] hub 1-0:1.0: debounce: port 4: total 100ms stable 100ms status 0x100


-----------------------------------------

#way 2, us428 is switched on again while a.out still holds  "/dev/snd/hwC1D0" open

[root@p4 ~]# dmesg | tail -n10
[4298822.089000] fill_kobj_path: path = '/class/sound/dsp1'
[4298822.089000] class_hotplug - name = dsp1
[4298822.109000] kobject dsp1 @ f6883b10: cleaning up
[4298822.109000] device class 'dsp1': release.
[4298822.109000] CLASS: Unregistering class device. ID = 'audio1'
[4298822.109000] fill_kobj_path: path = '/class/sound/audio1'
[4298822.109000] class_hotplug - name = audio1
[4298822.129000] kobject audio1 @ f6883890: cleaning up
[4298822.129000] device class 'audio1': release.
[4298822.972000] uhci_hcd 0000:00:10.1: suspend_hc

# looks the same ,  except for memory pointers and timer marks , compared to when we took way 1
# also note: us428 USB light stay's OFF !!

#control-c to quit a.out
[ka@p4 debug]$

# us428 USB light is ON , yesz! also us428control has been started by hotplug:
[root@p4 ~]# lsof /dev/snd/*
COMMAND    PID USER   FD   TYPE DEVICE SIZE  NODE NAME
kmix      3797   ka   11u   CHR  116,0       4515 /dev/snd/controlC0
us428cont 9183 root  mem    CHR 116,36      37064 /dev/snd/hwC1D0
us428cont 9183 root    3u   CHR 116,36      37064 /dev/snd/hwC1D0
us428cont 9183 root    4u   CHR  116,1      12293 /dev/snd/seq

[ka@p4 usx2y]$ arecord -Dhw:1 -fcd | aplay -Dhw:1
Recording WAVE 'stdout' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
Playing WAVE 'stdin' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo

#...... sounds just fine ....no oops, everything ok  :-)

^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: [PATCH]usx2y: prevent oops & dead keyboard on hot usb unplugging
@ 2005-04-15 15:15 karsten wiese
  0 siblings, 0 replies; 22+ messages in thread
From: karsten wiese @ 2005-04-15 15:15 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Lee Revell, Clemens Ladisch, Devel Alsa


--- Takashi Iwai <tiwai@suse.de> wrote:
> At Fri, 15 Apr 2005 16:28:54 +0200 (CEST),
> karsten wiese wrote:
> > 
> > 
> > --- Takashi Iwai <tiwai@suse.de> wrote:
> > > At Fri, 15 Apr 2005 15:59:25 +0200 (CEST),
> > > karsten wiese wrote:
> > > > 
> > > > 
> > > > --- Lee Revell <rlrevell@joe-job.com> wrote:
> > > > > On Thu, 2005-04-14 at 20:59 +0200, karsten wiese
> > > wrote:
> > > > > > Hi Clemens & Takashi
> > > > > > 
> > > > > > Please commit the patch.
> > > > > 
> > > > > Is the ALSA in kernel 2.6.11 affected?  If so,
> this
> > > > 
> > > > Think so, yes. The keyboard dead effect + described
> > > oops
> > > > has been around for quiet a long time.
> > > > (There is a lkml mail from yesterday about an
> > > usb-cellphone
> > > > setup,
> > > > where the same oops + dead keyboard happens also:
> > > >
> > >
> >
>
http://marc.theaimsgroup.com/?i=<20050414230621.49663f75.vsu%20()%20altlinux%20!%20ru>
> > > > )
> > > > There is also an alsa-bug with snd-usb-audio in the
> > > > bugbase.
> > > > Clemens seams not to be convinced about this
> aproach
> > > yet.
> > > > maybe 'cause the comment of snd_card_free_in_thread
> > > > explicitly states that its the one to be called for
> > > > hotplug:
> > > > /**
> > > >  *  snd_card_free_in_thread - call snd_card_free()
> in
> > > > thread
> > > >  *  @card: soundcard structure
> > > >  *
> > > >  *  This function schedules the call of
> snd_card_free()
> > > > function in a
> > > >  *  work queue.  When all devices are released
> > > (non-busy),
> > > > the work
> > > >  *  is woken up and calls snd_card_free().
> > > >  *
> > > >  *  When a card can be disconnected at any time by
> > > hotplug
> > > > service,
> > > >  *  this function should be used in disconnect (or
> > > detach)
> > > > callback
> > > >  *  instead of calling snd_card_free() directly.
> > > >  *  
> > > >  *  Returns - zero otherwise a negative error code
> if
> > > the
> > > > start of thread failed.
> > > >  */
> > > > 
> > > > Also I remember , that snd_card_free didn't work ok
> > > when i
> > > > used it in the first implementations of
> usx2y-module
> > > some 2
> > > > years ago.
> > > > but that was on kernel 2.4.something.......
> > > > maybe above comment is from kernel 2.4 also and the
> > > hotplug
> > > > system has changed ? anybody?
> > > 
> > > Might be.  To be sure, check whether the release fops
> is
> > > called
> > > properly before you calling snd_card_free().
> > 
> > You mean snd_card_disconnect()?
> > That's called with the same argument and before
> > snd_card_free().
> 
> No, I mean snd_card_free(), which you changed from
> snd_card_free_in_thread().  Someone has to release the
> files
> (i.e. call release fops eventually) before clean up
> everything via
> snd_card_free().
> 
Erm, you mean the close (for
snd_pcm_ops_t,snd_rawmidi_ops_t) and release (for
snd_hwdep_ops_t) callbacks then? They should all be called
before snd_card_free()?
in other words:
<snip>
int snd_card_free_in_thread(snd_card_t * card)
{
	if (card->files == NULL) {
		snd_card_free(card);
		return 0;
	}
</snip>
the "(card->files == NULL)" MUST be true before
snd_card_free() can be called safely?

Karsten


	
		
___________________________________________________________ 
Gesendet von Yahoo! Mail - Jetzt mit 250MB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click

^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: [PATCH]usx2y: prevent oops & dead keyboard on hot usb unplugging
@ 2005-04-15 15:14 karsten wiese
  2005-04-15 15:22 ` Takashi Iwai
  2005-04-15 15:32 ` Clemens Ladisch
  0 siblings, 2 replies; 22+ messages in thread
From: karsten wiese @ 2005-04-15 15:14 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Lee Revell, Clemens Ladisch, Devel Alsa


--- Takashi Iwai <tiwai@suse.de> wrote:
> At Fri, 15 Apr 2005 16:28:54 +0200 (CEST),
> karsten wiese wrote:
> > 
> > 
> > --- Takashi Iwai <tiwai@suse.de> wrote:
> > > At Fri, 15 Apr 2005 15:59:25 +0200 (CEST),
> > > karsten wiese wrote:
> > > > 
> > > > 
> > > > --- Lee Revell <rlrevell@joe-job.com> wrote:
> > > > > On Thu, 2005-04-14 at 20:59 +0200, karsten wiese
> > > wrote:
> > > > > > Hi Clemens & Takashi
> > > > > > 
> > > > > > Please commit the patch.
> > > > > 
> > > > > Is the ALSA in kernel 2.6.11 affected?  If so,
> this
> > > > 
> > > > Think so, yes. The keyboard dead effect + described
> > > oops
> > > > has been around for quiet a long time.
> > > > (There is a lkml mail from yesterday about an
> > > usb-cellphone
> > > > setup,
> > > > where the same oops + dead keyboard happens also:
> > > >
> > >
> >
>
http://marc.theaimsgroup.com/?i=<20050414230621.49663f75.vsu%20()%20altlinux%20!%20ru>
> > > > )
> > > > There is also an alsa-bug with snd-usb-audio in the
> > > > bugbase.
> > > > Clemens seams not to be convinced about this
> aproach
> > > yet.
> > > > maybe 'cause the comment of snd_card_free_in_thread
> > > > explicitly states that its the one to be called for
> > > > hotplug:
> > > > /**
> > > >  *  snd_card_free_in_thread - call snd_card_free()
> in
> > > > thread
> > > >  *  @card: soundcard structure
> > > >  *
> > > >  *  This function schedules the call of
> snd_card_free()
> > > > function in a
> > > >  *  work queue.  When all devices are released
> > > (non-busy),
> > > > the work
> > > >  *  is woken up and calls snd_card_free().
> > > >  *
> > > >  *  When a card can be disconnected at any time by
> > > hotplug
> > > > service,
> > > >  *  this function should be used in disconnect (or
> > > detach)
> > > > callback
> > > >  *  instead of calling snd_card_free() directly.
> > > >  *  
> > > >  *  Returns - zero otherwise a negative error code
> if
> > > the
> > > > start of thread failed.
> > > >  */
> > > > 
> > > > Also I remember , that snd_card_free didn't work ok
> > > when i
> > > > used it in the first implementations of
> usx2y-module
> > > some 2
> > > > years ago.
> > > > but that was on kernel 2.4.something.......
> > > > maybe above comment is from kernel 2.4 also and the
> > > hotplug
> > > > system has changed ? anybody?
> > > 
> > > Might be.  To be sure, check whether the release fops
> is
> > > called
> > > properly before you calling snd_card_free().
> > 
> > You mean snd_card_disconnect()?
> > That's called with the same argument and before
> > snd_card_free().
> 
> No, I mean snd_card_free(), which you changed from
> snd_card_free_in_thread().  Someone has to release the
> files
> (i.e. call release fops eventually) before clean up
> everything via
> snd_card_free().
> 
Erm, you mean the close (for
snd_pcm_ops_t,snd_rawmidi_ops_t) and release (for
snd_hwdep_ops_t) callbacks then? They should all be called
before snd_card_free()?
in other words:
<snip>
int snd_card_free_in_thread(snd_card_t * card)
{
	if (card->files == NULL) {
		snd_card_free(card);
		return 0;
	}
</snip>
the "(card->files == NULL)" MUST be true before
snd_card_free() can be called safely?

Karsten


	
		
___________________________________________________________ 
Gesendet von Yahoo! Mail - Jetzt mit 250MB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click

^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: [PATCH]usx2y: prevent oops & dead keyboard on hot usb unplugging
@ 2005-04-15 14:28 karsten wiese
  2005-04-15 14:36 ` Takashi Iwai
  0 siblings, 1 reply; 22+ messages in thread
From: karsten wiese @ 2005-04-15 14:28 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Lee Revell, Clemens Ladisch, Devel Alsa


--- Takashi Iwai <tiwai@suse.de> wrote:
> At Fri, 15 Apr 2005 15:59:25 +0200 (CEST),
> karsten wiese wrote:
> > 
> > 
> > --- Lee Revell <rlrevell@joe-job.com> wrote:
> > > On Thu, 2005-04-14 at 20:59 +0200, karsten wiese
> wrote:
> > > > Hi Clemens & Takashi
> > > > 
> > > > Please commit the patch.
> > > 
> > > Is the ALSA in kernel 2.6.11 affected?  If so, this
> > 
> > Think so, yes. The keyboard dead effect + described
> oops
> > has been around for quiet a long time.
> > (There is a lkml mail from yesterday about an
> usb-cellphone
> > setup,
> > where the same oops + dead keyboard happens also:
> >
>
http://marc.theaimsgroup.com/?i=<20050414230621.49663f75.vsu%20()%20altlinux%20!%20ru>
> > )
> > There is also an alsa-bug with snd-usb-audio in the
> > bugbase.
> > Clemens seams not to be convinced about this aproach
> yet.
> > maybe 'cause the comment of snd_card_free_in_thread
> > explicitly states that its the one to be called for
> > hotplug:
> > /**
> >  *  snd_card_free_in_thread - call snd_card_free() in
> > thread
> >  *  @card: soundcard structure
> >  *
> >  *  This function schedules the call of snd_card_free()
> > function in a
> >  *  work queue.  When all devices are released
> (non-busy),
> > the work
> >  *  is woken up and calls snd_card_free().
> >  *
> >  *  When a card can be disconnected at any time by
> hotplug
> > service,
> >  *  this function should be used in disconnect (or
> detach)
> > callback
> >  *  instead of calling snd_card_free() directly.
> >  *  
> >  *  Returns - zero otherwise a negative error code if
> the
> > start of thread failed.
> >  */
> > 
> > Also I remember , that snd_card_free didn't work ok
> when i
> > used it in the first implementations of usx2y-module
> some 2
> > years ago.
> > but that was on kernel 2.4.something.......
> > maybe above comment is from kernel 2.4 also and the
> hotplug
> > system has changed ? anybody?
> 
> Might be.  To be sure, check whether the release fops is
> called
> properly before you calling snd_card_free().

You mean snd_card_disconnect()?
That's called with the same argument and before
snd_card_free().

Karsten


	

	
		
___________________________________________________________ 
Gesendet von Yahoo! Mail - Jetzt mit 250MB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click

^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: [PATCH]usx2y: prevent oops & dead keyboard on hot usb unplugging
@ 2005-04-15 13:59 karsten wiese
  2005-04-15 14:16 ` Takashi Iwai
  0 siblings, 1 reply; 22+ messages in thread
From: karsten wiese @ 2005-04-15 13:59 UTC (permalink / raw)
  To: Lee Revell; +Cc: Takashi Iwai, Clemens Ladisch, Devel Alsa


--- Lee Revell <rlrevell@joe-job.com> wrote:
> On Thu, 2005-04-14 at 20:59 +0200, karsten wiese wrote:
> > Hi Clemens & Takashi
> > 
> > Please commit the patch.
> 
> Is the ALSA in kernel 2.6.11 affected?  If so, this

Think so, yes. The keyboard dead effect + described oops
has been around for quiet a long time.
(There is a lkml mail from yesterday about an usb-cellphone
setup,
where the same oops + dead keyboard happens also:
http://marc.theaimsgroup.com/?i=<20050414230621.49663f75.vsu%20()%20altlinux%20!%20ru>
)
There is also an alsa-bug with snd-usb-audio in the
bugbase.
Clemens seams not to be convinced about this aproach yet.
maybe 'cause the comment of snd_card_free_in_thread
explicitly states that its the one to be called for
hotplug:
/**
 *  snd_card_free_in_thread - call snd_card_free() in
thread
 *  @card: soundcard structure
 *
 *  This function schedules the call of snd_card_free()
function in a
 *  work queue.  When all devices are released (non-busy),
the work
 *  is woken up and calls snd_card_free().
 *
 *  When a card can be disconnected at any time by hotplug
service,
 *  this function should be used in disconnect (or detach)
callback
 *  instead of calling snd_card_free() directly.
 *  
 *  Returns - zero otherwise a negative error code if the
start of thread failed.
 */

Also I remember , that snd_card_free didn't work ok when i
used it in the first implementations of usx2y-module some 2
years ago.
but that was on kernel 2.4.something.......
maybe above comment is from kernel 2.4 also and the hotplug
system has changed ? anybody?

rgds,
Karsten 


	

	
		
___________________________________________________________ 
Gesendet von Yahoo! Mail - Jetzt mit 250MB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click

^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: [PATCH]usx2y: prevent oops & dead keyboard on hot usb unplugging
@ 2005-04-15 13:31 karsten wiese
  0 siblings, 0 replies; 22+ messages in thread
From: karsten wiese @ 2005-04-15 13:31 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: Takashi Iwai, Devel Alsa

[-- Attachment #1: Type: text/plain, Size: 593 bytes --]

--- Clemens Ladisch <clemens@ladisch.de> wrote:
> karsten wiese wrote:
> > Please commit the patch.
> >
> > - snd_card_free_in_thread((snd_card_t*)ptr);
> > + snd_card_free((snd_card_t*)ptr);
> 
> What happens when you unplug the device while it's still
> playing?

See attached excerpts of /var/log/messages.
they are a bit looong, but critical points are marked with
a comment starting with //.





	

	
		
___________________________________________________________ 
Gesendet von Yahoo! Mail - Jetzt mit 250MB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: usx2y-hot-unplug_snd_card_free_in_thread --]
[-- Type: text/x-java; name=usx2y-hot-unplug_snd_card_free_in_thread, Size: 17740 bytes --]

with snd_card_free_in_thread, it oopses:
this is triggered by "rmmod uhci_hcd" while jackd was runnnig.
the effect of unplugging the cable is nearly identicall.
comments begin with //

Apr 13 13:22:21 p4 kernel: [4299685.996000] uhci_hcd 0000:00:10.1: remove, state 1
Apr 13 13:22:21 p4 kernel: [4299685.996000] uhci_hcd 0000:00:10.1: roothub graceful disconnect
// usx2y is connnected to usb3:
Apr 13 13:22:21 p4 kernel: [4299685.996000] usb usb3: USB disconnect, address 1
Apr 13 13:22:22 p4 kernel: [4299685.996000] usb 3-2: USB disconnect, address 2
Apr 13 13:22:22 p4 kernel: [4299685.996000] usb 3-2: usb_disable_device nuking all URBs
Apr 13 13:22:22 p4 kernel: [4299685.996000] uhci_hcd 0000:00:10.1: shutdown urb f75cfd80 pipe 40020280 ep4in-intr
Apr 13 13:22:22 p4 kernel: [4299685.996000] uhci_hcd 0000:00:10.1: shutdown urb ed73f480 pipe 40020280 ep4in-intr
// usx2y notices disconnect.....
Apr 13 13:22:22 p4 kernel: [4299685.996000] urb status -108
Apr 13 13:22:22 p4 kernel: [4299685.996000] usb_submit_urb() returned -19
Apr 13 13:22:22 p4 kernel: [4299685.996000] 
// and stops streaming
Apr 13 13:22:22 p4 kernel: [4299685.996000] snd_usX2Y_pcm_trigger(STOP)
Apr 13 13:22:22 p4 kernel: [4299685.996000] snd_usX2Y_pcm_trigger(STOP)
Apr 13 13:22:22 p4 kernel: [4299685.996000] 0 status=-115 start_frame=809
Apr 13 13:22:22 p4 kernel: [4299685.996000] 1 status=0 start_frame=810
Apr 13 13:22:22 p4 kernel: [4299685.996000] 0 status=0 start_frame=808
Apr 13 13:22:22 p4 kernel: [4299685.996000] 1 status=-115 start_frame=809
Apr 13 13:22:22 p4 kernel: [4299685.996000] 0 status=0 start_frame=808
Apr 13 13:22:22 p4 kernel: [4299685.996000] 1 status=-115 start_frame=809
Apr 13 13:22:22 p4 kernel: [4299685.996000] 0 edd64d80 state=4
Apr 13 13:22:22 p4 kernel: [4299685.996000] 1 edd64f80 state=4
Apr 13 13:22:22 p4 kernel: [4299685.996000] 3 edd64e40 state=4
Apr 13 13:22:22 p4 kernel: [4299685.996000] snd_usX2Y_pcm_prepare(e8a8fd00)
Apr 13 13:22:22 p4 kernel: [4299685.996000] usX2Y_subs_prepare(edd64f80) ep=8 urb0=c5f89b00 urb1=c5f89b80
Apr 13 13:22:22 p4 kernel: [4299685.996000] starting capture pipe for self
Apr 13 13:22:22 p4 kernel: [4299685.997000] hcd_frame=1834 ep=8in status=-2 start_frame=809
Apr 13 13:22:22 p4 kernel: [4299685.997000] hcd_frame=1834 ep=10out status=0 start_frame=809
Apr 13 13:22:22 p4 kernel: [4299685.997000] hcd_frame=1834 ep=10in status=0 start_frame=809
Apr 13 13:22:22 p4 kernel: [4299685.997000] cannot usb_submit_urb() for urb 0, err = -19
Apr 13 13:22:22 p4 kernel: [4299685.997000] 0 status=0 start_frame=809
Apr 13 13:22:22 p4 kernel: [4299685.997000] 1 status=0 start_frame=810
Apr 13 13:22:22 p4 kernel: [4299685.997000] 0 status=0 start_frame=-1
Apr 13 13:22:22 p4 kernel: [4299685.997000] 1 status=-2 start_frame=809
Apr 13 13:22:22 p4 kernel: [4299685.997000] 0 status=0 start_frame=808
Apr 13 13:22:22 p4 kernel: [4299685.997000] 1 status=0 start_frame=809
Apr 13 13:22:22 p4 kernel: [4299685.997000] 0 edd64d80 state=0
Apr 13 13:22:22 p4 kernel: [4299685.997000] 1 edd64f80 state=3
Apr 13 13:22:22 p4 kernel: [4299685.997000] 3 edd64e40 state=0
// snd_card_free_in_thread starts working ok
Apr 13 13:22:22 p4 kernel: [4299685.997000] usb 3-2: unregistering interface 3-2:1.0
Apr 13 13:22:22 p4 kernel: [4299685.997000] CLASS: Unregistering class device. ID = 'mixer1'
Apr 13 13:22:22 p4 kernel: [4299685.997000] fill_kobj_path: path = '/class/sound/mixer1'
Apr 13 13:22:22 p4 kernel: [4299685.997000] class_hotplug - name = mixer1
Apr 13 13:22:22 p4 kernel: [4299686.113000] kobject mixer1: cleaning up
Apr 13 13:22:22 p4 kernel: [4299686.113000] device class 'mixer1': release.
Apr 13 13:22:22 p4 kernel: [4299686.113000] CLASS: Unregistering class device. ID = 'adsp1'
Apr 13 13:22:22 p4 kernel: [4299686.113000] fill_kobj_path: path = '/class/sound/adsp1'
Apr 13 13:22:22 p4 kernel: [4299686.113000] class_hotplug - name = adsp1
Apr 13 13:22:22 p4 kernel: [4299686.123000] kobject adsp1: cleaning up
Apr 13 13:22:22 p4 kernel: [4299686.123000] device class 'adsp1': release.
Apr 13 13:22:22 p4 kernel: [4299686.123000] CLASS: Unregistering class device. ID = 'dsp1'
Apr 13 13:22:22 p4 kernel: [4299686.123000] fill_kobj_path: path = '/class/sound/dsp1'
Apr 13 13:22:22 p4 kernel: [4299686.123000] class_hotplug - name = dsp1
Apr 13 13:22:22 p4 kernel: [4299686.133000] kobject dsp1: cleaning up
Apr 13 13:22:22 p4 kernel: [4299686.133000] device class 'dsp1': release.
Apr 13 13:22:22 p4 kernel: [4299686.133000] CLASS: Unregistering class device. ID = 'audio1'
Apr 13 13:22:22 p4 kernel: [4299686.133000] fill_kobj_path: path = '/class/sound/audio1'
Apr 13 13:22:22 p4 kernel: [4299686.133000] class_hotplug - name = audio1
Apr 13 13:22:22 p4 kernel: [4299686.143000] kobject audio1: cleaning up
Apr 13 13:22:22 p4 kernel: [4299686.143000] device class 'audio1': release.
Apr 13 13:22:22 p4 kernel: [4299686.143000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2/3-2:1.0'
Apr 13 13:22:22 p4 kernel: [4299686.143000] usb 3-2:1.0: hotplug
Apr 13 13:22:22 p4 kernel: [4299686.161000] kobject 3-2:1.0: cleaning up
Apr 13 13:22:22 p4 kernel: [4299686.161000] usb 3-2: unregistering device
Apr 13 13:22:22 p4 kernel: [4299686.161000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2'

// since its snd_card_free_IN_THREAD, usX2Y_usb_disconnect() has finished and hotplug thinks,
// it may continue cleaning up:
Apr 13 13:22:22 p4 kernel: [4299686.161000] usb 3-2: hotplug
Apr 13 13:22:22 p4 kernel: [4299686.174000] usb usb3: usb_disable_device nuking all URBs
Apr 13 13:22:22 p4 kernel: [4299686.174000] uhci_hcd 0000:00:10.1: shutdown urb e8336b00 pipe 40408180 ep1in-intr
Apr 13 13:22:22 p4 kernel: [4299686.174000] usb usb3: unregistering interface 3-0:1.0
Apr 13 13:22:22 p4 kernel: [4299686.174000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-0:1.0'
Apr 13 13:22:22 p4 kernel: [4299686.174000] usb 3-0:1.0: hotplug
Apr 13 13:22:22 p4 kernel: [4299686.191000] kobject 3-0:1.0: cleaning up
Apr 13 13:22:22 p4 kernel: [4299686.191000] usb usb3: unregistering device
Apr 13 13:22:22 p4 kernel: [4299686.191000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3'
Apr 13 13:22:22 p4 kernel: [4299686.191000] usb usb3: hotplug
Apr 13 13:22:22 p4 kernel: [4299686.193000] snd_usX2Y_usbpcm_hw_free(e8a8fb80)
Apr 13 13:22:22 p4 kernel: [4299686.193000] snd_usX2Y_urbs_release() 10
Apr 13 13:22:22 p4 kernel: [4299686.193000] snd_usX2Y_urbs_release() 8
Apr 13 13:22:22 p4 kernel: [4299686.193000] snd_usX2Y_urbs_release() 10
Apr 13 13:22:22 p4 kernel: [4299686.193000] snd_usX2Y_usbpcm_hw_free(e8a8fd00)
Apr 13 13:22:22 p4 kernel: [4299686.193000] snd_usX2Y_urbs_release() 8
Apr 13 13:22:22 p4 kernel: [4299686.193000] snd_usX2Y_urbs_release() 10
Apr 13 13:22:22 p4 kernel: [4299686.193000] CLASS: Unregistering class device. ID = 'controlC1'
Apr 13 13:22:22 p4 kernel: [4299686.193000] fill_kobj_path: path = '/class/sound/controlC1'
Apr 13 13:22:22 p4 kernel: [4299686.193000] class_hotplug - name = controlC1
Apr 13 13:22:22 p4 kernel: [4299686.193000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2'
Apr 13 13:22:22 p4 kernel: [4299686.198000] kobject controlC1: cleaning up
Apr 13 13:22:22 p4 kernel: [4299686.198000] device class 'controlC1': release.
Apr 13 13:22:22 p4 kernel: [4299686.198000] CLASS: Unregistering class device. ID = 'pcmC1D2p'
Apr 13 13:22:22 p4 kernel: [4299686.198000] fill_kobj_path: path = '/class/sound/pcmC1D2p'
Apr 13 13:22:22 p4 kernel: [4299686.198000] class_hotplug - name = pcmC1D2p
Apr 13 13:22:22 p4 kernel: [4299686.198000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2'
Apr 13 13:22:22 p4 kernel: [4299686.199000] kobject pcmC1D2p: cleaning up
Apr 13 13:22:22 p4 kernel: [4299686.199000] device class 'pcmC1D2p': release.
Apr 13 13:22:22 p4 kernel: [4299686.199000] CLASS: Unregistering class device. ID = 'pcmC1D2c'
Apr 13 13:22:22 p4 kernel: [4299686.199000] fill_kobj_path: path = '/class/sound/pcmC1D2c'
Apr 13 13:22:22 p4 kernel: [4299686.199000] class_hotplug - name = pcmC1D2c
Apr 13 13:22:22 p4 kernel: [4299686.199000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2'
Apr 13 13:22:22 p4 kernel: [4299686.203000] kobject pcmC1D2c: cleaning up
Apr 13 13:22:22 p4 kernel: [4299686.203000] device class 'pcmC1D2c': release.
Apr 13 13:22:22 p4 kernel: [4299686.203000] CLASS: Unregistering class device. ID = 'hwC1D1'
Apr 13 13:22:22 p4 kernel: [4299686.203000] fill_kobj_path: path = '/class/sound/hwC1D1'
Apr 13 13:22:22 p4 kernel: [4299686.203000] class_hotplug - name = hwC1D1
Apr 13 13:22:22 p4 kernel: [4299686.203000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2'
Apr 13 13:22:22 p4 kernel: [4299686.207000] kobject hwC1D1: cleaning up
Apr 13 13:22:22 p4 kernel: [4299686.207000] device class 'hwC1D1': release.
Apr 13 13:22:22 p4 kernel: [4299686.207000] CLASS: Unregistering class device. ID = 'pcmC1D1c'
Apr 13 13:22:22 p4 kernel: [4299686.207000] fill_kobj_path: path = '/class/sound/pcmC1D1c'
Apr 13 13:22:22 p4 kernel: [4299686.207000] class_hotplug - name = pcmC1D1c
Apr 13 13:22:22 p4 kernel: [4299686.207000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2'
Apr 13 13:22:22 p4 kernel: [4299686.212000] kobject pcmC1D1c: cleaning up
Apr 13 13:22:22 p4 kernel: [4299686.212000] device class 'pcmC1D1c': release.
Apr 13 13:22:22 p4 kernel: [4299686.212000] CLASS: Unregistering class device. ID = 'pcmC1D0p'
Apr 13 13:22:22 p4 kernel: [4299686.212000] fill_kobj_path: path = '/class/sound/pcmC1D0p'
Apr 13 13:22:22 p4 kernel: [4299686.212000] class_hotplug - name = pcmC1D0p
Apr 13 13:22:22 p4 kernel: [4299686.212000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2'
Apr 13 13:22:22 p4 kernel: [4299686.216000] kobject pcmC1D0p: cleaning up
Apr 13 13:22:22 p4 kernel: [4299686.216000] device class 'pcmC1D0p': release.
Apr 13 13:22:22 p4 kernel: [4299686.216000] CLASS: Unregistering class device. ID = 'pcmC1D0c'
Apr 13 13:22:22 p4 kernel: [4299686.216000] fill_kobj_path: path = '/class/sound/pcmC1D0c'
Apr 13 13:22:22 p4 kernel: [4299686.216000] class_hotplug - name = pcmC1D0c
Apr 13 13:22:22 p4 kernel: [4299686.216000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2'
Apr 13 13:22:22 p4 kernel: [4299686.218000] kobject pcmC1D0c: cleaning up
Apr 13 13:22:22 p4 kernel: [4299686.218000] device class 'pcmC1D0c': release.
Apr 13 13:22:22 p4 kernel: [4299686.218000] CLASS: Unregistering class device. ID = 'midi1'
Apr 13 13:22:22 p4 kernel: [4299686.218000] fill_kobj_path: path = '/class/sound/midi1'
Apr 13 13:22:22 p4 kernel: [4299686.218000] class_hotplug - name = midi1
Apr 13 13:22:22 p4 kernel: [4299686.263000] uhci_hcd 0000:00:10.1: USB bus 3 deregistered
Apr 13 13:22:22 p4 kernel: [4299686.263000] fill_kobj_path: path = '/class/usb_host/usb3'
Apr 13 13:22:22 p4 kernel: [4299686.263000] class_hotplug - name = usb3
Apr 13 13:22:22 p4 kernel: [4299686.263000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1'
Apr 13 13:22:22 p4 kernel: [4299686.319000] kobject midi1: cleaning up
Apr 13 13:22:22 p4 kernel: [4299686.319000] device class 'midi1': release.
Apr 13 13:22:22 p4 kernel: [4299686.319000] CLASS: Unregistering class device. ID = 'dmmidi1'
Apr 13 13:22:22 p4 kernel: [4299686.319000] fill_kobj_path: path = '/class/sound/dmmidi1'
Apr 13 13:22:23 p4 kernel: [4299686.319000] class_hotplug - name = dmmidi1
Apr 13 13:22:23 p4 kernel: [4299686.319000] uhci_hcd 0000:00:10.2: remove, state 1
Apr 13 13:22:23 p4 kernel: [4299686.319000] uhci_hcd 0000:00:10.2: roothub graceful disconnect
Apr 13 13:22:23 p4 kernel: [4299686.319000] usb usb4: USB disconnect, address 1
Apr 13 13:22:23 p4 kernel: [4299686.319000] usb usb4: usb_disable_device nuking all URBs
Apr 13 13:22:23 p4 kernel: [4299686.319000] uhci_hcd 0000:00:10.2: shutdown urb e8336780 pipe 40408180 ep1in-intr
Apr 13 13:22:23 p4 kernel: [4299686.319000] usb usb4: unregistering interface 4-0:1.0
Apr 13 13:22:23 p4 kernel: [4299686.319000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.2/usb4/4-0:1.0'
Apr 13 13:22:23 p4 kernel: [4299686.319000] usb 4-0:1.0: hotplug
Apr 13 13:22:23 p4 kernel: [4299686.327000] kobject dmmidi1: cleaning up
Apr 13 13:22:23 p4 kernel: [4299686.327000] device class 'dmmidi1': release.
Apr 13 13:22:23 p4 kernel: [4299686.327000] CLASS: Unregistering class device. ID = 'midiC1D0'
Apr 13 13:22:23 p4 kernel: [4299686.327000] fill_kobj_path: path = '/class/sound/midiC1D0'
Apr 13 13:22:23 p4 kernel: [4299686.327000] class_hotplug - name = midiC1D0
Apr 13 13:22:23 p4 kernel: [4299686.327000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2'
Apr 13 13:22:23 p4 kernel: [4299686.335000] kobject 4-0:1.0: cleaning up
Apr 13 13:22:23 p4 kernel: [4299686.335000] usb usb4: unregistering device
Apr 13 13:22:23 p4 kernel: [4299686.335000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.2/usb4'
Apr 13 13:22:23 p4 kernel: [4299686.335000] usb usb4: hotplug
Apr 13 13:22:23 p4 kernel: [4299686.353000] kobject midiC1D0: cleaning up
Apr 13 13:22:23 p4 kernel: [4299686.353000] device class 'midiC1D0': release.
Apr 13 13:22:23 p4 kernel: [4299686.353000] CLASS: Unregistering class device. ID = 'hwC1D0'
Apr 13 13:22:23 p4 kernel: [4299686.353000] kobject 3-2: cleaning up
Apr 13 13:22:23 p4 kernel: [4299686.353000] kobject usb3: cleaning up
Apr 13 13:22:23 p4 kernel: [4299686.353000] kobject usb3: cleaning up
Apr 13 13:22:23 p4 kernel: [4299686.353000] device class 'usb3': release.

// usb3 is gone, but snd_card_free_in_thread() hasn't finished yet:
Apr 13 13:22:23 p4 kernel: [4299686.353000] fill_kobj_path: path = '/class/sound/hwC1D0'
Apr 13 13:22:23 p4 kernel: [4299686.353000] class_hotplug - name = hwC1D0
Apr 13 13:22:23 p4 kernel: [4299686.353000] Unable to handle kernel NULL pointer dereference at virtual address 00000000
Apr 13 13:22:23 p4 kernel: [4299686.353000]  printing eip:
Apr 13 13:22:23 p4 kernel: [4299686.353000] c01bd569
Apr 13 13:22:23 p4 kernel: [4299686.353000] *pde = 00000000
Apr 13 13:22:23 p4 kernel: [4299686.353000] Oops: 0000 [#1]
Apr 13 13:22:23 p4 kernel: [4299686.353000] PREEMPT 
Apr 13 13:22:23 p4 kernel: [4299686.353000] Modules linked in: uhci_hcd snd_usb_usx2y snd_seq snd_usb_lib snd_hwdep nfs nvidia agpgart realtime commoncap nfsd exportfs lockd md5 ipv6 autofs4 sunrpc video button ac ehci_hcd i2c_viapro i2c_core snd_via82xx snd_ac97_codec snd_pcm_oss snd_mixer_oss snd_pcm snd_timer snd_page_alloc snd_mpu401_uart snd_rawmidi snd_seq_device snd floppy ext3 jbd
Apr 13 13:22:23 p4 kernel: [4299686.353000] CPU:    0
Apr 13 13:22:23 p4 kernel: [4299686.353000] EIP:    0060:[<c01bd569>]    Tainted: P      VLI
Apr 13 13:22:23 p4 kernel: [4299686.353000] EFLAGS: 00010246   (2.6.12-rc2) 
Apr 13 13:22:23 p4 kernel: [4299686.353000] EIP is at get_kobj_path_length+0x19/0x30
Apr 13 13:22:23 p4 kernel: [4299686.353000] eax: 00000000   ebx: 00000000   ecx: ffffffff   edx: e12c7c88
Apr 13 13:22:23 p4 kernel: [4299686.353000] esi: 00000001   edi: 00000000   ebp: f7f09d44   esp: f7f09d38
Apr 13 13:22:23 p4 kernel: [4299686.353000] ds: 007b   es: 007b   ss: 0068
Apr 13 13:22:23 p4 kernel: [4299686.353000] Process events/0 (pid: 3, threadinfo=f7f08000 task=c18da020)
Apr 13 13:22:23 p4 kernel: [4299686.353000] Stack: c0345d40 e12c7c64 e8336418 f7f09d68 c01bd60a e12c7c88 e8336400 e8336418 
Apr 13 13:22:23 p4 kernel: [4299686.353000]        f7f09d68 c0345d40 e12c7c64 e8336418 f7f09dac c0229c19 e12c7c88 000000d0 
Apr 13 13:22:23 p4 kernel: [4299686.353000]        e8336e54 ffffffff fffffffd ffffffff c0345d40 e8336400 00000000 e8336e08 
Apr 13 13:22:23 p4 kernel: [4299686.353000] Call Trace:
Apr 13 13:22:23 p4 kernel: [4299686.353000]  [<c010402f>] show_stack+0x7f/0xa0
Apr 13 13:22:23 p4 kernel: [4299686.353000]  [<c01041ca>] show_registers+0x15a/0x1d0
Apr 13 13:22:23 p4 kernel: [4299686.353000]  [<c01043d0>] die+0xf0/0x180
Apr 13 13:22:23 p4 kernel: [4299686.353000]  [<c0115914>] do_page_fault+0x464/0x66a
Apr 13 13:22:23 p4 kernel: [4299686.353000]  [<c0103c4b>] error_code+0x4f/0x54
Apr 13 13:22:23 p4 kernel: [4299686.353000]  [<c01bd60a>] kobject_get_path+0x1a/0x70
Apr 13 13:22:23 p4 kernel: [4299686.353000]  [<c0229c19>] class_hotplug+0xa9/0x250
Apr 13 13:22:23 p4 kernel: [4299686.353000]  [<c01be40a>] kobject_hotplug+0x2ba/0x2e0
Apr 13 13:22:23 p4 kernel: [4299686.353000]  [<c01bd9ca>] kobject_del+0x1a/0x30
Apr 13 13:22:23 p4 kernel: [4299686.353000]  [<c022a1a1>] class_device_del+0xc1/0xd0
Apr 13 13:22:23 p4 kernel: [4299686.353000]  [<c022a1d5>] class_device_unregister+0x25/0x40
Apr 13 13:22:23 p4 kernel: [4299686.353000]  [<f885059f>] snd_unregister_device+0x7f/0xd0 [snd]
Apr 13 13:22:23 p4 kernel: [4299686.353000]  [<f8a39ac2>] snd_hwdep_dev_unregister+0x52/0xb0 [snd_hwdep]
Apr 13 13:22:23 p4 kernel: [4299686.353000]  [<f8855bb6>] snd_device_free+0xa6/0xc0 [snd]
Apr 13 13:22:23 p4 kernel: [4299686.353000]  [<f8855de4>] snd_device_free_all+0x54/0x70 [snd]
Apr 13 13:22:23 p4 kernel: [4299686.353000]  [<f8850d8d>] snd_card_free+0x9d/0x2b0 [snd]
Apr 13 13:22:23 p4 kernel: [4299686.353000]  [<f8850ff7>] snd_card_free_thread+0x57/0xd0 [snd]
Apr 13 13:22:23 p4 kernel: [4299686.353000]  [<c012c3ee>] worker_thread+0x1be/0x2a0
Apr 13 13:22:23 p4 kernel: [4299686.353000]  [<c0130a4c>] kthread+0x9c/0xd0
Apr 13 13:22:23 p4 kernel: [4299686.353000]  [<c0101365>] kernel_thread_helper+0x5/0x10
Apr 13 13:22:23 p4 kernel: [4299686.353000] Code: 89 34 24 e8 7a 29 fe ff eb dd 90 8d b4 26 00 00 00 00 55 89 e5 57 8b 55 08 56 be 01 00 00 00 53 31 db 8b 3a b9 ff ff ff ff 89 d8 <f2> ae f7 d1 49 8b 52 24 8d 74 31 01 85 d2 75 e7 5b 89 f0 5e 5f 

// keyboard (usb or ps/2, doesn't matter) stops working

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: usx2y-hot-unplug_snd_card_free --]
[-- Type: text/x-objcsrc; name=usx2y-hot-unplug_snd_card_free, Size: 13412 bytes --]

with snd_card_free, it's ok:
this is triggered by unplugging the usb cable while jackd was runnnig.
comments begin with //


// jackd starts streamin
Apr 14 20:12:10 p4 kernel: [4299805.544000] snd_usX2Y_pcm_trigger(START)
Apr 14 20:12:10 p4 kernel: [4299805.544000] snd_usX2Y_pcm_trigger(START)
Apr 14 20:12:10 p4 kernel: [4299805.546000] cap start 31

// after 10seconds the usb cable is unplugged
Apr 14 20:12:20 p4 kernel: [4299815.118000] ep=10 stalled with status=-84
Apr 14 20:12:20 p4 kernel: [4299815.118000] snd_usX2Y_pcm_trigger(STOP)
Apr 14 20:12:20 p4 kernel: [4299815.118000] snd_usX2Y_pcm_trigger(STOP)
Apr 14 20:12:20 p4 kernel: [4299815.118000] 0 status=0 start_frame=489
Apr 14 20:12:20 p4 kernel: [4299815.118000] 1 status=-115 start_frame=490
Apr 14 20:12:20 p4 kernel: [4299815.118000] 0 status=-115 start_frame=490
Apr 14 20:12:20 p4 kernel: [4299815.118000] 1 status=0 start_frame=489
Apr 14 20:12:20 p4 kernel: [4299815.118000] 0 status=-115 start_frame=490
Apr 14 20:12:20 p4 kernel: [4299815.118000] 1 status=0 start_frame=489
Apr 14 20:12:20 p4 kernel: [4299815.118000] 0 e4a19ac0 state=4
Apr 14 20:12:20 p4 kernel: [4299815.118000] 1 c8ebe8c0 state=4
Apr 14 20:12:20 p4 kernel: [4299815.118000] 3 e4a19c00 state=4
Apr 14 20:12:20 p4 kernel: [4299815.118000] snd_usX2Y_pcm_prepare(ed36b1c0)
Apr 14 20:12:20 p4 kernel: [4299815.118000] usX2Y_subs_prepare(c8ebe8c0) ep=8 urb0=e4d0a200 urb1=e4d0a180
Apr 14 20:12:20 p4 kernel: [4299815.118000] starting capture pipe for self
Apr 14 20:12:20 p4 kernel: [4299815.119000] hcd_frame=491 ep=8in status=-2 start_frame=490
Apr 14 20:12:20 p4 kernel: [4299815.119000] hcd_frame=491 ep=10out status=0 start_frame=490
Apr 14 20:12:20 p4 kernel: [4299815.119000] hcd_frame=491 ep=10in status=-84 start_frame=490
Apr 14 20:12:20 p4 kernel: [4299815.119000] 501
Apr 14 20:12:20 p4 kernel: [4299815.119000] 501
Apr 14 20:12:20 p4 kernel: [4299815.119000] 502
Apr 14 20:12:20 p4 kernel: [4299815.119000] 502
Apr 14 20:12:20 p4 kernel: [4299815.130000] ep=8 stalled with status=-84
Apr 14 20:12:20 p4 kernel: [4299815.130000] 0 status=0 start_frame=489
Apr 14 20:12:20 p4 kernel: [4299815.130000] 1 status=0 start_frame=490
Apr 14 20:12:20 p4 kernel: [4299815.130000] 0 status=0 start_frame=501
Apr 14 20:12:20 p4 kernel: [4299815.130000] 1 status=-115 start_frame=502
Apr 14 20:12:20 p4 kernel: [4299815.130000] 0 status=-84 start_frame=501
Apr 14 20:12:20 p4 kernel: [4299815.130000] 1 status=-115 start_frame=502
Apr 14 20:12:20 p4 kernel: [4299815.130000] 0 e4a19ac0 state=0
Apr 14 20:12:20 p4 kernel: [4299815.130000] 1 c8ebe8c0 state=4
Apr 14 20:12:20 p4 kernel: [4299815.130000] 3 e4a19c00 state=4
Apr 14 20:12:20 p4 kernel: [4299815.130000] hcd_frame=502 ep=10in status=-84 start_frame=501
Apr 14 20:12:20 p4 kernel: [4299815.130000] 0 status=0 start_frame=489
Apr 14 20:12:20 p4 kernel: [4299815.130000] 1 status=0 start_frame=490
Apr 14 20:12:20 p4 kernel: [4299815.130000] 0 status=0 start_frame=501
Apr 14 20:12:20 p4 kernel: [4299815.130000] 1 status=-115 start_frame=502
Apr 14 20:12:20 p4 kernel: [4299815.130000] 0 status=-84 start_frame=501
Apr 14 20:12:20 p4 kernel: [4299815.130000] 1 status=-115 start_frame=502
Apr 14 20:12:20 p4 kernel: [4299815.130000] 0 e4a19ac0 state=0
Apr 14 20:12:20 p4 kernel: [4299815.130000] 1 c8ebe8c0 state=0
Apr 14 20:12:20 p4 kernel: [4299815.130000] 3 e4a19c00 state=0
Apr 14 20:12:20 p4 kernel: [4299815.131000] hcd_frame=503 ep=8in status=-84 start_frame=502
Apr 14 20:12:20 p4 kernel: [4299815.131000] hcd_frame=503 ep=10in status=-84 start_frame=502
Apr 14 20:12:20 p4 kernel: [4299815.133000] snd_usX2Y_usbpcm_hw_free(ed36b340)
Apr 14 20:12:20 p4 kernel: [4299815.133000] snd_usX2Y_urbs_release() 10
Apr 14 20:12:20 p4 kernel: [4299815.133000] snd_usX2Y_urbs_release() 8
Apr 14 20:12:20 p4 kernel: [4299815.133000] snd_usX2Y_urbs_release() 10
Apr 14 20:12:20 p4 kernel: [4299815.133000] snd_usX2Y_usbpcm_hw_free(ed36b1c0)
Apr 14 20:12:20 p4 kernel: [4299815.133000] snd_usX2Y_urbs_release() 8
Apr 14 20:12:20 p4 kernel: [4299815.133000] snd_usX2Y_urbs_release() 10
Apr 14 20:12:20 p4 kernel: [4299815.828000] hub 3-0:1.0: state 5 ports 2 chg 0000 evt 0004
Apr 14 20:12:20 p4 kernel: [4299815.828000] uhci_hcd 0000:00:10.1: port 2 portsc 008a,00
Apr 14 20:12:20 p4 kernel: [4299815.828000] hub 3-0:1.0: port 2, status 0100, change 0003, 12 Mb/s
Apr 14 20:12:20 p4 kernel: [4299815.828000] usb 3-2: USB disconnect, address 2
Apr 14 20:12:20 p4 kernel: [4299815.828000] usb 3-2: usb_disable_device nuking all URBs
Apr 14 20:12:20 p4 kernel: [4299815.828000] usb 3-2: unregistering interface 3-2:1.0

// usX2Y_usb_disconnect() is called. I added this debugstatement only now, not in the other trace.
Apr 14 20:12:20 p4 kernel: [4299815.828000] usX2Y_usb_disconnect(e25ae400, ef741000)
Apr 14 20:12:20 p4 kernel: [4299815.828000] CLASS: Unregistering class device. ID = 'mixer1'
Apr 14 20:12:20 p4 kernel: [4299815.828000] fill_kobj_path: path = '/class/sound/mixer1'
Apr 14 20:12:20 p4 kernel: [4299815.828000] class_hotplug - name = mixer1
Apr 14 20:12:20 p4 kernel: [4299815.828000] kobject mixer1 @ e2c9e310: cleaning up
Apr 14 20:12:20 p4 kernel: [4299815.828000] device class 'mixer1': release.
Apr 14 20:12:20 p4 kernel: [4299815.828000] CLASS: Unregistering class device. ID = 'adsp1'
Apr 14 20:12:20 p4 kernel: [4299815.828000] fill_kobj_path: path = '/class/sound/adsp1'
Apr 14 20:12:20 p4 kernel: [4299815.828000] class_hotplug - name = adsp1
Apr 14 20:12:20 p4 kernel: [4299815.840000] kobject adsp1 @ e4ebef10: cleaning up
Apr 14 20:12:20 p4 kernel: [4299815.840000] device class 'adsp1': release.
Apr 14 20:12:20 p4 kernel: [4299815.840000] CLASS: Unregistering class device. ID = 'dsp1'
Apr 14 20:12:20 p4 kernel: [4299815.840000] fill_kobj_path: path = '/class/sound/dsp1'
Apr 14 20:12:20 p4 kernel: [4299815.840000] class_hotplug - name = dsp1
Apr 14 20:12:20 p4 kernel: [4299815.852000] kobject dsp1 @ e2dcdb10: cleaning up
Apr 14 20:12:20 p4 kernel: [4299815.852000] device class 'dsp1': release.
Apr 14 20:12:21 p4 kernel: [4299815.852000] CLASS: Unregistering class device. ID = 'audio1'
Apr 14 20:12:21 p4 kernel: [4299815.852000] fill_kobj_path: path = '/class/sound/audio1'
Apr 14 20:12:21 p4 kernel: [4299815.852000] class_hotplug - name = audio1
Apr 14 20:12:21 p4 kernel: [4299815.863000] kobject audio1 @ e2dcda90: cleaning up
Apr 14 20:12:21 p4 kernel: [4299815.863000] device class 'audio1': release.
Apr 14 20:12:21 p4 kernel: [4299815.863000] CLASS: Unregistering class device. ID = 'controlC1'
Apr 14 20:12:21 p4 kernel: [4299815.863000] fill_kobj_path: path = '/class/sound/controlC1'
Apr 14 20:12:21 p4 kernel: [4299815.863000] class_hotplug - name = controlC1
Apr 14 20:12:21 p4 kernel: [4299815.863000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2'
Apr 14 20:12:21 p4 kernel: [4299815.876000] kobject controlC1 @ e2c9e810: cleaning up
Apr 14 20:12:21 p4 kernel: [4299815.876000] device class 'controlC1': release.
Apr 14 20:12:21 p4 kernel: [4299815.876000] CLASS: Unregistering class device. ID = 'pcmC1D2p'
Apr 14 20:12:21 p4 kernel: [4299815.876000] fill_kobj_path: path = '/class/sound/pcmC1D2p'
Apr 14 20:12:21 p4 kernel: [4299815.876000] class_hotplug - name = pcmC1D2p
Apr 14 20:12:21 p4 kernel: [4299815.876000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2'
Apr 14 20:12:21 p4 kernel: [4299815.887000] kobject pcmC1D2p @ ec9f1d90: cleaning up
Apr 14 20:12:21 p4 kernel: [4299815.887000] device class 'pcmC1D2p': release.
Apr 14 20:12:21 p4 kernel: [4299815.887000] CLASS: Unregistering class device. ID = 'pcmC1D2c'
Apr 14 20:12:21 p4 kernel: [4299815.887000] fill_kobj_path: path = '/class/sound/pcmC1D2c'
Apr 14 20:12:21 p4 kernel: [4299815.887000] class_hotplug - name = pcmC1D2c
Apr 14 20:12:21 p4 kernel: [4299815.887000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2'
Apr 14 20:12:21 p4 kernel: [4299815.899000] kobject pcmC1D2c @ e4d0ac90: cleaning up
Apr 14 20:12:21 p4 kernel: [4299815.899000] device class 'pcmC1D2c': release.
Apr 14 20:12:21 p4 kernel: [4299815.900000] CLASS: Unregistering class device. ID = 'hwC1D1'
Apr 14 20:12:21 p4 kernel: [4299815.900000] fill_kobj_path: path = '/class/sound/hwC1D1'
Apr 14 20:12:21 p4 kernel: [4299815.900000] class_hotplug - name = hwC1D1
Apr 14 20:12:21 p4 kernel: [4299815.900000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2'
Apr 14 20:12:21 p4 kernel: [4299815.911000] kobject hwC1D1 @ e4ebed90: cleaning up
Apr 14 20:12:21 p4 kernel: [4299815.911000] device class 'hwC1D1': release.
Apr 14 20:12:21 p4 kernel: [4299815.911000] CLASS: Unregistering class device. ID = 'pcmC1D1c'
Apr 14 20:12:21 p4 kernel: [4299815.911000] fill_kobj_path: path = '/class/sound/pcmC1D1c'
Apr 14 20:12:21 p4 kernel: [4299815.911000] class_hotplug - name = pcmC1D1c
Apr 14 20:12:21 p4 kernel: [4299815.911000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2'
Apr 14 20:12:21 p4 kernel: [4299815.923000] kobject pcmC1D1c @ e4ebef90: cleaning up
Apr 14 20:12:21 p4 kernel: [4299815.923000] device class 'pcmC1D1c': release.
Apr 14 20:12:21 p4 kernel: [4299815.923000] CLASS: Unregistering class device. ID = 'pcmC1D0p'
Apr 14 20:12:21 p4 kernel: [4299815.923000] fill_kobj_path: path = '/class/sound/pcmC1D0p'
Apr 14 20:12:21 p4 kernel: [4299815.923000] class_hotplug - name = pcmC1D0p
Apr 14 20:12:21 p4 kernel: [4299815.923000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2'
Apr 14 20:12:21 p4 kernel: [4299815.936000] kobject pcmC1D0p @ e2dcdc10: cleaning up
Apr 14 20:12:21 p4 kernel: [4299815.936000] device class 'pcmC1D0p': release.
Apr 14 20:12:21 p4 kernel: [4299815.936000] CLASS: Unregistering class device. ID = 'pcmC1D0c'
Apr 14 20:12:21 p4 kernel: [4299815.936000] fill_kobj_path: path = '/class/sound/pcmC1D0c'
Apr 14 20:12:21 p4 kernel: [4299815.936000] class_hotplug - name = pcmC1D0c
Apr 14 20:12:21 p4 kernel: [4299815.936000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2'
Apr 14 20:12:21 p4 kernel: [4299815.959000] kobject pcmC1D0c @ e2dcdb90: cleaning up
Apr 14 20:12:21 p4 kernel: [4299815.959000] device class 'pcmC1D0c': release.
Apr 14 20:12:21 p4 kernel: [4299815.959000] CLASS: Unregistering class device. ID = 'midi1'
Apr 14 20:12:21 p4 kernel: [4299815.959000] fill_kobj_path: path = '/class/sound/midi1'
Apr 14 20:12:21 p4 kernel: [4299815.959000] class_hotplug - name = midi1
Apr 14 20:12:21 p4 kernel: [4299815.959000] kobject midi1 @ f79e0210: cleaning up
Apr 14 20:12:21 p4 kernel: [4299815.959000] device class 'midi1': release.
Apr 14 20:12:21 p4 kernel: [4299815.959000] CLASS: Unregistering class device. ID = 'dmmidi1'
Apr 14 20:12:21 p4 kernel: [4299815.959000] fill_kobj_path: path = '/class/sound/dmmidi1'
Apr 14 20:12:21 p4 kernel: [4299815.959000] class_hotplug - name = dmmidi1
Apr 14 20:12:21 p4 kernel: [4299815.969000] kobject dmmidi1 @ f79e0390: cleaning up
Apr 14 20:12:21 p4 kernel: [4299815.969000] device class 'dmmidi1': release.
Apr 14 20:12:21 p4 kernel: [4299815.969000] CLASS: Unregistering class device. ID = 'midiC1D0'
Apr 14 20:12:21 p4 kernel: [4299815.969000] fill_kobj_path: path = '/class/sound/midiC1D0'
Apr 14 20:12:21 p4 kernel: [4299815.969000] class_hotplug - name = midiC1D0
Apr 14 20:12:21 p4 kernel: [4299815.969000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2'
Apr 14 20:12:21 p4 kernel: [4299815.983000] kobject midiC1D0 @ f79e0190: cleaning up
Apr 14 20:12:21 p4 kernel: [4299815.983000] device class 'midiC1D0': release.
Apr 14 20:12:21 p4 kernel: [4299815.983000] CLASS: Unregistering class device. ID = 'hwC1D0'
Apr 14 20:12:21 p4 kernel: [4299815.983000] fill_kobj_path: path = '/class/sound/hwC1D0'
Apr 14 20:12:21 p4 kernel: [4299815.983000] class_hotplug - name = hwC1D0
Apr 14 20:12:21 p4 kernel: [4299815.983000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2'
Apr 14 20:12:21 p4 kernel: [4299815.992000] kobject hwC1D0 @ e2c9e890: cleaning up
Apr 14 20:12:21 p4 kernel: [4299815.992000] device class 'hwC1D0': release.
// snd_card_free() has finished.
// now hotplug continues cleaning up usb3:
Apr 14 20:12:21 p4 kernel: [4299815.992000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2/3-2:1.0'
Apr 14 20:12:21 p4 kernel: [4299815.992000] usb 3-2:1.0: hotplug
Apr 14 20:12:21 p4 kernel: [4299816.001000] kobject 3-2:1.0 @ f7940078: cleaning up
Apr 14 20:12:21 p4 kernel: [4299816.001000] usb 3-2: unregistering device
Apr 14 20:12:21 p4 kernel: [4299816.002000] fill_kobj_path: path = '/devices/pci0000:00/0000:00:10.1/usb3/3-2'
Apr 14 20:12:21 p4 kernel: [4299816.002000] usb 3-2: hotplug
Apr 14 20:12:21 p4 kernel: [4299816.033000] kobject 3-2 @ e25ae488: cleaning up
Apr 14 20:12:21 p4 kernel: [4299816.137000] hub 3-0:1.0: debounce: port 2: total 100ms stable 100ms status 0x100
Apr 14 20:12:21 p4 kernel: [4299816.137000] hub 1-0:1.0: state 5 ports 8 chg 0000 evt 0010
Apr 14 20:12:21 p4 kernel: [4299816.137000] ehci_hcd 0000:00:10.4: GetStatus port 4 status 001002 POWER sig=se0  CSC
Apr 14 20:12:21 p4 kernel: [4299816.137000] hub 1-0:1.0: port 4, status 0100, change 0001, 12 Mb/s
Apr 14 20:12:21 p4 kernel: [4299816.241000] hub 1-0:1.0: debounce: port 4: total 100ms stable 100ms status 0x100
Apr 14 20:12:21 p4 kernel: [4299816.713000] uhci_hcd 0000:00:10.1: suspend_hc

// everything still ok. no oops, keyboard workin.

^ permalink raw reply	[flat|nested] 22+ messages in thread
* [PATCH]usx2y: prevent oops & dead keyboard on hot usb unplugging
@ 2005-04-14 18:59 karsten wiese
  2005-04-14 22:25 ` Lee Revell
  2005-04-15  7:07 ` Clemens Ladisch
  0 siblings, 2 replies; 22+ messages in thread
From: karsten wiese @ 2005-04-14 18:59 UTC (permalink / raw)
  To: Takashi Iwai, Clemens Ladisch; +Cc: Devel Alsa

[-- Attachment #1: Type: text/plain, Size: 1016 bytes --]

Hi Clemens & Takashi

Please commit the patch.
Btw, snd-usb-audio could use the same treatment.
Whats the use of:
	chip->num_interfaces--;
	if (chip->num_interfaces <= 0) {
in snd_usb_audio_disconnect() ?
is snd_usb_audio_disconnect() called for each usb
interface?

best regards,
Karsten
-----------------------------------------------------------
Header:
snd-usb-usx2y: prevent oops & dead keyboard on usb
unplugging while the device is being used

Description:
Without this patch, some usb kobjects, which are parents to
the usx2y's kobjects can be freed before the usx2y's.
This led to an oops in get_kobj_path_length() and a dead
keyboard, when the usx2y's kobjects were freed.
The patch ensures the correct sequence.
Tested ok on kernel 2.6.12-rc2.

Signed-of-by: Karsten Wiese <annabellesgarden@yahoo.de>


	

	
		
___________________________________________________________ 
Gesendet von Yahoo! Mail - Jetzt mit 250MB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: usbusx2y.c_1.10_patch --]
[-- Type: text/x-diff; name="usbusx2y.c_1.10_patch", Size: 1572 bytes --]

Index: usbusx2y.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/usb/usx2y/usbusx2y.c,v
retrieving revision 1.9
diff -c -r1.9 usbusx2y.c
--- usbusx2y.c	28 Jan 2005 10:21:48 -0000	1.9
+++ usbusx2y.c	14 Apr 2005 18:27:29 -0000
@@ -1,6 +1,11 @@
 /*
  * usbusy2y.c - ALSA USB US-428 Driver
  *
+2005-04-14 Karsten Wiese
+	Version 0.8.7.2:
+	Call snd_card_free() instead of snd_card_free_in_thread() to prevent oops with dead keyboard symptom.
+	Tested ok with kernel 2.6.12-rc2.
+
 2004-12-14 Karsten Wiese
 	Version 0.8.7.1:
 	snd_pcm_open for rawusb pcm-devices now returns -EBUSY if called without rawusb's hwdep device being open.
@@ -143,7 +148,7 @@
 
 
 MODULE_AUTHOR("Karsten Wiese <annabellesgarden@yahoo.de>");
-MODULE_DESCRIPTION("TASCAM "NAME_ALLCAPS" Version 0.8.7.1");
+MODULE_DESCRIPTION("TASCAM "NAME_ALLCAPS" Version 0.8.7.2");
 MODULE_LICENSE("GPL");
 MODULE_SUPPORTED_DEVICE("{{TASCAM(0x1604), "NAME_ALLCAPS"(0x8001)(0x8005)(0x8007) }}");
 
@@ -430,8 +435,6 @@
 	if (ptr) {
 		usX2Ydev_t* usX2Y = usX2Y((snd_card_t*)ptr);
 		struct list_head* p;
-		if (usX2Y->chip_status == USX2Y_STAT_CHIP_HUP)	// on 2.6.1 kernel snd_usbmidi_disconnect()
-			return;					// calls us back. better leave :-) .
 		usX2Y->chip.shutdown = 1;
 		usX2Y->chip_status = USX2Y_STAT_CHIP_HUP;
 		usX2Y_unlinkSeq(&usX2Y->AS04);
@@ -443,7 +446,7 @@
 		}
 		if (usX2Y->us428ctls_sharedmem) 
 			wake_up(&usX2Y->us428ctls_wait_queue_head);
-		snd_card_free_in_thread((snd_card_t*)ptr);
+		snd_card_free((snd_card_t*)ptr);
 	}
 }
 

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2005-04-20  9:17 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-19 21:22 [PATCH]usx2y: prevent oops & dead keyboard on hot usb unplugging karsten wiese
2005-04-20  9:17 ` Takashi Iwai
  -- strict thread matches above, loose matches on Subject: below --
2005-04-19 22:14 karsten wiese
2005-04-16  0:31 karsten wiese
2005-04-19  9:23 ` Takashi Iwai
2005-04-19 14:27   ` Clemens Ladisch
2005-04-19  9:32 ` Takashi Iwai
2005-04-15 15:15 karsten wiese
2005-04-15 15:14 karsten wiese
2005-04-15 15:22 ` Takashi Iwai
2005-04-15 15:45   ` karsten wiese
2005-04-15 15:50     ` Takashi Iwai
2005-04-15 16:25       ` Clemens Ladisch
2005-04-15 15:32 ` Clemens Ladisch
2005-04-15 14:28 karsten wiese
2005-04-15 14:36 ` Takashi Iwai
2005-04-15 13:59 karsten wiese
2005-04-15 14:16 ` Takashi Iwai
2005-04-15 13:31 karsten wiese
2005-04-14 18:59 karsten wiese
2005-04-14 22:25 ` Lee Revell
2005-04-15  7:07 ` Clemens Ladisch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.