On Mon, Mar 23, 2015 at 10:14 PM, Devin Heitmueller
<dheitmuel...@kernellabs.com> wrote:
>
> My guess would be that there's some bug in the cx231xx that
> exacerbates an edge case in the XHCI core - like prematurely setting
> the USB alternate back to zero when stopping streaming and not
> canceling all the URBs first.
>
> ...
>
> As a test, you may wish to try disabling the cx231xx-audio module.
> That will help narrow down an interaction with ALSA, pulseaudio, and
> one of the two sources of URB queueing.


I think you're on the right track here - blacklisting the audio module
(cx231xxx_alsa) allowed successful video recording with the device inserted
during boot.

I added some logging to drivers/usb/core/message.c to check that the URB
list is empty before changing the alternate interface.  While it wasn't
ever called with a non-empty list, it did perhaps help narrow down the area
of code causing trouble.

The normal sequence of log messages when stopping recoring is:

Mar 26 08:50:41 alistair-XPS13 kernel: [  771.866435] cx231xx 1-2:1.1:
urb_init=0 dev->video_mode.max_pkt_size=2892
Mar 26 08:50:41 alistair-XPS13 kernel: [  771.900280] cx231xx 1-2:1.1:
urb_init=0 dev->video_mode.max_pkt_size=2892
Mar 26 08:50:41 alistair-XPS13 kernel: [  771.943487] cx231xx 1-2:1.1:
urb_init=0 dev->video_mode.max_pkt_size=2892
Mar 26 08:50:41 alistair-XPS13 kernel: [  771.988004] cx231xx 1-2:1.1:
stopping capture
Mar 26 08:50:41 alistair-XPS13 kernel: [  771.988009] cx231xx 1-2:1.1:
Stopping isoc
Mar 26 08:50:41 alistair-XPS13 kernel: [  771.988022] cx231xx 1-2:1.1:
Stop capture, if needed
Mar 26 08:50:41 alistair-XPS13 kernel: [  771.988056] cx231xx 1-2:1.1:
Stop capture, if needed
Mar 26 08:50:41 alistair-XPS13 kernel: [  771.988058] cx231xx 1-2:1.1:
closing device
Mar 26 08:50:41 alistair-XPS13 kernel: [  771.988062] cx231xx 1-2:1.1:
cx231xx_stop_stream: ep_mask = 4
Mar 26 08:50:41 alistair-XPS13 kernel: [  771.988167] usb 1-2: akg URB
list: next=0xffff880073299d90, prev=0xffff880073299d90, eq=1, empty=1
Mar 26 08:50:41 alistair-XPS13 kernel: [  771.993115] cx231xx 1-2:1.1:
cx231xx_stop_stream: ep_mask = 8
Mar 26 08:50:41 alistair-XPS13 kernel: [  771.993192] usb 1-2: akg URB
list: next=0xffff8800732992b0, prev=0xffff8800732992b0, eq=1, empty=1

The "akg URB" record is the log I added to usb_set_interface().

The failures appear to have several different paths, however one of them is:

Mar 26 08:57:17 alistair-XPS13 kernel: [   87.915849] cx231xx 1-2:1.1:
urb_init=0 dev->video_mode.max_pkt_size=2892
Mar 26 08:57:17 alistair-XPS13 kernel: [   87.960923] cx231xx 1-2:1.1:
urb_init=0 dev->video_mode.max_pkt_size=2892
Mar 26 08:57:17 alistair-XPS13 kernel: [   88.004771] cx231xx 1-2:1.1:
urb_init=0 dev->video_mode.max_pkt_size=2892
Mar 26 08:57:17 alistair-XPS13 kernel: [   88.032245] cx231xx 1-2:1.1:
stopping capture
Mar 26 08:57:17 alistair-XPS13 kernel: [   88.032253] cx231xx 1-2:1.1:
Stopping isoc
Mar 26 08:57:17 alistair-XPS13 kernel: [   88.032273] cx231xx 1-2:1.1:
Stop capture, if needed
Mar 26 08:57:17 alistair-XPS13 kernel: [   88.032326] cx231xx 1-2:1.1:
Stop capture, if needed
Mar 26 08:57:17 alistair-XPS13 kernel: [   88.032331] cx231xx 1-2:1.1:
closing device
Mar 26 08:57:17 alistair-XPS13 kernel: [   88.032337] cx231xx 1-2:1.1:
cx231xx_stop_stream: ep_mask = 4
Mar 26 08:57:17 alistair-XPS13 kernel: [   88.032526] xhci_hcd
0000:00:14.0: ERROR Transfer event TRB DMA ptr not part of current TD
ep_index 8 comp_code 1
Mar 26 08:57:17 alistair-XPS13 kernel: [   88.032542] xhci_hcd
0000:00:14.0: Looking for event-dma 00000001f8671400 trb-start
00000001facb2090 trb-end 00000001facb2090 seg-start 00000001facb2000
seg-end 00000001facb23f0
Mar 26 08:57:17 alistair-XPS13 kernel: [   88.032565] usb 1-2: akg URB
list: next=0xffff880215504eb0, prev=0xffff880215504eb0, eq=1, empty=1
Mar 26 08:57:17 alistair-XPS13 kernel: [   88.032579] xhci_hcd
0000:00:14.0: ERROR Transfer event TRB DMA ptr not part of current TD
ep_index 8 comp_code 1
Mar 26 08:57:17 alistair-XPS13 kernel: [   88.032596] xhci_hcd
0000:00:14.0: Looking for event-dma 00000001f8671410 trb-start
00000001facb2090 trb-end 00000001facb2090 seg-start 00000001facb2000
seg-end 00000001facb23f0
Mar 26 08:57:17 alistair-XPS13 kernel: [   88.032703] xhci_hcd
0000:00:14.0: ERROR Transfer event TRB DMA ptr not part of current TD
ep_index 8 comp_code 1
Mar 26 08:57:17 alistair-XPS13 kernel: [   88.032712] xhci_hcd
0000:00:14.0: Looking for event-dma 00000001f8671420 trb-start
00000001facb2090 trb-end 00000001facb2090 seg-start 00000001facb2000
seg-end 00000001facb23f0

Hopefully this will give some clues about where to look next.

Thanks again for all your assistance.

Cheers,
Alistair
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to