1. 05 10月, 2017 10 次提交
    • A
      usb: xhci: reduce device initiated resume time variance. · 0914ea66
      Anshuman Gupta 提交于
      This patch will improve the variable auto-resume latency of an usb-port.
      
      The attempt to sync the start of root hub polling with resume time
      signaling finish was ruined by a later request to start immediate
      root hub polling.
      
      When xhci gets a port status change event interrupt due to PORT_PLC
      (port link state transition), linux Host controller driver drives the
      resume signalling on the bus for the amount of time defined by
      USB_REUME_TIMEOUT(40ms) macro.
      
      This 40ms delay for resume signalling is in acceptable limit, but
      it get worse when xhci goes for polling mode in order to detect other
      events on its ports and modify rh_timer timer with a variable time out of
      1ms to (HZ/4)ms.
      
      drivers/usb/core/hcd.c line 799
      mod_timer (&hcd->rh_timer, (jiffies/(HZ/4) + 1) * (HZ/4)).
      
      Due to above variable timeout usb auto-resume latency varies from
      40ms to ~300ms.
      
      Log Snippet:
      ~128ms latency
      [   53.112049] hub 1-0:1.0: state 7 ports 12 chg 0000 evt 0000
      [   53.229200] hub 1-0:1.0: state 7 ports 12 chg 0000 evt 0004
      [   53.240177] usb 1-2: usb wakeup-resume
      [   53.240195] usb 1-2: finish resume
      [   53.240357] usb usb1-port2: resume, status 0
      -----------------------------------------------------------------
      ~300ms latency
      [   59.946620] hub 1-0:1.0: state 7 ports 12 chg 0000 evt 0000
      [   59.979341] hub 1-0:1.0: state 7 ports 12 chg 0000 evt 0000
      [   60.229342] hub 1-0:1.0: state 7 ports 12 chg 0000 evt 0004
      [   60.251321] usb 1-2: usb wakeup-resume
      [   60.251335] usb 1-2: finish resume
      [   60.251539] usb usb1-port2: resume, status 0
      
      This variable resume latency can be optimized, as in case of PORT_PLC
      change event rh_timer has already been modified with USB_RESUME_TIMEOUT
      (40ms) delay,leaving the rest to GetPortStatus and started polling for
      root hub status (invoking usb_hcd_poll_rh_status).
      We can avoid polling as we have already modified rh_timer with
      delay of 40ms.
      
      This patch set the HCD_FLAG_POLL_RH to hcd->flags after modification of
      rh_timer, and avoids polling of root hub status. so rh_timer can fire
      after 40ms and usb device auto-resuem latency will be around 40ms.
      
      [topic and first two senctences of commit message changed -Mathias]
      Signed-off-by: NAnshuman Gupta <anshuman.gupta@intel.com>
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0914ea66
    • L
      usb: xhci: Handle USB transaction error on address command · 651aaf36
      Lu Baolu 提交于
      Xhci driver handles USB transaction errors on transfer events,
      but transaction errors are possible on address device command
      completion events as well.
      
      The xHCI specification (section 4.6.5) says: A USB Transaction
      Error Completion Code for an Address Device Command may be due
      to a Stall response from a device. Software should issue a Disable
      Slot Command for the Device Slot then an Enable Slot Command to
      recover from this error.
      
      This patch handles USB transaction errors on address command
      completion events. The related discussion threads can be found
      through below links.
      
      http://marc.info/?l=linux-usb&m=149362010728921&w=2
      http://marc.info/?l=linux-usb&m=149252752825755&w=2Suggested-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NLu Baolu <baolu.lu@linux.intel.com>
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      651aaf36
    • L
      usb: xhci: Remove xhci->mutex from xhci_alloc_dev() · 089ed490
      Lu Baolu 提交于
      xhci->mutex was added in xhci_alloc_dev()  to protect two race sources
      (xhci->slot_id and xhci->addr_dev) by commit a00918d0 ("usb: host:
      xhci: add mutex for non-thread-safe data").
      
      While xhci->slot_id has been discarded in commit c2d3d49b ("usb:
      xhci: move slot_id from xhci_hcd to xhci_command structure"), and
      xhci->addr_dev has been removed in commit 87e44f2a ("usb: xhci:
      remove the use of xhci->addr_dev"), it's now safe to remove the use of
      xhci->mutex in xhci_alloc_dev().
      
      Link: https://marc.info/?l=linux-usb&m=150306294725821&w=2Suggested-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NLu Baolu <baolu.lu@linux.intel.com>
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      089ed490
    • L
      usb: xhci: Return error when host is dead in xhci_disable_slot() · dcabc76f
      Lu Baolu 提交于
      xhci_disable_slot() is a helper for disabling a slot when a device
      goes away or recovers from error situations. Currently, it returns
      success when it sees a dead host. This is not the right way to go.
      It should return error and let the invoker know that disable slot
      command was failed due to a dead host.
      
      Fixes: f9e609b8 ("usb: xhci: Add helper function xhci_disable_slot().")
      Cc: Guoqing Zhang <guoqing.zhang@intel.com>
      Signed-off-by: NLu Baolu <baolu.lu@linux.intel.com>
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      dcabc76f
    • L
      usb: xhci: Fix memory leak when xhci_disable_slot() returns error · 11ec7588
      Lu Baolu 提交于
      If xhci_disable_slot() returns success, a disable slot command
      trb was queued in the command ring. The command completion
      handler will free the virtual device data structure associated
      with the slot. On the other hand, when xhci_disable_slot()
      returns error, the invokers should take the responsibilities to
      free the slot related data structure. Otherwise, memory leakage
      happens.
      Signed-off-by: NLu Baolu <baolu.lu@linux.intel.com>
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      11ec7588
    • L
      usb: xhci: Fix potential memory leak in xhci_disable_slot() · cd3f1790
      Lu Baolu 提交于
      xhci_disable_slot() allows the invoker to pass a command pointer
      as paramenter. Otherwise, it will allocate one. This will cause
      memory leak when a command structure was allocated inside of this
      function while queuing command trb fails. Another problem comes up
      when the invoker passed a command pointer, but xhci_disable_slot()
      frees it when it detects a dead host.
      
      This patch fixes these two problems by removing the command parameter
      from xhci_disable_slot().
      
      Fixes: f9e609b8 ("usb: xhci: Add helper function xhci_disable_slot().")
      Cc: Guoqing Zhang <guoqing.zhang@intel.com>
      Signed-off-by: NLu Baolu <baolu.lu@linux.intel.com>
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cd3f1790
    • L
      usb: xhci: Disable slot even when virt-dev is null · b64149ca
      Lu Baolu 提交于
      xhci_disable_slot() is a helper for disabling a slot when a device
      goes away or recovers from error situations. Currently, it checks
      the corespoding virt-dev pointer and returns directly (w/o issuing
      disable slot command) if it's null.
      
      This is unnecessary and will cause problems in case where virt-dev
      allocation fails and xhci_disable_slot() is called to roll back the
      hardware state. Refer to the implementation of xhci_alloc_dev().
      
      This patch removes lines to check virt-dev in xhci_disable_slot().
      
      Fixes: f9e609b8 ("usb: xhci: Add helper function xhci_disable_slot().")
      Cc: Guoqing Zhang <guoqing.zhang@intel.com>
      Signed-off-by: NLu Baolu <baolu.lu@linux.intel.com>
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b64149ca
    • L
      usb: xhci: Add debugfs interface for xHCI driver · 02b6fdc2
      Lu Baolu 提交于
      This adds debugfs consumer for xHCI driver. The debugfs entries
      read all host registers, device/endpoint contexts, command ring,
      event ring and various endpoint rings. With these entries, users
      can check the registers and memory spaces used by a host during
      run time, or save all the information with a simple 'cp -r' for
      post-mortem programs.
      
      The file hierarchy looks like this.
      
      [root of debugfs]
      |__usb
      |____[e,u,o]hci                 <---------[root for other HCIs]
      |____xhci                       <---------------[root for xHCI]
      |______0000:00:14.0             <--------------[xHCI host name]
      |________reg-cap                <--------[capability registers]
      |________reg-op                 <-------[operational registers]
      |________reg-runtime            <-----------[runtime registers]
      |________reg-ext-#cap_name      <----[extended capability regs]
      |________command-ring           <-------[root for command ring]
      |__________cycle                <------------------[ring cycle]
      |__________dequeue              <--------[ring dequeue pointer]
      |__________enqueue              <--------[ring enqueue pointer]
      |__________trbs                 <-------------------[ring trbs]
      |________event-ring             <---------[root for event ring]
      |__________cycle                <------------------[ring cycle]
      |__________dequeue              <--------[ring dequeue pointer]
      |__________enqueue              <--------[ring enqueue pointer]
      |__________trbs                 <-------------------[ring trbs]
      |________devices                <------------[root for devices]
      |__________#slot_id             <-----------[root for a device]
      |____________name               <-----------------[device name]
      |____________slot-context       <----------------[slot context]
      |____________ep-context         <-----------[endpoint contexts]
      |____________ep#ep_index        <--------[root for an endpoint]
      |______________cycle            <------------------[ring cycle]
      |______________dequeue          <--------[ring dequeue pointer]
      |______________enqueue          <--------[ring enqueue pointer]
      |______________trbs             <-------------------[ring trbs]
      Signed-off-by: NLu Baolu <baolu.lu@linux.intel.com>
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      02b6fdc2
    • M
      xhci: add port speed ID to portsc tracing · 8f114877
      Mathias Nyman 提交于
      Shows the port speed protocol speed ID (PSID) in use.
      speed ID may map to custom speeds, but in most cases it uses default
      
      1 = Full-Speed        12 MB/s
      2 = Low-Speed         1.5 Mb/s
      3 = High-speed        480 Mb/s
      4 = SuperSpeed        5 Gb/s
      5 = SuperSpeedPlus    10 Gb/s
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8f114877
    • T
      usb: host: xhci support option to disable the xHCI USB2 HW LPM · 4750bc78
      Thang Q. Nguyen 提交于
      XHCI specification 1.1 does not require xHCI-compliant controllers
      to always enable hardware USB2 LPM. However, the current xHCI
      driver always enable it when seeing HLC=1.
      This patch supports an option for users to control disabling
      USB2 Hardware LPM via DT/ACPI attribute.
      This option is needed in case user would like to disable this
      feature. For example, their xHCI controller has its USB2 HW LPM
      broken.
      Signed-off-by: NTung Nguyen <tunguyen@apm.com>
      Signed-off-by: NThang Q. Nguyen <tqnguyen@apm.com>
      Acked-by: NRob Herring <robh@kernel.org>
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4750bc78
  2. 04 10月, 2017 19 次提交
  3. 18 9月, 2017 7 次提交
  4. 17 9月, 2017 4 次提交
    • L
      Linux 4.14-rc1 · 2bd6bf03
      Linus Torvalds 提交于
      2bd6bf03
    • L
      Merge tag 'upstream-4.14-rc1' of git://git.infradead.org/linux-ubifs · 194a4ef9
      Linus Torvalds 提交于
      Pull UBI updates from Richard Weinberger:
       "Minor improvements"
      
      * tag 'upstream-4.14-rc1' of git://git.infradead.org/linux-ubifs:
        UBI: Fix two typos in comments
        ubi: fastmap: fix spelling mistake: "invalidiate" -> "invalidate"
        ubi: pr_err() strings should end with newlines
        ubi: pr_err() strings should end with newlines
        ubi: pr_err() strings should end with newlines
      194a4ef9
    • L
      Merge branch 'for-linus-4.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml · 2896b80e
      Linus Torvalds 提交于
      Pull UML updates from Richard Weinberger:
      
       - minor improvements
      
       - fixes for Debian's new gcc defaults (pie enabled by default)
      
       - fixes for XSTATE/XSAVE to make UML work again on modern systems
      
      * 'for-linus-4.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml:
        um: return negative in tuntap_open_tramp()
        um: remove a stray tab
        um: Use relative modversions with LD_SCRIPT_DYN
        um: link vmlinux with -no-pie
        um: Fix CONFIG_GCOV for modules.
        Fix minor typos and grammar in UML start_up help
        um: defconfig: Cleanup from old Kconfig options
        um: Fix FP register size for XSTATE/XSAVE
      2896b80e
    • L
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · 48bddb14
      Linus Torvalds 提交于
      Pull networking fixes from David Miller:
      
       1) Fix hotplug deadlock in hv_netvsc, from Stephen Hemminger.
      
       2) Fix double-free in rmnet driver, from Dan Carpenter.
      
       3) INET connection socket layer can double put request sockets, fix
          from Eric Dumazet.
      
       4) Don't match collect metadata-mode tunnels if the device is down,
          from Haishuang Yan.
      
       5) Do not perform TSO6/GSO on ipv6 packets with extensions headers in
          be2net driver, from Suresh Reddy.
      
       6) Fix scaling error in gen_estimator, from Eric Dumazet.
      
       7) Fix 64-bit statistics deadlock in systemport driver, from Florian
          Fainelli.
      
       8) Fix use-after-free in sctp_sock_dump, from Xin Long.
      
       9) Reject invalid BPF_END instructions in verifier, from Edward Cree.
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (43 commits)
        mlxsw: spectrum_router: Only handle IPv4 and IPv6 events
        Documentation: link in networking docs
        tcp: fix data delivery rate
        bpf/verifier: reject BPF_ALU64|BPF_END
        sctp: do not mark sk dumped when inet_sctp_diag_fill returns err
        sctp: fix an use-after-free issue in sctp_sock_dump
        netvsc: increase default receive buffer size
        tcp: update skb->skb_mstamp more carefully
        net: ipv4: fix l3slave check for index returned in IP_PKTINFO
        net: smsc911x: Quieten netif during suspend
        net: systemport: Fix 64-bit stats deadlock
        net: vrf: avoid gcc-4.6 warning
        qed: remove unnecessary call to memset
        tg3: clean up redundant initialization of tnapi
        tls: make tls_sw_free_resources static
        sctp: potential read out of bounds in sctp_ulpevent_type_enabled()
        MAINTAINERS: review Renesas DT bindings as well
        net_sched: gen_estimator: fix scaling error in bytes/packets samples
        nfp: wait for the NSP resource to appear on boot
        nfp: wait for board state before talking to the NSP
        ...
      48bddb14