1. 04 Aug, 2015 33 commits
  2. 03 Aug, 2015 4 commits
    • Li Jun's avatar
      usb: chipidea: add ci->is_otg condition for otg judgement · 3f217e9e
      Li Jun authored
      Since some chipidea based controller is not otg capable, add ci->is_otg
      condition when setting is_otg flag for gadget.
      Signed-off-by: default avatarLi Jun <jun.li@freescale.com>
      Reviewed-by: default avatarRoger Quadros <rogerq@ti.com>
      Acked-by: default avatarPeter Chen <peter.chen@freescale.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      3f217e9e
    • Fupan Li's avatar
      usb: gadget: f_printer: fix deadlock caused by nested spinlock · a24b071b
      Fupan Li authored
      Function printer_func_disable() has called spinlock on printer_dev->lock,
      and it'll call function chain of
      
          printer_reset_interface()
              |
      	+---dwc3_gadget_ep_disable()
      	        |
                      +---__dwc3_gadget_ep_disable()
                              |
                              +---dwc3_remove_requests()
                                      |
                                      +---dwc3_gadget_giveback()
                                              |
                                              +---rx_complete()
      
      in the protected block.
      
      However, rx_complete() in f_printer.c calls spinlock on printer_dev->lock
      again, which will cause system hang.
      
      The following steps can reproduce this hang:
      
      1. Build the test program from Documentation/usb/gadget_printer.txt as
         g_printer
      2. Plug in the USB device to a host(such as Ubuntu).
      3. on the USB device system run:
         #modprobe g_printer.ko
         #./g_printer -read_data
      
      4. Unplug the USB device from the host
      
         The system will hang later.
      
      In order to avoid this deadlock, moving the spinlock from
      printer_func_disable() into printer_reset_interface() and excluding the block
      of calling dwc3_gadget_ep_disable(), in which the critical resource will be
      protected by its spinlock in rx_complete().
      
      This commit will fix the system hang with the following calltrace:
      
      INFO: rcu_preempt detected stalls on CPUs/tasks: { 3} (detected by 0, t=21006 jiffies, g=524, c=523, q=2)
      sending NMI to all CPUs:
      NMI backtrace for cpu 3
      CPU: 3 PID: 718 Comm: irq/22-dwc3 Not tainted 3.10.38-ltsi-WR6.0.0.11_standard #2
      Hardware name: Intel Corp. VALLEYVIEW B3 PLATFORM/NOTEBOOK, BIOS BYTICRB1.86C.0092.R32.1410021707 10/02/2014
      task: f44f4c20 ti: f40f6000 task.ti: f40f6000
      EIP: 0060:[<c1824955>] EFLAGS: 00000097 CPU: 3
      EIP is at _raw_spin_lock_irqsave+0x35/0x40
      EAX: 00000076 EBX: f80fad00 ECX: 00000076 EDX: 00000075
      ESI: 00000096 EDI: ffffff94 EBP: f40f7e20 ESP: f40f7e18
       DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
      CR0: 8005003b CR2: b77ac000 CR3: 01c30000 CR4: 001007f0
      DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
      DR6: ffff0ff0 DR7: 00000400
      Stack:
       f474a720 f80fad00 f40f7e3c f80f93cc c135d486 00000000 f474a720 f468fb00
       f4bea894 f40f7e54 f7e35f19 ffffff00 f468fb00 f468fb24 00000086 f40f7e64
       f7e36577 f468fb00 f4bea810 f40f7e74 f7e365a8 f468fb00 f4bea894 f40f7e9c
      Call Trace:
       [<f80f93cc>] rx_complete+0x1c/0xb0 [g_printer]
       [<c135d486>] ? vsnprintf+0x166/0x390
       [<f7e35f19>] dwc3_gadget_giveback+0xc9/0xf0 [dwc3]
       [<f7e36577>] dwc3_remove_requests+0x57/0x70 [dwc3]
       [<f7e365a8>] __dwc3_gadget_ep_disable+0x18/0x60 [dwc3]
       [<f7e366e9>] dwc3_gadget_ep_disable+0x89/0xf0 [dwc3]
       [<f80f9031>] printer_reset_interface+0x31/0x50 [g_printer]
       [<f80f9270>] printer_func_disable+0x20/0x30 [g_printer]
       [<f80e6d8b>] composite_disconnect+0x4b/0x90 [libcomposite]
       [<f7e39a8b>] dwc3_disconnect_gadget+0x38/0x43 [dwc3]
       [<f7e39ad4>] dwc3_gadget_disconnect_interrupt+0x3e/0x5a [dwc3]
       [<f7e373b8>] dwc3_thread_interrupt+0x5c8/0x610 [dwc3]
       [<c10ac518>] irq_thread_fn+0x18/0x30
       [<c10ac800>] irq_thread+0x100/0x130
       [<c10ac500>] ? irq_finalize_oneshot.part.29+0xb0/0xb0
       [<c10ac650>] ? wake_threads_waitq+0x40/0x40
       [<c10ac700>] ? irq_thread_dtor+0xb0/0xb0
       [<c1057224>] kthread+0x94/0xa0
       [<c182b337>] ret_from_kernel_thread+0x1b/0x28
       [<c1057190>] ? kthread_create_on_node+0xc0/0xc0
      Signed-off-by: default avatarFupan Li <fupan.li@windriver.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      a24b071b
    • Tony Lindgren's avatar
      usb: musb: Allow building in all the DMA code · 2f0bb2a0
      Tony Lindgren authored
      With recent changes to MUSB code, we can now now get rid of
      the Kconfig choise for the DMA code and allow building in any
      of the desired DMA code. This makes life easier for distros.
      Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      2f0bb2a0
    • Pengyu Ma's avatar
      usb: gadget: udc: fix spin_lock in pch_udc · d3cb25a1
      Pengyu Ma authored
      When remove module g_serial on quark platform, the following Warning on:
      
      Modules linked in: usb_f_acm u_serial g_serial(-) pch_udc libcomposite configfs udc_core
      ad7298 industrialio_triggered_buffer kfifo_buf tpm_i2c_infineon indus
      CPU: 0 PID: 369 Comm: modprobe Not tainted 3.14.29ltsi-WR7.0.0.0_standard #6
      Hardware name: Intel Corp. QUARK/CrossHill, BIOS 0x010100F5 01/01/2014
       f641df0c f641df0c f641dec8 c15ac7fa f641defc c103084f c16c2356 f641df28
       00000171 c16b855c 000009dd c15b2d6f 000009dd c15b2d6f f6bd2000 faae5480
       00000000 f641df14 c10308a3 00000009 f641df0c c16c2356 f641df28 f641df2c
      Call Trace:
       [<c15ac7fa>] dump_stack+0x16/0x18
       [<c103084f>] warn_slowpath_common+0x7f/0xa0
       [<c15b2d6f>] ? preempt_count_sub+0x6f/0xc0
       [<c15b2d6f>] ? preempt_count_sub+0x6f/0xc0
       [<c10308a3>] warn_slowpath_fmt+0x33/0x40
       [<c15b2d6f>] preempt_count_sub+0x6f/0xc0
       [<faadbc82>] pch_udc_pcd_pullup+0x32/0xa0 [pch_udc]
       [<fa9747d9>] usb_gadget_remove_driver+0x29/0x60 [udc_core]
       [<fa974869>] usb_gadget_unregister_driver+0x59/0x80 [udc_core]
       [<faa78310>] usb_composite_unregister+0x10/0x20 [libcomposite]
       [<faae50f1>] cleanup+0xd/0xf [g_serial]
       [<c1084c47>] SyS_delete_module+0xf7/0x150
       [<c111f8dd>] ? ____fput+0xd/0x10
       [<c104b2ae>] ? task_work_run+0x6e/0xa0
       [<c15afda5>] syscall_call+0x7/0x7
      
      g_serial module on quark is depended on pch_udc module, ttyGSX cann't recieve
      data and warning on when remove g_serial.
      
      It was unlocked before the modification of the structure it was protecting,
      fix it as "lock -> unlock" to resolve this.
      Signed-off-by: default avatarPengyu Ma <pengyu.ma@windriver.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      d3cb25a1
  3. 31 Jul, 2015 3 commits