Fwd: usb port issue in 9.1-Prerelease (Possibly Cam related)

2012-09-11 Thread Benjamin Close

Sending to -usb as no response from -stable.


 Original Message 
Subject:usb port issue in 9.1-Prerelease (Possibly Cam related)
Date:   Mon, 10 Sep 2012 23:09:04 +0930
From:   Benjamin Close benjamin.cl...@clearchain.com
To: freebsd-sta...@freebsd.org



Hi Folks,
I've facing an intermittent hang with a USB port which seems cam
related:

Event's that happen are:

o USB modem (HUAWEI E220) plugged into PC

ugen3.2: HUA WEI at usbus3
u3g0: 3G Modem on usbus3
u3g0: Found 3 ports.
umass0: USB MASS STORAGE on usbus3
umass0:  SCSI over Bulk-Only; quirks = 0x
umass0:6:0:-1: Attached to scbus6
umass1: USB MASS STORAGE on usbus3
umass1:  SCSI over Bulk-Only; quirks = 0x
umass1:7:1:-1: Attached to scbus7
cd1 at umass-sim0 bus 0 scbus6 target 0 lun 0
cd1: HUAWEI Mass Storage 2.31 Removable CD-ROM SCSI-2 device
cd1: 1.000MB/s transfers
cd1: Attempt to query device size failed: NOT READY, Medium not present
da0 at umass-sim1 bus 1 scbus7 target 0 lun 0
da0: HUAWEI SD Storage 2.31 Removable Direct Access SCSI-2 device
da0: 1.000MB/s transfers
da0: Attempt to query device size failed: NOT READY, Medium not present


o Time Elapsesmany packets passed, no da0 or cd1 used.


o USB Modem drops off the bus
   (It does this occasionally as it resets itself)

o Causes USB bus to lose devices

ugen3.2: HUA WEI at usbus3 (disconnected)
u3g0: at uhub3, port 1, addr 2 (disconnected)
(cd1:umass-sim0:0:0:0): lost device, 1 refs
(cd1:umass-sim0:0:0:0): removing device entry
(pass4:umass-sim0:0:0:0): passdevgonecb: devfs entry is gone
(da0:umass-sim1:1:0:0): lost device - 0 outstanding, 1 refs
(da0:umass-sim1:1:0:0): removing device entry
(pass5:umass-sim1:1:0:0): passdevgonecb: devfs entry is gone
umass0: at uhub3, port 1, addr 2 (disconnected)


At this point that particular USB port is effectively useless. Plugging
anything into the ports shows no device showing up.

Running usbconfig hangs with:

  PIDTID COMM TDNAME KSTACK
48562 101874 usbconfig-mi_switch+0x186
sleepq_wait+0x42 _sx_xlock_hard+0x426 usbd_enum_lock+0xac
usb_ref_device+0x21c usb_open+0xc7 devfs_open+0x197 vn_open_cred+0x2ff
kern_openat+0x20a amd64_syscall+0x540 Xfast_syscall+0xf7

Controller is:

uhci0@pci0:0:26:0:  class=0x0c0300 card=0x02091028 chip=0x28348086
rev=0x02 hdr=0x00
vendor = 'Intel Corporation'
device = '82801H (ICH8 Family) USB UHCI Controller'
class  = serial bus
subclass   = USB
uhci1@pci0:0:26:1:  class=0x0c0300 card=0x02091028 chip=0x28358086
rev=0x02 hdr=0x00
vendor = 'Intel Corporation'
device = '82801H (ICH8 Family) USB UHCI Controller'
class  = serial bus
subclass   = USB
ehci0@pci0:0:26:7:  class=0x0c0320 card=0x02091028 chip=0x283a8086
rev=0x02 hdr=0x00
vendor = 'Intel Corporation'
device = '82801H (ICH8 Family) USB2 EHCI Controller'
class  = serial bus
subclass   = USB

It does however seem related to cam as looking at the various threads
for the usb hub I find:

(kgdb) bt
#0  sched_switch (td=0xfe000265, newtd=0xfe000227f000,
flags=Variable flags is not available.
) at /usr/src/sys/kern/sched_ule.c:1927
#1  0x808f34c6 in mi_switch (flags=260, newtd=0x0) at
/usr/src/sys/kern/kern_synch.c:485
#2  0x8092bfd2 in sleepq_wait (wchan=0xfe001ec2a900, pri=92)
at /usr/src/sys/kern/subr_sleepqueue.c:623
#3  0x808f3c69 in _sleep (ident=0xfe001ec2a900,
lock=0xfe00371e9210, priority=Variable priority is not available.
) at /usr/src/sys/kern/kern_synch.c:250
#4  0x802bea02 in cam_sim_free (sim=0xfe001ec2a900,
free_devq=1) at /usr/src/sys/cam/cam_sim.c:112
#5  0x8074f8ba in umass_detach (dev=Variable dev is not available.
) at /usr/src/sys/dev/usb/storage/umass.c:2183
#6  0x8091a054 in device_detach (dev=0xfe001ec2e900) at
device_if.h:214
#7  0x8075c458 in usb_detach_device (udev=0xfe0007ce8800,
iface_index=32 ' ', flag=Variable flag is not available.
) at /usr/src/sys/dev/usb/usb_device.c:1065
#8  0x8075c5f4 in usb_unconfigure (udev=0xfe0007ce8800,
flag=Variable flag is not available.
) at /usr/src/sys/dev/usb/usb_device.c:455
#9  0x8075c88e in usb_free_device (udev=0xfe0007ce8800,
flag=Variable flag is not available.
) at /usr/src/sys/dev/usb/usb_device.c:2093
#10 0x80764e5e in uhub_explore (udev=0xfe0007353800) at
/usr/src/sys/dev/usb/usb_hub.c:358
#11 0x8074f536 in usb_bus_explore (pm=Variable pm is not
available.
) at /usr/src/sys/dev/usb/controller/usb_controller.c:359
#12 0x80769173 in usb_process (arg=Variable arg is not available.
) at /usr/src/sys/dev/usb/usb_process.c:170
#13 0x808bc2df in fork_exit (callout=0x807690a0
usb_process, arg=0xff80007c0e88, frame=0xff804743cc40) at
/usr/src/sys/kern/kern_fork.c:992
#14 0x80bc216e in fork_trampoline () at
/usr/src/sys/amd64/amd64

Re: Fwd: usb port issue in 9.1-Prerelease (Possibly Cam related)

2012-09-12 Thread Benjamin Close

Hi Folks,

It actually looks like a race condition. I've noticed over the last day 
that *sometimes* it does do the right thing. The dmesg when it works is:


ugen3.2: HUA WEI at usbus3 (disconnected)
u3g0: at uhub3, port 2, addr 2 (disconnected)
umass0: at uhub3, port 2, addr 2 (disconnected)
(cd1:umass-sim0:0:0:0): lost device, 1 refs
(pass4:umass-sim0:0:0:0): passdevgonecb: devfs entry is gone
(cd1:umass-sim0:0:0:0): removing device entry
umass1: at uhub3, port 2, addr 2 (disconnected)
(da0:umass-sim1:1:0:0): lost device - 0 outstanding, 1 refs
(pass5:umass-sim1:1:0:0): passdevgonecb: devfs entry is gone
(da0:umass-sim1:1:0:0): removing device entry

The difference between this one and the one that fails is that the pass 
adapters remove before the da/cd1 device.

ie when it works:

(cd1:umass-sim0:0:0:0): lost device, 1 refs
(pass4:umass-sim0:0:0:0): passdevgonecb: devfs entry is gone
(cd1:umass-sim0:0:0:0): removing device entry

When it doesn't:

(cd1:umass-sim0:0:0:0): lost device, 1 refs
(cd1:umass-sim0:0:0:0): removing device entry
(pass4:umass-sim0:0:0:0): passdevgonecb: devfs entry is gone

Cheers,
Benjamin


On 12/09/12 3:19 PM, Hans Petter Selasky wrote:

Hi Alexander,

Looks like some bugs in the refcounting in CAM layer.

--HPS

On Wednesday 12 September 2012 02:54:15 Benjamin Close wrote:

Sending to -usb as no response from -stable.


 Original Message 
Subject:usb port issue in 9.1-Prerelease (Possibly Cam related)
Date:   Mon, 10 Sep 2012 23:09:04 +0930
From:   Benjamin Close benjamin.cl...@clearchain.com
To: freebsd-sta...@freebsd.org



Hi Folks,
  I've facing an intermittent hang with a USB port which seems cam
related:

Event's that happen are:

  o USB modem (HUAWEI E220) plugged into PC

ugen3.2: HUA WEI at usbus3
u3g0: 3G Modem on usbus3
u3g0: Found 3 ports.
umass0: USB MASS STORAGE on usbus3
umass0:  SCSI over Bulk-Only; quirks = 0x
umass0:6:0:-1: Attached to scbus6
umass1: USB MASS STORAGE on usbus3
umass1:  SCSI over Bulk-Only; quirks = 0x
umass1:7:1:-1: Attached to scbus7
cd1 at umass-sim0 bus 0 scbus6 target 0 lun 0
cd1: HUAWEI Mass Storage 2.31 Removable CD-ROM SCSI-2 device
cd1: 1.000MB/s transfers
cd1: Attempt to query device size failed: NOT READY, Medium not present
da0 at umass-sim1 bus 1 scbus7 target 0 lun 0
da0: HUAWEI SD Storage 2.31 Removable Direct Access SCSI-2 device
da0: 1.000MB/s transfers
da0: Attempt to query device size failed: NOT READY, Medium not present


  o Time Elapsesmany packets passed, no da0 or cd1 used.


  o USB Modem drops off the bus
 (It does this occasionally as it resets itself)

  o Causes USB bus to lose devices

ugen3.2: HUA WEI at usbus3 (disconnected)
u3g0: at uhub3, port 1, addr 2 (disconnected)
(cd1:umass-sim0:0:0:0): lost device, 1 refs
(cd1:umass-sim0:0:0:0): removing device entry
(pass4:umass-sim0:0:0:0): passdevgonecb: devfs entry is gone
(da0:umass-sim1:1:0:0): lost device - 0 outstanding, 1 refs
(da0:umass-sim1:1:0:0): removing device entry
(pass5:umass-sim1:1:0:0): passdevgonecb: devfs entry is gone
umass0: at uhub3, port 1, addr 2 (disconnected)


At this point that particular USB port is effectively useless. Plugging
anything into the ports shows no device showing up.

Running usbconfig hangs with:

PIDTID COMM TDNAME KSTACK
48562 101874 usbconfig-mi_switch+0x186
sleepq_wait+0x42 _sx_xlock_hard+0x426 usbd_enum_lock+0xac
usb_ref_device+0x21c usb_open+0xc7 devfs_open+0x197 vn_open_cred+0x2ff
kern_openat+0x20a amd64_syscall+0x540 Xfast_syscall+0xf7

Controller is:

uhci0@pci0:0:26:0:  class=0x0c0300 card=0x02091028 chip=0x28348086
rev=0x02 hdr=0x00
  vendor = 'Intel Corporation'
  device = '82801H (ICH8 Family) USB UHCI Controller'
  class  = serial bus
  subclass   = USB
uhci1@pci0:0:26:1:  class=0x0c0300 card=0x02091028 chip=0x28358086
rev=0x02 hdr=0x00
  vendor = 'Intel Corporation'
  device = '82801H (ICH8 Family) USB UHCI Controller'
  class  = serial bus
  subclass   = USB
ehci0@pci0:0:26:7:  class=0x0c0320 card=0x02091028 chip=0x283a8086
rev=0x02 hdr=0x00
  vendor = 'Intel Corporation'
  device = '82801H (ICH8 Family) USB2 EHCI Controller'
  class  = serial bus
  subclass   = USB

It does however seem related to cam as looking at the various threads
for the usb hub I find:

(kgdb) bt
#0  sched_switch (td=0xfe000265, newtd=0xfe000227f000,
flags=Variable flags is not available.
) at /usr/src/sys/kern/sched_ule.c:1927
#1  0x808f34c6 in mi_switch (flags=260, newtd=0x0) at
/usr/src/sys/kern/kern_synch.c:485
#2  0x8092bfd2 in sleepq_wait (wchan=0xfe001ec2a900, pri=92)
at /usr/src/sys/kern/subr_sleepqueue.c:623
#3  0x808f3c69 in _sleep (ident=0xfe001ec2a900,
lock=0xfe00371e9210, priority=Variable priority is not available.
) at /usr/src/sys/kern/kern_synch.c:250
#4

Re: Fwd: usb port issue in 9.1-Prerelease (Possibly Cam related)

2012-09-27 Thread Benjamin Close

As a followup for anyone reading the mailing lists..
This hang will most likely be fixed when the resolution to:

http://lists.freebsd.org/pipermail/svn-src-head/2012-September/040561.html

is correctly worked out.

On 12/09/12 3:19 PM, Hans Petter Selasky wrote:

Hi Alexander,

Looks like some bugs in the refcounting in CAM layer.

--HPS

On Wednesday 12 September 2012 02:54:15 Benjamin Close wrote:

Sending to -usb as no response from -stable.


 Original Message 
Subject:usb port issue in 9.1-Prerelease (Possibly Cam related)
Date:   Mon, 10 Sep 2012 23:09:04 +0930
From:   Benjamin Close benjamin.cl...@clearchain.com
To: freebsd-sta...@freebsd.org



Hi Folks,
  I've facing an intermittent hang with a USB port which seems cam
related:

Event's that happen are:

  o USB modem (HUAWEI E220) plugged into PC

ugen3.2: HUA WEI at usbus3
u3g0: 3G Modem on usbus3
u3g0: Found 3 ports.
umass0: USB MASS STORAGE on usbus3
umass0:  SCSI over Bulk-Only; quirks = 0x
umass0:6:0:-1: Attached to scbus6
umass1: USB MASS STORAGE on usbus3
umass1:  SCSI over Bulk-Only; quirks = 0x
umass1:7:1:-1: Attached to scbus7
cd1 at umass-sim0 bus 0 scbus6 target 0 lun 0
cd1: HUAWEI Mass Storage 2.31 Removable CD-ROM SCSI-2 device
cd1: 1.000MB/s transfers
cd1: Attempt to query device size failed: NOT READY, Medium not present
da0 at umass-sim1 bus 1 scbus7 target 0 lun 0
da0: HUAWEI SD Storage 2.31 Removable Direct Access SCSI-2 device
da0: 1.000MB/s transfers
da0: Attempt to query device size failed: NOT READY, Medium not present


  o Time Elapsesmany packets passed, no da0 or cd1 used.


  o USB Modem drops off the bus
 (It does this occasionally as it resets itself)

  o Causes USB bus to lose devices

ugen3.2: HUA WEI at usbus3 (disconnected)
u3g0: at uhub3, port 1, addr 2 (disconnected)
(cd1:umass-sim0:0:0:0): lost device, 1 refs
(cd1:umass-sim0:0:0:0): removing device entry
(pass4:umass-sim0:0:0:0): passdevgonecb: devfs entry is gone
(da0:umass-sim1:1:0:0): lost device - 0 outstanding, 1 refs
(da0:umass-sim1:1:0:0): removing device entry
(pass5:umass-sim1:1:0:0): passdevgonecb: devfs entry is gone
umass0: at uhub3, port 1, addr 2 (disconnected)


At this point that particular USB port is effectively useless. Plugging
anything into the ports shows no device showing up.

Running usbconfig hangs with:

PIDTID COMM TDNAME KSTACK
48562 101874 usbconfig-mi_switch+0x186
sleepq_wait+0x42 _sx_xlock_hard+0x426 usbd_enum_lock+0xac
usb_ref_device+0x21c usb_open+0xc7 devfs_open+0x197 vn_open_cred+0x2ff
kern_openat+0x20a amd64_syscall+0x540 Xfast_syscall+0xf7

Controller is:

uhci0@pci0:0:26:0:  class=0x0c0300 card=0x02091028 chip=0x28348086
rev=0x02 hdr=0x00
  vendor = 'Intel Corporation'
  device = '82801H (ICH8 Family) USB UHCI Controller'
  class  = serial bus
  subclass   = USB
uhci1@pci0:0:26:1:  class=0x0c0300 card=0x02091028 chip=0x28358086
rev=0x02 hdr=0x00
  vendor = 'Intel Corporation'
  device = '82801H (ICH8 Family) USB UHCI Controller'
  class  = serial bus
  subclass   = USB
ehci0@pci0:0:26:7:  class=0x0c0320 card=0x02091028 chip=0x283a8086
rev=0x02 hdr=0x00
  vendor = 'Intel Corporation'
  device = '82801H (ICH8 Family) USB2 EHCI Controller'
  class  = serial bus
  subclass   = USB

It does however seem related to cam as looking at the various threads
for the usb hub I find:

(kgdb) bt
#0  sched_switch (td=0xfe000265, newtd=0xfe000227f000,
flags=Variable flags is not available.
) at /usr/src/sys/kern/sched_ule.c:1927
#1  0x808f34c6 in mi_switch (flags=260, newtd=0x0) at
/usr/src/sys/kern/kern_synch.c:485
#2  0x8092bfd2 in sleepq_wait (wchan=0xfe001ec2a900, pri=92)
at /usr/src/sys/kern/subr_sleepqueue.c:623
#3  0x808f3c69 in _sleep (ident=0xfe001ec2a900,
lock=0xfe00371e9210, priority=Variable priority is not available.
) at /usr/src/sys/kern/kern_synch.c:250
#4  0x802bea02 in cam_sim_free (sim=0xfe001ec2a900,
free_devq=1) at /usr/src/sys/cam/cam_sim.c:112
#5  0x8074f8ba in umass_detach (dev=Variable dev is not
available. ) at /usr/src/sys/dev/usb/storage/umass.c:2183
#6  0x8091a054 in device_detach (dev=0xfe001ec2e900) at
device_if.h:214
#7  0x8075c458 in usb_detach_device (udev=0xfe0007ce8800,
iface_index=32 ' ', flag=Variable flag is not available.
) at /usr/src/sys/dev/usb/usb_device.c:1065
#8  0x8075c5f4 in usb_unconfigure (udev=0xfe0007ce8800,
flag=Variable flag is not available.
) at /usr/src/sys/dev/usb/usb_device.c:455
#9  0x8075c88e in usb_free_device (udev=0xfe0007ce8800,
flag=Variable flag is not available.
) at /usr/src/sys/dev/usb/usb_device.c:2093
#10 0x80764e5e in uhub_explore (udev=0xfe0007353800) at
/usr/src/sys/dev/usb/usb_hub.c:358
#11 0x8074f536 in usb_bus_explore (pm