Re: [PATCH 1/2] usb: add helper to extract bits 12:11 of wMaxPacketSize

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

 



On Wed, Sep 28, 2016 at 09:51:32AM -0500, Bin Liu wrote:
> On Wed, Sep 28, 2016 at 05:15:59PM +0300, Felipe Balbi wrote:
> > 
> > Hi,
> > 
> > Bin Liu <b-liu@xxxxxx> writes:
> > >> > uvc_video set the each request size (you could check function
> > >> > uvc_video_alloc_requests()) for uvc:
> > >> >          req_size = video->ep->maxpacket
> > >> >                   * max_t(unsigned int, video->ep->maxburst, 1)
> > >> >                   * (video->ep->mult + 1);
> > >> >
> > >> >
> > >> > If we change the ep->maxpacket like this, uvc layer will only set the
> > >> > req size to 1024 (while it should be 3072 if we want to use high
> > >> > bindwidth isoc transfer).
> > >> 
> > >> it'll be 1024 * (mult + 1). Hmm, mult isn't set for highspeed isoc
> > >> endpoints. So here you go:
> > >
> > > Great! all the 4 patches you sent so far fix the issue on v4.4.21 tag!
> > > Now I see 3 1024-bytes transactions in each SOF.
> > 
> > cool, I just sent a huge patch bomb which contains all these tiny fixes
> > plus a rework of usb_endpoint_maxp(). Care to give a round of review so
> > we get it into v4.10 (not v4.9, that's too late) merge window?
> 
> Sure, will do soon.
> 
> > 
> > thanks for testing. If it's not too much to ask, care to test my
> > v4.4.21+dwc3 branch? I force-pushed all latest changes to that branch so
> > it's easy for you to test.
> 
> No problem, I will test it in a couple days. I have to jump in another
> urgent task which popped up yesterday.
> 
> > 
> > Please make sure to capture dwc3's tracepoints, I need to make sure
> > we're printing things correctly now ;-)
> 
> Yes, I will capture it.

Well, current v4.4.21+dwc3 (HEAD: 60f7f4f) is kinda working, but seems
not stable. Attached are the logs for different cases (console logs +
ftrace).

- sometimes it works, the bus trace shows 3 transactions per SOF!
- but sometimes there is only 1 transactions per SOF, and data packet is
  0 byte from DWC3.
  ftrace: dwc3-g-webcam-zlp-one-per-sof.ftrace
- sometimes console has ep0 warning. But I forgot how the bus traffic is
  in this case.
  cosnole log: dwc3-g-webcam-ep0-warning-console.log
- sometimes there is no isoch xfter at all on the bus, and console has
  dead lock message as shown below.
  ftrace: dwc3-g-webcam-no-iso-xfter.ftrace
  console log: dwc3-g-webcam-no-iso-xfter.console.log


 42 [   54.119060] =============================================                    
 43 [   54.124732] [ INFO: possible recursive locking detected ]                    
 44 [   54.130397] 4.4.21-00210-gabbc900 #51 Not tainted                            
 45 [   54.135338] ---------------------------------------------                    
 46 [   54.141007] uvc-gadget/780 is trying to acquire lock:                        
 47 [   54.146312]  (&(&queue->irqlock)->rlock){......}, at: [<bf1db598>] uvcg_queue_cancel+0x2c/0xa4 [usb_f_uvc]
 48 [   54.156507]                                                                  
 49 [   54.156507] but task is already holding lock:                                
 50 [   54.162633]  (&(&queue->irqlock)->rlock){......}, at: [<bf1dc24c>] uvcg_video_pump+0x5c/0x164 [usb_f_uvc]
 51 [   54.172723]                                                                  
 52 [   54.172723] other info that might help us debug this:                        
 53 [   54.179578]  Possible unsafe locking scenario:                               
 54 [   54.179578]                                                                  
 55 [   54.185793]        CPU0                                                      
 56 [   54.188356]        ----                                                      
 57 [   54.190919]   lock(&(&queue->irqlock)->rlock);                               
 58 [   54.195599]   lock(&(&queue->irqlock)->rlock);                               
 59 [   54.200279]                                                                  
 60 [   54.200279]  *** DEADLOCK ***                                                
 61 [   54.200279]                                                                  
 62 [   54.206498]  May be due to missing lock nesting notation                     
 63 [   54.206498]                                                                  
 64 [   54.213626] 2 locks held by uvc-gadget/780:                                  
 65 [   54.218017]  #0:  (&uvc->video.mutex){+.+.+.}, at: [<bf179620>] v4l2_ioctl+0x60/0xf0 [videodev]
 66 [   54.227241]  #1:  (&(&queue->irqlock)->rlock){......}, at: [<bf1dc24c>] uvcg_video_pump+0x5c/0x164 [usb_f_uvc]
 67 [   54.237801]                                                                  
 68 [   54.237801] stack backtrace:                                                 
 69 [   54.242381] CPU: 0 PID: 780 Comm: uvc-gadget Not tainted 4.4.21-00210-gabbc900 #51
 70 [   54.250329] Hardware name: Generic DRA74X (Flattened Device Tree)            
 71 [   54.256742] [<c001a528>] (unwind_backtrace) from [<c00159dc>] (show_stack+0x20/0x24)
 72 [   54.264880] [<c00159dc>] (show_stack) from [<c033ce78>] (dump_stack+0xb4/0xe8)
 73 [   54.272471] [<c033ce78>] (dump_stack) from [<c0097cf4>] (__lock_acquire+0x1450/0x1dec)
 74 [   54.280789] [<c0097cf4>] (__lock_acquire) from [<c0098efc>] (lock_acquire+0xdc/0x1b8)
 75 [   54.289022] [<c0098efc>] (lock_acquire) from [<c05eb92c>] (_raw_spin_lock_irqsave+0x48/0x5c)
 76 [   54.297901] [<c05eb92c>] (_raw_spin_lock_irqsave) from [<bf1db598>] (uvcg_queue_cancel+0x2c/0xa4 [usb_f_uvc])
 77 [   54.308343] [<bf1db598>] (uvcg_queue_cancel [usb_f_uvc]) from [<bf1dbe54>] (uvc_video_complete+0xb0/0x15c [usb_f_uvc])
 78 [   54.319603] [<bf1dbe54>] (uvc_video_complete [usb_f_uvc]) from [<bf09701c>] (usb_gadget_giveback_request+0x1c/0x20 [udc_core])
 79 [   54.331593] [<bf09701c>] (usb_gadget_giveback_request [udc_core]) from [<bf0a57dc>] (dwc3_gadget_giveback+0xe4/0x1ac [dwc3])
 80 [   54.343411] [<bf0a57dc>] (dwc3_gadget_giveback [dwc3]) from [<bf0a6190>] (__dwc3_gadget_kick_transfer+0x220/0x258 [dwc3])
 81 [   54.354949] [<bf0a6190>] (__dwc3_gadget_kick_transfer [dwc3]) from [<bf0a68f0>] (__dwc3_gadget_ep_queue+0x18c/0x2ac [dwc3])
 82 [   54.366667] [<bf0a68f0>] (__dwc3_gadget_ep_queue [dwc3]) from [<bf0a6a4c>] (dwc3_gadget_ep_queue+0x3c/0xdc [dwc3])
 83 [   54.377570] [<bf0a6a4c>] (dwc3_gadget_ep_queue [dwc3]) from [<bf1dc28c>] (uvcg_video_pump+0x9c/0x164 [usb_f_uvc])
 84 [   54.388371] [<bf1dc28c>] (uvcg_video_pump [usb_f_uvc]) from [<bf1dc4e8>] (uvcg_video_enable+0x194/0x1e0 [usb_f_uvc])
 85 [   54.399447] [<bf1dc4e8>] (uvcg_video_enable [usb_f_uvc]) from [<bf1db9d4>] (uvc_v4l2_streamon+0x38/0x60 [usb_f_uvc])
 86 [   54.410555] [<bf1db9d4>] (uvc_v4l2_streamon [usb_f_uvc]) from [<bf17ad04>] (v4l_streamon+0x2c/0x30 [videodev])
 87 [   54.421140] [<bf17ad04>] (v4l_streamon [videodev]) from [<bf17efc8>] (__video_do_ioctl+0x298/0x318 [videodev])
 88 [   54.431720] [<bf17efc8>] (__video_do_ioctl [videodev]) from [<bf17e788>] (video_usercopy+0x178/0x6fc [videodev])
 89 [   54.442487] [<bf17e788>] (video_usercopy [videodev]) from [<bf17ed28>] (video_ioctl2+0x1c/0x24 [videodev])
 90 [   54.452705] [<bf17ed28>] (video_ioctl2 [videodev]) from [<bf179698>] (v4l2_ioctl+0xd8/0xf0 [videodev])
 91 [   54.462519] [<bf179698>] (v4l2_ioctl [videodev]) from [<c01a92ec>] (do_vfs_ioctl+0x4d0/0x7f4)
 92 [   54.471477] [<c01a92ec>] (do_vfs_ioctl) from [<c01a968c>] (SyS_ioctl+0x7c/0x8c)
 93 [   54.479160] [<c01a968c>] (SyS_ioctl) from [<c0010b20>] (ret_fast_syscall+0x0/0x1c)
 94 [   56.123526] BUG: spinlock lockup suspected on CPU#0, uvc-gadget/780          
 95 [   56.130111]  lock: 0xed810e68, .magic: dead4ead, .owner: uvc-gadget/780, .owner_cpu: 0


Regards,
-Bin.

Attachment: v4.4.21+dwc3-60f7f4f.log.tgz
Description: application/gtar-compressed


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

  Powered by Linux