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 17 次提交
  3. 18 9月, 2017 7 次提交
  4. 17 9月, 2017 2 次提交
  5. 16 9月, 2017 4 次提交
    • S
      netvsc: increase default receive buffer size · 5023a6db
      Stephen Hemminger 提交于
      The default receive buffer size was reduced by recent change
      to a value which was appropriate for 10G and Windows Server 2016.
      But the value is too small for full performance with 40G on Azure.
      Increase the default back to maximum supported by host.
      
      Fixes: 8b532797 ("netvsc: allow controlling send/recv buffer size")
      Signed-off-by: NStephen Hemminger <sthemmin@microsoft.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5023a6db
    • G
      net: smsc911x: Quieten netif during suspend · 2aa70f86
      Geert Uytterhoeven 提交于
      If the network interface is kept running during suspend, the net core
      may call net_device_ops.ndo_start_xmit() while the Ethernet device is
      still suspended, which may lead to a system crash.
      
      E.g. on sh73a0/kzm9g and r8a73a4/ape6evm, the external Ethernet chip is
      driven by a PM controlled clock.  If the Ethernet registers are accessed
      while the clock is not running, the system will crash with an imprecise
      external abort.
      
      As this is a race condition with a small time window, it is not so easy
      to trigger at will.  Using pm_test may increase your chances:
      
          # echo 0 > /sys/module/printk/parameters/console_suspend
          # echo platform > /sys/power/pm_test
          # echo mem > /sys/power/state
      
      To fix this, make sure the network interface is quietened during
      suspend.
      Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2aa70f86
    • F
      net: systemport: Fix 64-bit stats deadlock · 7095c973
      Florian Fainelli 提交于
      We can enter a deadlock situation because there is no sufficient protection
      when ndo_get_stats64() runs in process context to guard against RX or TX NAPI
      contexts running in softirq, this can lead to the following lockdep splat and
      actual deadlock was experienced as well with an iperf session in the background
      and a while loop doing ifconfig + ethtool.
      
      [    5.780350] ================================
      [    5.784679] WARNING: inconsistent lock state
      [    5.789011] 4.13.0-rc7-02179-g32fae27c725d #70 Not tainted
      [    5.794561] --------------------------------
      [    5.798890] inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
      [    5.804971] swapper/0/0 [HC0[0]:SC1[1]:HE0:SE0] takes:
      [    5.810175]  (&syncp->seq#2){+.?...}, at: [<c0768a28>] bcm_sysport_tx_reclaim+0x30/0x54
      [    5.818327] {SOFTIRQ-ON-W} state was registered at:
      [    5.823278]   bcm_sysport_get_stats64+0x17c/0x258
      [    5.828053]   dev_get_stats+0x38/0xac
      [    5.831776]   rtnl_fill_stats+0x30/0x118
      [    5.835761]   rtnl_fill_ifinfo+0x538/0xe24
      [    5.839921]   rtmsg_ifinfo_build_skb+0x6c/0xd8
      [    5.844430]   rtmsg_ifinfo_event.part.5+0x14/0x44
      [    5.849201]   rtmsg_ifinfo+0x20/0x28
      [    5.852837]   register_netdevice+0x628/0x6b8
      [    5.857171]   register_netdev+0x14/0x24
      [    5.861051]   bcm_sysport_probe+0x30c/0x438
      [    5.865280]   platform_drv_probe+0x50/0xb0
      [    5.869418]   driver_probe_device+0x2e8/0x450
      [    5.873817]   __driver_attach+0x104/0x120
      [    5.877871]   bus_for_each_dev+0x7c/0xc0
      [    5.881834]   bus_add_driver+0x1b0/0x270
      [    5.885797]   driver_register+0x78/0xf4
      [    5.889675]   do_one_initcall+0x54/0x190
      [    5.893646]   kernel_init_freeable+0x144/0x1d0
      [    5.898135]   kernel_init+0x8/0x110
      [    5.901665]   ret_from_fork+0x14/0x2c
      [    5.905363] irq event stamp: 24263
      [    5.908804] hardirqs last  enabled at (24262): [<c08eecf0>] net_rx_action+0xc4/0x4e4
      [    5.916624] hardirqs last disabled at (24263): [<c0a7da00>] _raw_spin_lock_irqsave+0x1c/0x98
      [    5.925143] softirqs last  enabled at (24258): [<c022a7fc>] irq_enter+0x84/0x98
      [    5.932524] softirqs last disabled at (24259): [<c022a918>] irq_exit+0x108/0x16c
      [    5.939985]
      [    5.939985] other info that might help us debug this:
      [    5.946576]  Possible unsafe locking scenario:
      [    5.946576]
      [    5.952556]        CPU0
      [    5.955031]        ----
      [    5.957506]   lock(&syncp->seq#2);
      [    5.960955]   <Interrupt>
      [    5.963604]     lock(&syncp->seq#2);
      [    5.967227]
      [    5.967227]  *** DEADLOCK ***
      [    5.967227]
      [    5.973222] 1 lock held by swapper/0/0:
      [    5.977092]  #0:  (&(&ring->lock)->rlock){..-...}, at: [<c0768a18>] bcm_sysport_tx_reclaim+0x20/0x54
      
      So just remove the u64_stats_update_begin()/end() pair in ndo_get_stats64()
      since it does not appear to be useful for anything. No inconsistency was
      observed with either ifconfig or ethtool, global TX counts equal the sum of
      per-queue TX counts on a 32-bit architecture.
      
      Fixes: 10377ba7 ("net: systemport: Support 64bit statistics")
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7095c973
    • A
      net: vrf: avoid gcc-4.6 warning · ecf09117
      Arnd Bergmann 提交于
      When building an allmodconfig kernel with gcc-4.6, we get a rather
      odd warning:
      
      drivers/net/vrf.c: In function ‘vrf_ip6_input_dst’:
      drivers/net/vrf.c:964:3: error: initialized field with side-effects overwritten [-Werror]
      drivers/net/vrf.c:964:3: error: (near initialization for ‘fl6’) [-Werror]
      
      I have no idea what this warning is even trying to say, but it does
      seem like a false positive. Reordering the initialization in to match
      the structure definition gets rid of the warning, and might also avoid
      whatever gcc thinks is wrong here.
      
      Fixes: 9ff74384 ("net: vrf: Handle ipv6 multicast and link-local addresses")
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ecf09117