USB3 host dying on SIGKILL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

We have a somewhat UVC compliant USB2 camera connected to a USB3 port.
It works mostly great. But when we SIGKILL the program which opened the
device, the corresponding host controller dies and the system must be
rebooted to access the USB port again. If the program closes the device
normally and then ends, everything works correctly.

In the error case we get the following messages. The uvcvideo lines are
additional debug messages which we added during debugging this problem:

    [  130.812349] uvcvideo: uvc_v4l2_release
    [  130.812352] uvcvideo: uvc_v4l2_release has_privileges
    [  130.812355] uvcvideo: uvc_uninit_video start
    [  130.812536] uvcvideo: uvc_uninit_video done
    [  131.113099] uvcvideo: usb_set_interface start
    [  131.113121] xhci_hcd 0000:00:14.0: Signal while waiting for configure endpoint command
    [  131.113163] usb 3-1: Not enough bandwidth for altsetting 0
    [  131.113165] uvcvideo: usb_set_interface done
    [  131.416625] uvcvideo: uvc_queue_enable start
    [  131.416630] uvcvideo: uvc_queue_enable done
    [  131.720344] uvcvideo: uvc_v4l2_release 2
    [  131.720348] uvcvideo: uvc_v4l2_release 3
    [  131.720356] xhci_hcd 0000:00:14.0: ERROR no room on ep ring
    [  131.720359] xhci_hcd 0000:00:14.0: ERR: No room for command on command ring
    [  136.728324] xhci_hcd 0000:00:14.0: xHCI host not responding to stop endpoint command.
    [  136.728330] xhci_hcd 0000:00:14.0: Assuming host is dying, halting host.
    [  136.728344] xhci_hcd 0000:00:14.0: HC died; cleaning up
    [  136.728364] usb 3-1: USB disconnect, device number 2
    [  136.728378] uvcvideo: uvc_v4l2_release 4
    [  136.728388] uvcvideo: uvc_v4l2_release 5
    [  136.768486] xhci_hcd 0000:00:14.0: Slot 1 endpoint 2 not removed from BW list!

I.e. the uvc driver calls 

        usb_set_interface(stream->dev->udev, stream->intfnum, 0);

during it's uvc_v4l2_release() execution. This fails with
    [  131.113121] xhci_hcd 0000:00:14.0: Signal while waiting for configure endpoint command
    [  131.113163] usb 3-1: Not enough bandwidth for altsetting 0
If we remove this usb_set_interface() call everything seems to work
correctly, no error messages are in the log, and the USB3 port
remains accessible.

But that's probably not the right solution. At least I, with my very
limit knowledge about USB and xhci, don't see an error in calling this
here during the release operation. So we looked further. The call
chain which is performed starting from usb_set_interface() is:

   usb_set_interface()
   ret = usb_hcd_alloc_bandwidth(dev, NULL, iface->cur_altsetting, alt);
   ret = hcd->driver->check_bandwidth(hcd, udev);
   xhci_check_bandwidth()
   ret = xhci_configure_endpoint(xhci, udev, NULL, false, false);
   timeleft = wait_for_completion_interruptible_timeout(
                        cmd_completion, XHCI_CMD_DEFAULT_TIMEOUT);

It seems to me as if wait_for_completion_interruptible_timeout()
stops because of the SIGKILL which the process received before.
Changing the wait_for_completion_interruptible_timeout() in
xhci_configure_endpoint() to wait_for_completion_timeout() fixed
the problem for us as well. No error messages occur in the log
and the USB3 port remains accessible. Don't now if this is anything
near the right solution to this problem.

Attached is a patch for this, probably wrong, "solution" and the
kernel logs starting shortly before the SIGKILL and ending shortly
after the HC died message. The kernel logs where generated with
CONFIG_USB_DEBUG and CONFIG_USB_XHCI_HCD_DEBUGGING turned on.
Additionally uvcvideo was loaded with trace=255.

During debugging this problem we used the kernels 3.2.0-35-generic
from Ubuntu 12.4 and the latest vanilla kernel from the 3.6 series,
version 3.6.11. The patch is against version 3.6.11.

We use an AAEON IMBM-B75A mainboard with an Intel B75 chipset,
bios version 0601. The camera is a "DFK 42AUC03" from
"The Imaging Source Europe GmbH".

Does anybody know what's the right solution for this problem?
Or is the patch even correct?

Thanks in advance,

-- 
Dr. Frank Lömker
Leiter Softwareentwicklung
E-Mail: Frank.Loemker@xxxxxxxxxx
Tel   : +49(0)3677-46929-63
Internet: www.isa.de.com

ISA Institut für Serviceautomation GmbH & Co. KG 
Ziolkowskistr. 8, 98693 Ilmenau
phG: ISA GmbH, Ilmenau (AG Jena, HRB 306708)  
Geschäftsführer: Dipl.-Ing. (FH) Jürgen Utschig

Ust-IdNr. DE 239745996
ILN 43 99901 84388 2

Amtsgericht Jena
HRA 301735
HRB 306708

Member of SIELAFF GROUP
--- drivers/usb/host/xhci.c.orig	2013-01-23 09:55:56.280871103 +0100
+++ drivers/usb/host/xhci.c	2013-01-23 09:57:18.704872621 +0100
@@ -2592,7 +2592,7 @@ static int xhci_configure_endpoint(struc
 	spin_unlock_irqrestore(&xhci->lock, flags);
 
 	/* Wait for the configure endpoint command to complete */
-	timeleft = wait_for_completion_interruptible_timeout(
+	timeleft = wait_for_completion_timeout(
 			cmd_completion,
 			XHCI_CMD_DEFAULT_TIMEOUT);
 	if (timeleft <= 0) {

Attachment: log.txt.gz
Description: application/gzip


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux