panic when unplugging a mounted usb camera

2003-08-23 Thread Stuart Walsh
Hi,

A somewhat annoying occurance in -current; I get a panic if I leave the
camera device mounted when I unplug it and subsequently try to unmount
the device or reboot the system.  I did some digging and it seems the
dacleanup() function isnt being called because periph-refcount is 1.  I
spoke to another person who uses the da driver for their camera and
their's cleans up fine when mounted.

Aug 23 21:15:29 icecold kernel: umass0: Fuji Photo Film USB Mass
Storage, rev 1.10/10.00, addr 2 
Aug 23 21:15:29 icecold kernel: da0 at umass-sim0 bus 0 target 0 lun 0 
Aug 23 21:15:29 icecold kernel: da0: FUJIFILM USB-DRIVEUNIT 1.00 
Removable Direct Access SCSI-0 device 
Aug 23 21:15:29 icecold kernel: da0: 1.000MB/s transfers 
Aug 23 21:15:29 icecold kernel: da0: 31MB (64000 512 byte sectors: 
64H 32S/T 31C)

Thats the camera, for reference.

Aug 23 21:15:31 icecold kernel: umass0: at uhub1 port 2 (addr 2)
disconnected
Aug 23 21:15:31 icecold kernel: invalidate called...
Aug 23 21:15:31 icecold kernel: (da0:umass-sim0:0:0:0): lost device
Aug 23 21:15:31 icecold kernel: returned from inval
Aug 23 21:15:31 icecold kernel: refcount is 0, freeing
Aug 23 21:15:31 icecold kernel: periph not null, calling..0xc0159bd0
Aug 23 21:15:31 icecold kernel: we got to dacleanup..
Aug 23 21:15:31 icecold kernel: (da0:umass-sim0:0:0:0): removing device
entr

Thats what I get when I remove the device and it is unmounted(with my
debugging additions).

Aug 23 21:16:12 icecold kernel: umass0: at uhub1 port 2 (addr 2)
disconnected
Aug 23 21:16:12 icecold kernel: invalidate called...
Aug 23 21:16:12 icecold kernel: (da0:umass-sim0:0:0:0): lost device
Aug 23 21:16:12 icecold kernel: returned from inval
Aug 23 21:16:12 icecold kernel: refcount is 1


Thats what I get when I remove the device and it is mounted.

Please do let me know if I can provide any further information.

Regards,

Stuart Walsh
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: panic when removing umass device (USB Camera)

2002-11-14 Thread Nate Lawson
On Thu, 14 Nov 2002, Kutulu wrote:
 I have an HP digital camera w/ CompactFlash that acts as a USB mass-storage
 device that's panic'ing my system when I remove it.
 
 If I do not load the umass driver, then the camera is detected as a simple
 generic ugen0 device, and I can safely add/remove the device at will.  If I
 load the umass driver, the camera is correctly detected as a mass-storage
 device as such:
 
 umass0: HP USB DIGITAL CAMERA, rev 1.10/1.00, addr4
 umass0: Residue incorrect, was 0, should've been 252
 umass0: Residue incorrect, was 0, should've been 252
 umass0: Residue incorrect, was 0, should've been 252
 umass0: Residue incorrect, was 0, should've been 252
 umass0: Residue incorrect, was 0, should've been 252
 da0 at umass-sim0 bus 0 target 0 lun 0
 da0: HP USB CAMERA 1.00 Removeable Direct Access SCSI-0 device
 da0: 1.000 MB/s transfers
 da0: 30 MB (62657 512 byte sectors: 64H 32S/T 30C)
 
 At this point, if I detach the camera (or, if the camera puts itself to
 sleep as it will do after 5 minutes of inactivity), I get the following
 errors:
 
 umass0: BBB reset failed, IOERROR
 umass0: BBB bulk-in clear stall failed, IOERROR
 umass0: BBB bulk-out clear stall failed, IOERROR
 (these are repeated 4 more times...)
 umass0: at uhub1 port 4 (addr 4) disconnected
 (da0: umass-sim0:0:0:)): lost device
 umass0: detached

Try this patch for the BBB stall:

Index: /sys/cam/scsi/scsi_da.c
===
RCS file: /home/ncvs/src/sys/cam/scsi/scsi_da.c,v
retrieving revision 1.113
diff -u -r1.113 scsi_da.c
--- /sys/cam/scsi/scsi_da.c 17 Oct 2002 18:04:41 -  1.113
+++ /sys/cam/scsi/scsi_da.c 14 Nov 2002 19:04:40 -
@@ -416,7 +416,7 @@
 * HP 315 Digital Camera
 * PR: kern/41010
 */
-   {T_DIRECT, SIP_MEDIA_REMOVABLE, HP, USB Camera*, *},
+   {T_DIRECT, SIP_MEDIA_REMOVABLE, HP, USB CAMERA*, *},
/*quirks*/ DA_Q_NO_6_BYTE
}
 };

 
 followed by a panic:
 
 Fatal trap 12: page fault while in kernel mode
 fault virtual address   = 0xdeadc10a
 fault code  = supervisor read, page not present
 instruction pointer = 0x8:0xc01ea9d6
 stack pointer   = 0x10:0xc5e42b74
 frame pointers  = 0x10:0xc5e42b74
 code segment= base 0x0, limit 0xf, type 0x1b
 = DPL 0, pres 1, def 32 1, gran 1
 processor eflags= interrupt enabled, resume, IOPL0
 current process = 23 (usb0)
 kernel: type 12 trap, code=0
 Stopped at  device_get_nameunit+0x6:movl0x2c(%eax), %eax

Something is attempting to access memory that has already been freed (note
the 0xdead).  I need a stacktrace from a kernel with symbols to know more
about who is calling device_get_nameunit.  You can set a dumpdev and get a
core or run gdb over a serial line against the kernel.debug.  If you don't
have that yet, just a tr in ddb would help.

 The really odd part is, if I haven't done anything between attaching and
 detaching, then I now get dropped into DDB and cannot continue without
 rebooting.  However, if I *have* tried to access the device (even so much as
 cat /dev/da0) before detaching, I get the panic then get returned
 immediately to my console.  The SCSI device disappears when I rescan the
 SCSI bus with camcontrol, and if I reattach the camera is doesn't come back,
 but otherwise the system keeps going like normal.  (The actual devfs nodes
 /dev/da0 and /dev/umass0 are still there, however)

Page fault != panic although it often results in one.  Once you access
/dev/da0, it gets SI_NAMED and thus the data isn't freed twice in the same
matter.  The bug is still there, it's just being masked.

 Should I be able to remove this device at run-time, or am I trying to do
 something that's presently unsupported?  And if so, what else do I need to
 do?

This should work.  As long as you don't have an fs mounted on the device,
you should be able to detach it.

-Nate


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: panic when removing umass device (USB Camera)

2002-11-14 Thread Kutulu
 From: Nate Lawson [EMAIL PROTECTED]
 Sent: Thursday, November 14, 2002 2:13 PM


 Try this patch for the BBB stall:

 Index: /sys/cam/scsi/scsi_da.c
 ===
 RCS file: /home/ncvs/src/sys/cam/scsi/scsi_da.c,v
 retrieving revision 1.113
 diff -u -r1.113 scsi_da.c
 --- /sys/cam/scsi/scsi_da.c 17 Oct 2002 18:04:41 -  1.113
 +++ /sys/cam/scsi/scsi_da.c 14 Nov 2002 19:04:40 -
 @@ -416,7 +416,7 @@
  * HP 315 Digital Camera
  * PR: kern/41010
  */
 -   {T_DIRECT, SIP_MEDIA_REMOVABLE, HP, USB Camera*, *},
 +   {T_DIRECT, SIP_MEDIA_REMOVABLE, HP, USB CAMERA*, *},
 /*quirks*/ DA_Q_NO_6_BYTE
 }
  };

I applied this patch and rebuilt my kernel w/ debugging symbols, so next
time it panic's I can get a core file.

The really good news is that this patch appears to have solved BOTH the BBB
stall errors *and* the panic:

umass0: at uhub1 port 4 (addr 4) disconnected
(da0:umass-sim0:0:0:0): lost device
(da0:umass-sim0:0:0:0): removing device entry
umass0: detached

Whatever the bug was appears to have been removing the da0 device entry, as
when the page fault did happen that message didn't appear on the console nor
did da0 go away.  Now I get da0 (and da0s1, which also didn't happen before)
when the camera's on, and neither device when the camera's off.

Thanks *a lot* for this quick turnaround time.  If you want me to back the
patch out and get a trace anyway (in case I'm now just covering up a bug
that still exists) I'd be more than happy to.  Lemme know.  I'm now going to
try actually mounting the device and moving files to/from it :)

--Mike Edenfield


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: panic when removing umass device (USB Camera)

2002-11-14 Thread Kutulu
From: Kutulu [EMAIL PROTECTED]
Sent: Thursday, November 14, 2002 8:58 PM
Subject: Re: panic when removing umass device (USB Camera)


 I'm now going to try actually mounting the device and moving files to/from
it :)

Quick follow-up that this is working fine, including the file system
unmounting itself when the camera goes to sleep.  I'm rather impressed, even
Windows 2000 complained about that one. :)

--Mike Edenfield


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



panic when removing umass device (USB Camera)

2002-11-13 Thread Kutulu
I have an HP digital camera w/ CompactFlash that acts as a USB mass-storage
device that's panic'ing my system when I remove it.

If I do not load the umass driver, then the camera is detected as a simple
generic ugen0 device, and I can safely add/remove the device at will.  If I
load the umass driver, the camera is correctly detected as a mass-storage
device as such:

umass0: HP USB DIGITAL CAMERA, rev 1.10/1.00, addr4
umass0: Residue incorrect, was 0, should've been 252
umass0: Residue incorrect, was 0, should've been 252
umass0: Residue incorrect, was 0, should've been 252
umass0: Residue incorrect, was 0, should've been 252
umass0: Residue incorrect, was 0, should've been 252
da0 at umass-sim0 bus 0 target 0 lun 0
da0: HP USB CAMERA 1.00 Removeable Direct Access SCSI-0 device
da0: 1.000 MB/s transfers
da0: 30 MB (62657 512 byte sectors: 64H 32S/T 30C)

At this point, if I detach the camera (or, if the camera puts itself to
sleep as it will do after 5 minutes of inactivity), I get the following
errors:

umass0: BBB reset failed, IOERROR
umass0: BBB bulk-in clear stall failed, IOERROR
umass0: BBB bulk-out clear stall failed, IOERROR
(these are repeated 4 more times...)
umass0: at uhub1 port 4 (addr 4) disconnected
(da0: umass-sim0:0:0:)): lost device
umass0: detached

followed by a panic:

Fatal trap 12: page fault while in kernel mode
fault virtual address   = 0xdeadc10a
fault code  = supervisor read, page not present
instruction pointer = 0x8:0xc01ea9d6
stack pointer   = 0x10:0xc5e42b74
frame pointers  = 0x10:0xc5e42b74
code segment= base 0x0, limit 0xf, type 0x1b
= DPL 0, pres 1, def 32 1, gran 1
processor eflags= interrupt enabled, resume, IOPL0
current process = 23 (usb0)
kernel: type 12 trap, code=0
Stopped at  device_get_nameunit+0x6:movl0x2c(%eax), %eax


The really odd part is, if I haven't done anything between attaching and
detaching, then I now get dropped into DDB and cannot continue without
rebooting.  However, if I *have* tried to access the device (even so much as
cat /dev/da0) before detaching, I get the panic then get returned
immediately to my console.  The SCSI device disappears when I rescan the
SCSI bus with camcontrol, and if I reattach the camera is doesn't come back,
but otherwise the system keeps going like normal.  (The actual devfs nodes
/dev/da0 and /dev/umass0 are still there, however).

Should I be able to remove this device at run-time, or am I trying to do
something that's presently unsupported?  And if so, what else do I need to
do?
Is there anything additional I need to add to my kernel, aside from usb,
uhci, umass, scbus, da, and pass?

Thanks for any assistance, and if there's more information I can provide
please let me know.  (I don't have backtraces because I have to copy stuff
down on pen/paper and my hand cramped up after the panic :/   If those would
be useful I'll try to find a space laptop  serial cable.)

--Mike Edenfield


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



RE: USB camera

2001-12-28 Thread Jan Stocker

Looks quite fine for me... 

looks like your cam was connected for about 6 mins...

what does a 

$ mount -t msdos /dev/da0s1 /mnt

say?

Maybe you should take a look at the partition table with

$ fdisk da0

if it tells you something like 


fdisk: invalid fdisk partition table found
Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
UNUSED
The data for partition 2 is:
UNUSED
The data for partition 3 is:
UNUSED
The data for partition 4 is:
sysid 165,(FreeBSD/NetBSD/386BSD)
start 32, size 126944 (61 Meg), flag 80 (active)
beg: cyl 0/ head 1/ sector 1;
end: cyl 61/ head 63/ sector 32

you should add a quirk for your cam...

Jan

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]]On Behalf Of Joe Halpin
 Sent: Thursday, December 27, 2001 11:15 PM
 To: [EMAIL PROTECTED]
 Subject: USB camera
 
 
 I'm not able to mount my USB camera. This is what dmesg has to say about
 my usb port:
 
 $ dmesg | grep -i usb
 uhci0: Intel 82371AB/EB (PIIX4) USB controller port 0xe000-0xe01f irq
 11 at device 7.2 on pci0
 usb0: Intel 82371AB/EB (PIIX4) USB controller on uhci0
 usb0: USB revision 1.0
 bash-2.05$ dmesg | grep -i scsi
 da0: NIKON NIKON DSC E995 1.00 Removable Direct Access SCSI-2 device 
 da0: NIKON NIKON DSC E995 1.00 Removable Direct Access SCSI-2 device 
 
 
 This is what /var/log/messages says when I plug the camera in and turn
 it on:
 
 Dec 27 15:41:01 fbsd /kernel: da0 at umass-sim0 bus 0 target 0 lun 0
 Dec 27 15:41:01 fbsd /kernel: da0: NIKON NIKON DSC E995 1.00 Removable
 Direct Access SCSI-2 device
 Dec 27 15:41:01 fbsd /kernel: da0: 650KB/s transfers
 Dec 27 15:41:01 fbsd /kernel: da0: 15MB (31808 512 byte sectors: 64H
 32S/T 15C)
 Dec 27 15:47:13 fbsd /kernel: umass0: at uhub0 port 1 (addr 2)
 disconnected
 Dec 27 15:47:13 fbsd /kernel: (da0:umass-sim0:0:0:0): lost device
 Dec 27 15:47:13 fbsd /kernel: (da0:umass-sim0:0:0:0): removing device
 entry
 Dec 27 15:47:13 fbsd /kernel: umass0: detached
 
 
 On my Linux box I just mount the device file and the camera shows up as
 a filesystem. Is it different in FreeBSD?
 
 Thanks
 
 Joe
 
 To Unsubscribe: send mail to [EMAIL PROTECTED]
 with unsubscribe freebsd-current in the body of the message
 

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: USB camera

2001-12-28 Thread Joe Halpin

Jan Stocker wrote:
 
 Looks quite fine for me...
 
 looks like your cam was connected for about 6 mins...
 
 what does a
 
 $ mount -t msdos /dev/da0s1 /mnt
 
 say?

That works fine. I guess I'm trying to mount the wrong device file. 

sigh

Sorry, I'm pretty new to usb and haven't caught on yet. Is there a
document that describes what the device files under /dev are for? I
don't see da0s1 in my kernel config file at all.

Thanks

Joe

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: USB camera

2001-12-28 Thread Jan Stocker

The s1 after da0s1 is similar for all disc devices under bsd. It means
the first slice (similar to partition for Wind**s users). 

But this is something out of topic here... move to FreeBSD-question or
take a private talk with me...

Jan

On Fri, 2001-12-28 at 17:28, Joe Halpin wrote:
 Jan Stocker wrote:
  
  Looks quite fine for me...
  
  looks like your cam was connected for about 6 mins...
  
  what does a
  
  $ mount -t msdos /dev/da0s1 /mnt
  
  say?
 
 That works fine. I guess I'm trying to mount the wrong device file. 
 
 sigh
 
 Sorry, I'm pretty new to usb and haven't caught on yet. Is there a
 document that describes what the device files under /dev are for? I
 don't see da0s1 in my kernel config file at all.
 
 Thanks
 
 Joe
 
 To Unsubscribe: send mail to [EMAIL PROTECTED]
 with unsubscribe freebsd-current in the body of the message



To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



USB camera

2001-12-27 Thread Joe Halpin

I'm not able to mount my USB camera. This is what dmesg has to say about
my usb port:

$ dmesg | grep -i usb
uhci0: Intel 82371AB/EB (PIIX4) USB controller port 0xe000-0xe01f irq
11 at device 7.2 on pci0
usb0: Intel 82371AB/EB (PIIX4) USB controller on uhci0
usb0: USB revision 1.0
bash-2.05$ dmesg | grep -i scsi
da0: NIKON NIKON DSC E995 1.00 Removable Direct Access SCSI-2 device 
da0: NIKON NIKON DSC E995 1.00 Removable Direct Access SCSI-2 device 


This is what /var/log/messages says when I plug the camera in and turn
it on:

Dec 27 15:41:01 fbsd /kernel: da0 at umass-sim0 bus 0 target 0 lun 0
Dec 27 15:41:01 fbsd /kernel: da0: NIKON NIKON DSC E995 1.00 Removable
Direct Access SCSI-2 device
Dec 27 15:41:01 fbsd /kernel: da0: 650KB/s transfers
Dec 27 15:41:01 fbsd /kernel: da0: 15MB (31808 512 byte sectors: 64H
32S/T 15C)
Dec 27 15:47:13 fbsd /kernel: umass0: at uhub0 port 1 (addr 2)
disconnected
Dec 27 15:47:13 fbsd /kernel: (da0:umass-sim0:0:0:0): lost device
Dec 27 15:47:13 fbsd /kernel: (da0:umass-sim0:0:0:0): removing device
entry
Dec 27 15:47:13 fbsd /kernel: umass0: detached


On my Linux box I just mount the device file and the camera shows up as
a filesystem. Is it different in FreeBSD?

Thanks

Joe

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message