1. 13 8月, 2013 1 次提交
    • M
      USB: HCD: support giveback of URB in tasklet context · 94dfd7ed
      Ming Lei 提交于
      This patch implements the mechanism of giveback of URB in
      tasklet context, so that hardware interrupt handling time for
      usb host controller can be saved much, and HCD interrupt handling
      can be simplified.
      
      Motivations:
      
      1), on some arch(such as ARM), DMA mapping/unmapping is a bit
      time-consuming, for example: when accessing usb mass storage
      via EHCI on pandaboard, the common length of transfer buffer is 120KB,
      the time consumed on DMA unmapping may reach hundreds of microseconds;
      even on A15 based box, the time is still about scores of microseconds
      
      2), on some arch, reading DMA coherent memoery is very time-consuming,
      the most common example is usb video class driver[1]
      
      3), driver's complete() callback may do much things which is driver
      specific, so the time is consumed unnecessarily in hardware irq context.
      
      4), running driver's complete() callback in hardware irq context causes
      that host controller driver has to release its lock in interrupt handler,
      so reacquiring the lock after return may busy wait a while and increase
      interrupt handling time. More seriously, releasing the HCD lock makes
      HCD becoming quite complicated to deal with introduced races.
      
      So the patch proposes to run giveback of URB in tasklet context, then
      time consumed in HCD irq handling doesn't depend on drivers' complete and
      DMA mapping/unmapping any more, also we can simplify HCD since the HCD
      lock isn't needed to be released during irq handling.
      
      The patch should be reasonable and doable:
      
      1), for drivers, they don't care if the complete() is called in hard irq
      context or softirq context
      
      2), the biggest change is the situation in which usb_submit_urb() is called
      in complete() callback, so the introduced tasklet schedule delay might be a
      con, but it shouldn't be a big deal:
      
      	- control/bulk asynchronous transfer isn't sensitive to schedule
      	  delay
      
      	- the patch schedules giveback of periodic URBs using
      	  tasklet_hi_schedule, so the introduced delay should be very
      	  small
      
      	- for ISOC transfer, generally, drivers submit several URBs
      	  concurrently to avoid interrupt delay, so it is OK with the
      	  little schedule delay.
      
      	- for interrupt transfer, generally, drivers only submit one URB
      	  at the same time, but interrupt transfer is often used in event
      	  report, polling, ... situations, and a little delay should be OK.
      
      Considered that HCDs may optimize on submitting URB in complete(), the
      patch may cause the optimization not working, so introduces one flag to mark
      if the HCD supports to run giveback URB in tasklet context. When all HCDs
      are ready, the flag can be removed.
      
      [1], http://marc.info/?t=136438111600010&r=1&w=2
      
      Cc: Oliver Neukum <oliver@neukum.org>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NMing Lei <ming.lei@canonical.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      94dfd7ed
  2. 03 8月, 2013 1 次提交
  3. 01 8月, 2013 4 次提交
    • A
      USB: handle LPM errors during device suspend correctly · 4fae6f0f
      Alan Stern 提交于
      The hub driver's usb_port_suspend() routine doesn't handle errors
      related to Link Power Management properly.  It always returns failure,
      it doesn't try to clean up the wakeup setting, (in the case of system
      sleep) it doesn't try to go ahead with the port suspend regardless,
      and it doesn't try to apply the new power-off mechanism.
      
      This patch fixes these problems.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Acked-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4fae6f0f
    • A
      USB: refactor code for enabling/disabling remote wakeup · 28e86165
      Alan Stern 提交于
      The hub driver is inconsistent in its organization of code for
      enabling and disabling remote wakeup.  There is a special routine to
      disable wakeup for SuperSpeed devices but not for slower devices, and
      there is no special routine to enable wakeup.
      
      This patch refactors the code.  It renames and changes the existing
      function to make it handle both SuperSpeed and non-SuperSpeed devices,
      and it adds a corresponding routine to enable remote wakeup.  It also
      changes the speed determination to look at the device's speed rather
      than the speed of the parent hub -- this shouldn't make any difference
      because a SuperSpeed device always has to be attached to a SuperSpeed
      hub and conversely.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      28e86165
    • A
      USB: simplify the interface of usb_get_status() · 15b7336e
      Alan Stern 提交于
      This patch simplifies the interface presented by usb_get_status().
      Instead of forcing callers to check for the proper data length and
      convert the status value to host byte order, the function will now
      do these things itself.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      15b7336e
    • J
      usb: core: don't try to reset_device() a port that got just disconnected · f3e94aa1
      Julius Werner 提交于
      The USB hub driver's event handler contains a check to catch SuperSpeed
      devices that transitioned into the SS.Inactive state and tries to fix
      them with a reset. It decides whether to do a plain hub port reset or
      call the usb_reset_device() function based on whether there was a device
      attached to the port.
      
      However, there are device/hub combinations (found with a JetFlash
      Transcend mass storage stick (8564:1000) on the root hub of an Intel
      LynxPoint PCH) which can transition to the SS.Inactive state on
      disconnect (and stay there long enough for the host to notice). In this
      case, above-mentioned reset check will call usb_reset_device() on the
      stale device data structure. The kernel will send pointless LPM control
      messages to the no longer connected device address and can even cause
      several 5 second khubd stalls on some (buggy?) host controllers, before
      finally accepting the device's fate amongst a flurry of error messages.
      
      This patch makes the choice of reset dependent on the port status that
      has just been read from the hub in addition to the existence of an
      in-kernel data structure for the device, and only proceeds with the more
      extensive reset if both are valid.
      Signed-off-by: NJulius Werner <jwerner@chromium.org>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f3e94aa1
  4. 26 7月, 2013 3 次提交
  5. 25 7月, 2013 2 次提交
  6. 17 7月, 2013 1 次提交
    • A
      USB: global suspend and remote wakeup don't mix · e583d9db
      Alan Stern 提交于
      The hub driver was recently changed to use "global" suspend for system
      suspend transitions on non-SuperSpeed buses.  This means that we don't
      suspend devices individually by setting the suspend feature on the
      upstream hub port; instead devices all go into suspend automatically
      when the root hub stops transmitting packets.  The idea was to save
      time and to avoid certain kinds of wakeup races.
      
      Now it turns out that many hubs are buggy; they don't relay wakeup
      requests from a downstream port to their upstream port if the
      downstream port's suspend feature is not set (depending on the speed
      of the downstream port, whether or not the hub is enabled for remote
      wakeup, and possibly other factors).
      
      We can't have hubs dropping wakeup requests.  Therefore this patch
      goes partway back to the old policy: It sets the suspend feature for a
      port if the device attached to that port or any of its descendants is
      enabled for wakeup.  People will still be able to benefit from the
      time savings if they don't care about wakeup and leave it disabled on
      all their devices.
      
      In order to accomplish this, the patch adds a new field to the usb_hub
      structure: wakeup_enabled_descendants is a count of how many devices
      below a suspended hub are enabled for remote wakeup.  A corresponding
      new subroutine determines the number of wakeup-enabled devices at or
      below an arbitrary suspended USB device.
      
      This should be applied to the 3.10 stable kernel.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Reported-and-tested-by: NToralf Förster <toralf.foerster@gmx.de>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e583d9db
  7. 19 6月, 2013 1 次提交
  8. 07 6月, 2013 1 次提交
  9. 06 6月, 2013 1 次提交
  10. 04 6月, 2013 2 次提交
  11. 29 5月, 2013 1 次提交
  12. 21 5月, 2013 1 次提交
    • J
      usb: ehci: Only sleep for post-resume handover if devices use persist · 9b790915
      Julius Werner 提交于
      The current EHCI code sleeps a flat 110ms in the resume path if there
      was a USB 1.1 device connected to its companion controller during
      suspend, waiting for the device to reappear and reset so that it can be
      handed back to the companion. This is necessary if the device uses
      persist, so that the companion controller can actually see it during its
      own resume path.
      
      However, if the device doesn't use persist, this is entirely
      unnecessary. We might just as well ignore it and have the normal device
      detection/reset/handoff code handle it asynchronously when it eventually
      shows up. As USB 1.1 devices are almost exclusively HIDs these days (for
      which persist has no value), this can allow distros to shave another
      tenth of a second off their resume time.
      
      In order to enable this optimization, the patch also adds a new
      usb_for_each_dev() iterator that is exported by the USB core and wraps
      bus_for_each_dev() with the logic to differentiate between struct
      usb_device and struct usb_interface on the usb_bus_type bus.
      Signed-off-by: NJulius Werner <jwerner@chromium.org>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9b790915
  13. 18 5月, 2013 5 次提交
  14. 17 5月, 2013 1 次提交
  15. 16 5月, 2013 1 次提交
  16. 18 4月, 2013 1 次提交
  17. 12 4月, 2013 1 次提交
  18. 10 4月, 2013 1 次提交
  19. 08 4月, 2013 1 次提交
    • K
      driver core: add uid and gid to devtmpfs · 3c2670e6
      Kay Sievers 提交于
      Some drivers want to tell userspace what uid and gid should be used for
      their device nodes, so allow that information to percolate through the
      driver core to userspace in order to make this happen.  This means that
      some systems (i.e.  Android and friends) will not need to even run a
      udev-like daemon for their device node manager and can just rely in
      devtmpfs fully, reducing their footprint even more.
      Signed-off-by: NKay Sievers <kay@vrfy.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3c2670e6
  20. 02 4月, 2013 2 次提交
  21. 30 3月, 2013 1 次提交
    • J
      usb: Make USB persist default configurable · 4f482038
      Julius Werner 提交于
      Commit 9214d1d8 set the USB persist flag as a default for all devices.
      This might be desirable for some distributions, but it certainly has its
      trade-offs... most importantly, it can significantly increase system
      resume time, because the kernel blocks on resuming (and sometimes
      resetting) USB devices before it unfreezes userspace.
      
      This patch introduces a new config option CONFIG_USB_DEFAULT_PERSIST,
      which allows distributions to make this decision on their own without
      the need to carry a custom patch or revert the kernel's setting in
      userspace.
      
      [edited the Kconfig help text a bit - gregkh]
      Signed-off-by: NJulius Werner <jwerner@chromium.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4f482038
  22. 29 3月, 2013 4 次提交
    • A
      USB: improve port transitions when EHCI starts up · 05768918
      Alan Stern 提交于
      It seems to be getting more common recently for EHCI host controllers
      to be probed after their companion UHCI or OHCI controllers.  This may
      be caused partly by splitting the ehci-pci driver out from ehci-hcd,
      or it may be caused by changes in the way the kernel does driver
      probing.
      
      Regardless, it has a tendency to cause problems.  When an EHCI
      controller is initialized, it takes ownership of all the ports away
      from the companions.  In effect, it forcefully disconnects all the USB
      devices that may already be using a companion controller.
      
      This patch (as1672b) tries to make the transition more orderly by
      deconfiguring the root hubs for all the companion controllers before
      initializing the EHCI controller, and reconfiguring them afterward.
      The result is a soft disconnect rather than a hard one.
      
      Internally, the patch refactors the code involved in associating EHCI
      controllers with their companions.  The old approach, in which a
      single function is called with an argument telling it what to do (the
      companion_action enum), has been replaced with a scheme using multiple
      callback functions, each performing a single task.
      
      This patch won't solve all the problems people encounter when their
      EHCI controllers start up, but it will at least reduce the number of
      error messages generated by the unexpected disconnections.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Tested-by: NJenya Y <jy.gerstmaier@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      05768918
    • A
      USB: remove CONFIG_USB_SUSPEND option · 84ebc102
      Alan Stern 提交于
      This patch (as1675) removes the CONFIG_USB_SUSPEND option, essentially
      replacing it everywhere with CONFIG_PM_RUNTIME (except for one place
      in hub.c, where it is replaced with CONFIG_PM because the code needs
      to be used in both runtime and system PM).  The net result is code
      shrinkage and simplification.
      
      There's very little point in keeping CONFIG_USB_SUSPEND because almost
      everybody enables it.  The few that don't will find that the usbcore
      module has gotten somewhat bigger and they will have to take active
      measures if they want to prevent hubs from being runtime suspended.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: Peter Chen <peter.chen@freescale.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      84ebc102
    • A
      USB: use "global suspend" for system sleep on USB-2 buses · 0aa2832d
      Alan Stern 提交于
      This patch (as1674) speeds up system sleep transitions by not
      suspending each individual device on a USB-1.1 or USB-2 bus.  The
      devices will automatically go into suspend when their root hubs are
      suspended (i.e., stop sending out Start-Of-Frame packets) -- this is
      what the USB spec calls "global suspend".
      
      Since this is what we do already when CONFIG_USB_SUSPEND isn't
      enabled, it shouldn't cause any problems.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: Peter Chen <peter.chen@freescale.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0aa2832d
    • A
      USB: avoid error messages when a device is disconnected · e9e88fb7
      Alan Stern 提交于
      This patch (as1673) reduces the amount of log spew from the hub driver
      by removing a bunch of error messages in the case where the device in
      question is already known to have been disconnected.  Since the
      disconnect event itself appears in the log, there's no need for other
      error messages.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Tested-by: NJenya Y <jy.gerstmaier@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e9e88fb7
  23. 26 3月, 2013 3 次提交