View previous topic :: View next topic |
Author |
Message |
Koxta Retired Dev
Joined: 19 Mar 2004 Posts: 204 Location: Warszawa
|
Posted: Sat Apr 10, 2004 10:53 pm Post subject: Removing Bluetooth Dongle Causing Kernel OOPS! [SOLVED] |
|
|
Hello everyone!
The kernel oopses when I remove the USB Bluetooth Dongle (it's MSI pc2pc bluetooth dongle) I've tested this on gentoo's 2.6.3-r1, 2.6.5 and slackware - vanilla 2.6.5.
Here are the steps I take.
1. Booting up the system
The system boots without any errors.
Code: | koxta@limbo koxta $ lsmod
Module Size Used by
ds 14980 4
snd_intel8x0 30724 0
snd_ac97_codec 61828 1 snd_intel8x0
snd_pcm 88224 1 snd_intel8x0
snd_page_alloc 9860 2 snd_intel8x0,snd_pcm
snd_mpu401_uart 7424 1 snd_intel8x0
snd_rawmidi 21536 1 snd_mpu401_uart
yenta_socket 15488 0
pcmcia_core 57924 2 ds,yenta_socket
snd_seq 54928 0
snd_timer 23684 2 snd_pcm,snd_seq
snd_seq_device 7560 2 snd_rawmidi,snd_seq
snd 49124 8 snd_intel8x0,snd_ac97_codec,snd_pcm,snd_mpu401_uart,snd_rawmidi,snd_seq,snd_timer,snd_seq_device
ide_tape 35664 0 |
2. Plugging in the dongle
Code: | koxta@limbo koxta $ lsmod
Module Size Used by
hci_usb 14208 0 <--
bluetooth 47076 1 hci_usb <--
ds 14980 4
snd_intel8x0 30724 0
snd_ac97_codec 61828 1 snd_intel8x0
snd_pcm 88224 1 snd_intel8x0
snd_page_alloc 9860 2 snd_intel8x0,snd_pcm
snd_mpu401_uart 7424 1 snd_intel8x0
snd_rawmidi 21536 1 snd_mpu401_uart
yenta_socket 15488 0
pcmcia_core 57924 2 ds,yenta_socket
snd_seq 54928 0
snd_timer 23684 2 snd_pcm,snd_seq
snd_seq_device 7560 2 snd_rawmidi,snd_seq
snd 49124 8 snd_intel8x0,snd_ac97_codec,snd_pcm,snd_mpu401_uart,snd_rawmidi,snd_seq,snd_timer,snd_seq_device
ide_tape 35664 0 |
At this stage I can plug the dongle out without any side effects.
3. Running /etc/init.d/bluetooth start
This runs two services:
Code: | limbo root # ps auxww
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
[...]
root 4923 0.0 0.2 1496 524 ? S 00:34 0:00 hcid: processing events
root 4927 0.0 0.2 1520 496 ? S 00:34 0:00 /usr/sbin/sdpd
[...]
|
At this stage I can plug the dongle out without any side effects.
4. Connecting to the remote bluetooth device
Now I want to connect to ie. my mobile phone:
Code: | limbo root # rfcomm connect /dev/rfcomm0 & |
This causes new modules to load:
Code: | limbo root # lsmod
Module Size Used by
rfcomm 36504 0 <--
l2cap 23936 5 rfcomm <--
hci_usb 14208 2 <--
bluetooth 47076 7 rfcomm,l2cap,hci_usb
ds 14980 4
snd_intel8x0 30724 0
snd_ac97_codec 61828 1 snd_intel8x0
snd_pcm 88224 1 snd_intel8x0
snd_page_alloc 9860 2 snd_intel8x0,snd_pcm
snd_mpu401_uart 7424 1 snd_intel8x0
snd_rawmidi 21536 1 snd_mpu401_uart
yenta_socket 15488 0
pcmcia_core 57924 2 ds,yenta_socket
snd_seq 54928 0
snd_timer 23684 2 snd_pcm,snd_seq
snd_seq_device 7560 2 snd_rawmidi,snd_seq
snd 49124 8 snd_intel8x0,snd_ac97_codec,snd_pcm,snd_mpu401_uart,snd_rawmidi,snd_seq,snd_timer,snd_seq_device
ide_tape 35664 0 |
From now on, removing the dongle freezes the system:
Code: | Unable to handle kernel NULL pointer dereference at virtual address 00000004
*pde = 00000000
Oops: 0002 [#1]
PREEMPT SMP
CPU: 0
EIP: 0060:[<c02d0df4>] Not tainted
EFLAGS: 00010046 (2.6.5-gentoo)
EIP is at urb_unlink+0x3e/0xa5
eax: cded2ba0 ebx: 00000000 ecx: cc980000 edx: 00000000
esi: 00000246 edi: cded2b94 ebp: cec62614 esp: cc981e0c
ds: 007b es: 007b ss: 0068
Process hotplug (pid: 4613, threadinfo=cc98000000 task=cc935310)
Stack: cded2b94 cec62400 cc981edc cded2b94 cc981edc cded2b94 c02d164c cded2b94
cec62400 cc980000 cec62400 c02e2918 cec62400 cded2b94 cc981edc cec62610
cc981edc cec625e4 cec625e4 cec62400 cc981edc c02e2b8c cec62400 cc981edc
Call Trace:
[<c02d164c>] usb_hcd_giveback_urb+0x1b/0x39
[<c02e2918>] uhci_finish_completion+0x80/+xed
[<c02e2b8c>] uhci_irq+0x13f/0x11b
[<c02d16a0>] usb_hcd_irq+0x36/0x67
[<c010b5fe>] handle_IRQ_event+0x3a/0x64
[<c010b9b1>] do_IRQ+0xb8/0x192
[<c011ab03>] do_page_fault+0x0/0x512
[<c0109d6c>] common_interrupt+0x18
[<c011ab03>] do_page_fault+0x0/0x512
[<c014007b>] filemap_getpage+0x4/0x16a
[<c011ab2a>] do_page_fault+0x27/0x512
[<c014f544>] do_mmap_pgoff+0x381/0x6a2
[<c015b72e>] flip_close+0x59/0x86
[<c015b7ca>] sys_close+0x6f/0xaf
[<c011ab03>] do_page_fault+0x0/0x512
[<c0109e89>] error_code+0x2d/0x38
Code: 89 5a 04 89 40 04 89 47 0c 8b 5f 18 c6 05 fc 65 41 c0
<0> Kernel panic: Fatal exception in interrupt
In interrupt handler - not syncing |
And that's all, I suppose. If anybody knows how to fix this, please, reply. I'd really appreciate any help.
Cheers,
Code: | Jurek 'Koxta' Bartuszek |
Last edited by Koxta on Sat Jul 24, 2004 12:21 pm; edited 1 time in total |
|
Back to top |
|
|
motaboy Retired Dev
Joined: 15 Dec 2003 Posts: 1483
|
Posted: Sun Apr 11, 2004 1:26 am Post subject: |
|
|
DON'T WORRY, Thanks to Alan Stern and all the usb people (and my report ) we've finally found the solution.
This is in the last Marcel Holtmann patch (www.bluez.org) or you can use this (probably you have to apply it by hand, but they are only few lines)
Code: |
===== drivers/bluetooth/hci_usb.c 1.42 vs edited =====
--- 1.42/drivers/bluetooth/hci_usb.c Tue Mar 30 17:57:21 2004
+++ edited/drivers/bluetooth/hci_usb.c Thu Apr 8 13:41:28 2004
@@ -341,6 +341,14 @@
return 0;
}
+static void inline wait_for_urb(struct urb *urb)
+{
+ while (atomic_read(&urb->count) > 1) {
+ current->state = TASK_UNINTERRUPTIBLE;
+ schedule_timeout((5 * HZ + 999) / 1000);
+ }
+}
+
static void hci_usb_unlink_urbs(struct hci_usb *husb)
{
int i;
@@ -357,6 +365,7 @@
BT_DBG("%s unlinking _urb %p type %d urb %p",
husb->hdev->name, _urb, _urb->type, urb);
usb_unlink_urb(urb);
+ wait_for_urb(urb);
_urb_queue_tail(__completed_q(husb, _urb->type), _urb);
}
|
Let me know!
Bye! _________________ ... |
|
Back to top |
|
|
frameRATE Guru
Joined: 28 Apr 2003 Posts: 386 Location: Orange County California
|
|
Back to top |
|
|
Koxta Retired Dev
Joined: 19 Mar 2004 Posts: 204 Location: Warszawa
|
Posted: Sun Apr 11, 2004 1:05 pm Post subject: |
|
|
Yup! It's working now The kernel doesn't oops anymore
Was the patch already sent to the kernel ,,authorities'', and is the issue already fixed in the 2.6.6-pre tree ? If not, how about including this patch into the gentoo's portage ?
And one more thing. How to force linux to unload the bluetooth related modules when plugging out the dongle _or_ stopping the /etc/init.d/bluetooth service ?
Regards and many thanks for helping me =)
Jurek 'Koxta' Bartuszek |
|
Back to top |
|
|
motaboy Retired Dev
Joined: 15 Dec 2003 Posts: 1483
|
Posted: Sun Apr 11, 2004 3:08 pm Post subject: |
|
|
The pacth is now in the bluetooth 2.6.5 patch on www.bluez.org. So I think that it'll be sent soon to Linus by Mercel holtmann when 2.6.6-rc1 will be out.
I've heard the the automatic module unloading doesn't work quite well today. For this reason i think that you have to force it using "rmmod hci_usb" and put it in a hotplug script (for the module unplug) and in the bluetooth rc script for the service stop.
Bye! _________________ ... |
|
Back to top |
|
|
Koxta Retired Dev
Joined: 19 Mar 2004 Posts: 204 Location: Warszawa
|
Posted: Sun Apr 11, 2004 4:39 pm Post subject: |
|
|
I see! Anyway - the most important thing right now is that unplugging the dongle doesn't oops the kernel .
Once again - many thanks for your help
Regards,
Jurek 'Koxta' Bartuszek |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|