1. 11 9月, 2012 6 次提交
    • L
      usb/acpi: Use ACPI methods to power off ports. · f7ac7787
      Lan Tianyu 提交于
      Upcoming Intel systems will have an ACPI method to control whether a USB
      port can be completely powered off.  The implication of powering off a
      USB port is that the device and host sees a physical disconnect, and
      subsequent port connections and remote wakeups will be lost.
      
      Add a new function, usb_acpi_power_manageable(), that can be used to
      find whether the usb port has ACPI power resources that can be used to
      power on and off the port on these machines. Also add a new function
      called usb_acpi_set_power_state() that controls the port power via these
      ACPI methods.
      
      When the USB core calls into the xHCI hub driver to power off a port,
      check whether the port can be completely powered off via this new ACPI
      mechanism.  If so, call into these new ACPI methods.  Also use the ACPI
      methods when the USB core asks to power on a port.
      Signed-off-by: NLan Tianyu <tianyu.lan@intel.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f7ac7787
    • L
      usb/acpi: Store info on device removability. · 05f91689
      Lan Tianyu 提交于
      In the upcoming USB port power off patches, we need to know whether a
      USB port can ever see a disconnect event.  Often USB ports are internal
      to a system, and users can't disconnect USB devices from that port.
      Sometimes those ports will remain empty, because the OEM chose not to
      connect an internal USB device to that port.
      
      According to ACPI Spec 9.13, PLD indicates whether USB port is
      user visible and _UPC indicates whether a USB device can be connected to
      the USB port (we'll call this "connectible").  Here's a matrix of the
      possible combinations:
      
      Visible Connectible
      		Name		Example
      -------------------------------------------------------------------------
      
      Yes	No	Unknown		(Invalid state.)
      
      Yes	Yes	Hot-plug	USB ports on the outside of a laptop.
      				A user could freely connect and disconnect
      				USB devices.
      
      No	Yes	Hard-wired	A USB modem hard-wired to a port on the
      				inside of a laptop.
      
      No	No	Not used	The port is internal to the system and
      				will remain empty.
      
      Represent each of these four states with an enum usb_port_connect_type.
      The four states are USB_PORT_CONNECT_TYPE_UNKNOWN,
      USB_PORT_CONNECT_TYPE_HOT_PLUG, USB_PORT_CONNECT_TYPE_HARD_WIRED, and
      USB_PORT_NOT_USED.  When we get the USB port's acpi_handle, store the
      state in connect_type in struct usb_port.
      Signed-off-by: NLan Tianyu <tianyu.lan@intel.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      05f91689
    • L
      usb: move children to struct usb_port · ff823c79
      Lan Tianyu 提交于
      The usb_device structure contains an array of usb_device "children".
      This array is only valid if the usb_device is a hub, so it makes no
      sense to store it there.  Instead, store the usb_device child
      in its parent usb_port structure.
      
      Since usb_port is an internal USB core structure, add a new function to
      get the USB device child, usb_hub_find_child().  Add a new macro,
      usb_hub_get_each_child(), to iterate over all the children attached to a
      particular USB hub.
      
      Remove the printing the USB children array pointer from the usb-ip
      driver, since it's really not necessary.
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NLan Tianyu <tianyu.lan@intel.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ff823c79
    • L
      usb: redefine DeviceRemovable and wHubDelay as _le16 · 9c208904
      Lan Tianyu 提交于
      DeviceRemovalbe and wHubDelay for usb3.0 hub are little-endian
      and so define them as _le16.
      Signed-off-by: NLan Tianyu <tianyu.lan@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9c208904
    • S
      usb/core: use bin2bcd() for bcdDevice in RH · b53d657d
      Sebastian Andrzej Siewior 提交于
      The kernel's version number is used as decimal in the bcdDevice field of
      the RH descriptor. For kernel version v3.12 we would see 3.0c in lsusb.
      I am not sure how important it is to stick with bcd values since this is
      this way since we started git history and nobody complained (however back
      then we reported only 2.6).
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b53d657d
    • H
      usbfs: Add a new disconnect-and-claim ioctl (v2) · 0837e7e5
      Hans de Goede 提交于
      Apps which deal with devices which also have a kernel driver, need to do
      the following:
      1) Check which driver is attached, so as to not detach the wrong driver
         (ie detaching usbfs while another instance of the app is using the device)
      2) Detach the kernel driver
      3) Claim the interface
      
      Where moving from one step to the next for both 1-2 and 2-3 consists of
      a (small) race window. So currently such apps are racy and people just live
      with it.
      
      This patch adds a new ioctl which makes it possible for apps to do this
      in a race free manner. For flexibility apps can choose to:
      1) Specify the driver to disconnect
      2) Specify to disconnect any driver except for the one named by the app
      3) Disconnect any driver
      
      Note that if there is no driver attached, the ioctl will just act like the
      regular claim-interface ioctl, this is by design, as returning an error for
      this condition would open a new bag of race-conditions.
      
      Changes in v2:
      -Fix indentation of if blocks where the condition spans multiple lines
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0837e7e5
  2. 10 9月, 2012 15 次提交
  3. 06 9月, 2012 2 次提交
  4. 31 8月, 2012 1 次提交
    • M
      usb: gadget: get rid of USB_GADGET_{DUAL,SUPER}SPEED · 85b8614d
      Michal Nazarewicz 提交于
      This commit removes USB_GADGET_DUALSPEED and USB_GADGET_SUPERSPEED
      Kconfig options.  Since now kernel allows many UDC drivers to be
      compiled, those options may turn to no longer be valid.  For
      instance, if someone decides to build UDC that supports super
      speed and UDC that supports high speed only, the latter will be
      "assumed" to support super speed since USB_GADGET_SUPERSPEED will
      be selected by the former.
      
      The test of whether CONFIG_USB_GADGET_*SPEED was defined was just
      an optimisation which removed otherwise dead code (ie. if UDC is
      not dual speed, there is no need to handle cases that can happen
      if speed is high).  This commit removes those checks.
      Signed-off-by: NMichal Nazarewicz <mina86@mina86.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      85b8614d
  5. 22 8月, 2012 3 次提交
    • A
      introduce kref_put_mutex() · 8ad5db8a
      Al Viro 提交于
      equivalent of
      	mutex_lock(mutex);
      	if (!kref_put(kref, release))
      		mutex_unlock(mutex);
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      8ad5db8a
    • M
      mm: compaction: Abort async compaction if locks are contended or taking too long · c67fe375
      Mel Gorman 提交于
      Jim Schutt reported a problem that pointed at compaction contending
      heavily on locks.  The workload is straight-forward and in his own words;
      
      	The systems in question have 24 SAS drives spread across 3 HBAs,
      	running 24 Ceph OSD instances, one per drive.  FWIW these servers
      	are dual-socket Intel 5675 Xeons w/48 GB memory.  I've got ~160
      	Ceph Linux clients doing dd simultaneously to a Ceph file system
      	backed by 12 of these servers.
      
      Early in the test everything looks fine
      
        procs -------------------memory------------------ ---swap-- -----io---- --system-- -----cpu-------
         r  b       swpd       free       buff      cache   si   so    bi    bo   in   cs  us sy  id wa st
        31 15          0     287216        576   38606628    0    0     2  1158    2   14   1  3  95  0  0
        27 15          0     225288        576   38583384    0    0    18 2222016 203357 134876  11 56  17 15  0
        28 17          0     219256        576   38544736    0    0    11 2305932 203141 146296  11 49  23 17  0
         6 18          0     215596        576   38552872    0    0     7 2363207 215264 166502  12 45  22 20  0
        22 18          0     226984        576   38596404    0    0     3 2445741 223114 179527  12 43  23 22  0
      
      and then it goes to pot
      
        procs -------------------memory------------------ ---swap-- -----io---- --system-- -----cpu-------
         r  b       swpd       free       buff      cache   si   so    bi    bo   in   cs  us sy  id wa st
        163  8          0     464308        576   36791368    0    0    11 22210  866  536   3 13  79  4  0
        207 14          0     917752        576   36181928    0    0   712 1345376 134598 47367   7 90   1  2  0
        123 12          0     685516        576   36296148    0    0   429 1386615 158494 60077   8 84   5  3  0
        123 12          0     598572        576   36333728    0    0  1107 1233281 147542 62351   7 84   5  4  0
        622  7          0     660768        576   36118264    0    0   557 1345548 151394 59353   7 85   4  3  0
        223 11          0     283960        576   36463868    0    0    46 1107160 121846 33006   6 93   1  1  0
      
      Note that system CPU usage is very high blocks being written out has
      dropped by 42%. He analysed this with perf and found
      
        perf record -g -a sleep 10
        perf report --sort symbol --call-graph fractal,5
          34.63%  [k] _raw_spin_lock_irqsave
                  |
                  |--97.30%-- isolate_freepages
                  |          compaction_alloc
                  |          unmap_and_move
                  |          migrate_pages
                  |          compact_zone
                  |          compact_zone_order
                  |          try_to_compact_pages
                  |          __alloc_pages_direct_compact
                  |          __alloc_pages_slowpath
                  |          __alloc_pages_nodemask
                  |          alloc_pages_vma
                  |          do_huge_pmd_anonymous_page
                  |          handle_mm_fault
                  |          do_page_fault
                  |          page_fault
                  |          |
                  |          |--87.39%-- skb_copy_datagram_iovec
                  |          |          tcp_recvmsg
                  |          |          inet_recvmsg
                  |          |          sock_recvmsg
                  |          |          sys_recvfrom
                  |          |          system_call
                  |          |          __recv
                  |          |          |
                  |          |           --100.00%-- (nil)
                  |          |
                  |           --12.61%-- memcpy
                   --2.70%-- [...]
      
      There was other data but primarily it is all showing that compaction is
      contended heavily on the zone->lock and zone->lru_lock.
      
      commit [b2eef8c0: mm: compaction: minimise the time IRQs are disabled
      while isolating pages for migration] noted that it was possible for
      migration to hold the lru_lock for an excessive amount of time. Very
      broadly speaking this patch expands the concept.
      
      This patch introduces compact_checklock_irqsave() to check if a lock
      is contended or the process needs to be scheduled. If either condition
      is true then async compaction is aborted and the caller is informed.
      The page allocator will fail a THP allocation if compaction failed due
      to contention. This patch also introduces compact_trylock_irqsave()
      which will acquire the lock only if it is not contended and the process
      does not need to schedule.
      Reported-by: NJim Schutt <jaschut@sandia.gov>
      Tested-by: NJim Schutt <jaschut@sandia.gov>
      Signed-off-by: NMel Gorman <mgorman@suse.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c67fe375
    • W
      string: do not export memweight() to userspace · c3a5ce04
      WANG Cong 提交于
      Fix the following warning:
      
        usr/include/linux/string.h:8: userspace cannot reference function or variable defined in the kernel
      Signed-off-by: NWANG Cong <xiyou.wangcong@gmail.com>
      Acked-by: NAkinobu Mita <akinobu.mita@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c3a5ce04
  6. 21 8月, 2012 1 次提交
  7. 20 8月, 2012 2 次提交
  8. 17 8月, 2012 3 次提交
  9. 15 8月, 2012 7 次提交