Bug 6182

Summary: Unplug of USB sound card while in use causes oops
Product: Drivers Reporter: Pavel Machek (pavel)
Component: Sound(ALSA)Assignee: Jaroslav Kysela (perex)
Status: CLOSED CODE_FIX    
Severity: normal CC: greg, tiwai
Priority: P2    
Hardware: i386   
OS: Linux   
Kernel Version: 2.6.16-rc5-git Subsystem:
Regression: --- Bisected commit-id:
Bug Depends on:    
Bug Blocks: 5089    

Description Pavel Machek 2006-03-07 11:49:48 UTC
Hardware Environment: i386

Steps to reproduce:

Plug in usb sound card.

root@amd:/home/pavel# cat /proc/asound/cards
 0 [I82801DBICH4   ]: ICH4 - Intel 82801DB-ICH4
                      Intel 82801DB-ICH4 with AD1981B at 0xc0000c00, irq 5
 1 [U0x4fa0x4201   ]: USB-Audio - USB Device 0x4fa:0x4201
                      USB Device 0x4fa:0x4201 at usb-0000:00:1d.1-1, full speed
root@amd:/home/pavel#

...launch something to play on the soundcard. mpg123 -D /dev/dsp1 does that
fine. (I don't hear anything from the speaker, but I guess that's separate problem).

root@amd:/home/pavel# cat /proc/asound/card1/stream0
USB Device 0x4fa:0x4201 at usb-0000:00:1d.1-1, full speed : USB Audio

Playback:
  Status: Running
    Interface = 1
    Altset = 4
    URBs = 8 [ 4 4 4 4 4 4 4 4 ]
    Packet Size = 49
    Momentary freq = 48004 Hz (0x30.0100)
  Interface 1
    Altset 1
    Format: S16_LE
    Channels: 2
    Endpoint: 1 OUT (ASYNC)
    Rates: 44100, 48000
  Interface 1
    Altset 2
    Format: S16_LE
    Channels: 1
    Endpoint: 1 OUT (ASYNC)
    Rates: 44100, 48000
  Interface 1
    Altset 3
    Format: S8
    Channels: 2
    Endpoint: 1 OUT (ASYNC)
    Rates: 44100, 48000
  Interface 1
    Altset 4
    Format: S8
    Channels: 1
    Endpoint: 1 OUT (ASYNC)
    Rates: 44100, 48000
  Interface 1
    Altset 5
    Format: S16_LE
    Channels: 2
    Endpoint: 1 OUT (ADAPTIVE)
    Rates: 44100, 48000
root@amd:/home/pavel#

Now unplug USB without stopping sound...
Comment 1 Pavel Machek 2006-03-07 11:53:05 UTC
remove_proc_entry: asound/card1 busy, count=1
Unable to handle kernel paging request at virtual address 6b6b6c6b
 printing eip:
c016c3a5
*pde = 00000000
ipw2200: Firmware error detected.  Restarting.
ipw2200: Sysfs 'error' log already exists.
BUG: soft lockup detected on CPU#0!

Pid: 2131, comm:               mpg123
EIP: 0060:[<c0112024>] CPU: 0
EIP is at delay_pmtmr+0x14/0x20
 EFLAGS: 00000293    Not tainted  (2.6.16-rc5-g8189a9ba-dirty #233)
EAX: 1e828398 EBX: 001b4437 ECX: 1e757d80 EDX: 00000ac3
ESI: 00000000 EDI: 00030001 EBP: f7582810 DS: 007b ES: 007b
CR0: 8005003b CR2: 6b6b6c6b CR3: 3480f000 CR4: 00000690
 [<c0269859>] __delay+0x9/0x10
 [<c011e19b>] do_page_fault+0x2fb/0x5d8
 [<c011dea0>] do_page_fault+0x0/0x5d8
 [<c0103c6b>] error_code+0x4f/0x54
 [<c04b007b>] snd_pcm_oss_change_params+0xdb/0xb90
 [<c016c3a5>] __fput+0xc5/0x190
 [<c0169417>] filp_close+0x47/0x90
 [<c0103169>] syscall_call+0x7/0xb
Oops: 0002 [#1]
PREEMPT SMP
Modules linked in: ipw2200
CPU:    0
EIP:    0060:[<c016c3a5>]    Not tainted VLI
EFLAGS: 00010246   (2.6.16-rc5-g8189a9ba-dirty #233)
EIP is at __fput+0xc5/0x190
eax: 6b6b6c6b   ebx: 6b6b6b6b   ecx: 00000001   edx: f4fb2000
esi: f74fb800   edi: f5ac19a8   ebp: f481baf0   esp: f4fb3f8c
ds: 007b   es: 007b   ss: 0068
Process mpg123 (pid: 2131, threadinfo=f4fb2000 task=f7c58540)
Stack: <0>00000000 c1cf2be0 f74fb800 00000000 f7cac180 f4fb2000 c0169417 00000003
       00000003 08056c28 ffffffff c0103169 00000003 00000000 b7ef7ff4 08056c28
       ffffffff bfd6b2a0 00000006 0000007b c010007b 00000006 b7e86707 00000073
Call Trace:
 [<c0169417>] filp_close+0x47/0x90
 [<c0103169>] syscall_call+0x7/0xb
Code: 85 a9 00 00 00 8b 46 10 85 c0 74 42 8b 18 85 db 74 3c b8 01 00 00 00 e8 7a
39 fb ff e8 35 e3 0f 00 c1 e0 07 8d 84 18 00 01 00 00 <ff> 08 83 3b 02 0f 84 a5
00 00 00 b8 01 00 00 00 e8 96 39 fb ff
 <6>note: mpg123[2131] exited with preempt_count 1

Oops on unplug. Fortunately it does not kill the system. It is not a recent
regression (I only started to play with this card few weeks ago). But I think I
can reproduce it with another usb sound card...
Comment 2 Pavel Machek 2006-03-07 11:54:53 UTC
Ouch and don't worry about those softwatchdog messages, I added mdelay() to
oops-printing code. .. and hardware is thinkpad x32 -- nothing too unusual.
Comment 3 Pavel Machek 2006-05-19 03:05:59 UTC
I could not reproduce the problem on 2.6.17-rc4, so I assume it is gone.