1. 30 8月, 2017 4 次提交
    • S
      PCI: Wait up to 60 seconds for device to become ready after FLR · 821cdad5
      Sinan Kaya 提交于
      Sporadic reset issues have been observed with an Intel 750 NVMe drive while
      assigning the physical function to the guest machine.  The sequence of
      events observed is as follows:
      
        - perform a Function Level Reset (FLR)
        - sleep up to 1000ms total
        - read ~0 from PCI_COMMAND (CRS completion for config read)
        - warn that the device didn't return from FLR
        - touch the device before it's ready
        - device drops config writes when we restore register settings (there's
          no mechanism for software to learn about CRS completions for writes)
        - incomplete register restore leaves device in inconsistent state
        - device probe fails because device is in inconsistent state
      
      After reset, an endpoint may respond to config requests with Configuration
      Request Retry Status (CRS) to indicate that it is not ready to accept new
      requests. See PCIe r3.1, sec 2.3.1 and 6.6.2.
      
      Increase the timeout value from 1 second to 60 seconds to cover the period
      where device responds with CRS and also report polling progress.
      Signed-off-by: NSinan Kaya <okaya@codeaurora.org>
      [bhelgaas: include the mandatory 100ms in the delays we print]
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      821cdad5
    • S
      PCI: Factor out pci_bus_wait_crs() · 6a802ef0
      Sinan Kaya 提交于
      Configuration Request Retry Status (CRS) was previously hidden inside
      pci_bus_read_dev_vendor_id().  We want to add support for CRS in other
      situations, such as waiting for a device to become ready after a Function
      Level Reset.
      
      Move CRS handling into pci_bus_wait_crs() so it can be called from other
      places.
      Signed-off-by: NSinan Kaya <okaya@codeaurora.org>
      [bhelgaas: pass pointer, not value, to pci_bus_wait_crs() so caller gets
      correct Vendor ID]
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      6a802ef0
    • S
      PCI: Add pci_bus_crs_vendor_id() to detect CRS response data · 62bc6a6f
      Sinan Kaya 提交于
      Add pci_bus_crs_vendor_id() to determine whether data returned for a config
      read of the Vendor ID indicates a Configuration Request Retry Status (CRS)
      response.
      
      Per PCIe r3.1, sec 2.3.2, this data is only returned if:
      
        - CRS Software Visibility is enabled,
        - a config read includes both bytes of the Vendor ID, and
        - the read receives a CRS completion
      Signed-off-by: NSinan Kaya <okaya@codeaurora.org>
      [bhelgaas: changelog, change name to pci_bus_crs_vendor_id(), make static
      in probe.c, use it in pci_bus_read_dev_vendor_id()]
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      62bc6a6f
    • B
      PCI: Always check for non-CRS response before timeout · 9f982756
      Bjorn Helgaas 提交于
      While waiting for a device to become ready (i.e., to return a non-CRS
      completion to a read of its Vendor ID), if we got a valid response to the
      very last read before timing out, we printed a warning and gave up on the
      device even though it was actually ready.
      
      For a typical 60s timeout, we wait about 65s (it's not exact because of the
      exponential backoff), but we treated devices that became ready between 33s
      and 65s as though they failed.
      
      Move the Device ID read later so we check whether the device is ready
      before checking for a timeout.
      
      Thanks to Sinan Kaya <okaya@codeaurora.org>, reorder reads so we always
      check device presence after sleep, since it's pointless to sleep unless we
      recheck afterwards.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      9f982756
  2. 19 8月, 2017 1 次提交
    • S
      PCI: Avoid race while enabling upstream bridges · 40f11adc
      Srinath Mannam 提交于
      When we enable a device, we first enable any upstream bridges.  If a bridge
      has multiple downstream devices and we enable them simultaneously, the race
      to enable the upstream bridge may cause problems.  Consider this hierarchy:
      
        bridge A --+-- device B
                   +-- device C
      
      If drivers for B and C call pci_enable_device() simultaneously, both will
      attempt to enable A, which involves setting PCI_COMMAND_MASTER via
      pci_set_master() and PCI_COMMAND_MEMORY via pci_enable_resources().
      
      In the following sequence, B's update to set A's PCI_COMMAND_MEMORY is
      lost, and neither B nor C will work correctly:
      
            B                                C
        pci_set_master(A)
          cmd = read(A, PCI_COMMAND)
          cmd |= PCI_COMMAND_MASTER
                                         pci_set_master(A)
                                           cmd = read(A, PCI_COMMAND)
                                           cmd |= PCI_COMMAND_MASTER
          write(A, PCI_COMMAND, cmd)
        pci_enable_device(A)
          pci_enable_resources(A)
            cmd = read(A, PCI_COMMAND)
            cmd |= PCI_COMMAND_MEMORY
            write(A, PCI_COMMAND, cmd)
                                           write(A, PCI_COMMAND, cmd)
      
      Avoid this race by holding a new pci_bridge_mutex while enabling a bridge.
      This ensures that both PCI_COMMAND_MASTER and PCI_COMMAND_MEMORY will be
      updated before another thread can start enabling the bridge.
      
      Note that although pci_enable_bridge() is recursive, it enables any
      upstream bridges *before* acquiring the mutex.  When it acquires the mutex
      and calls pci_set_master() and pci_enable_device(), any upstream bridges
      have already been enabled so pci_enable_device() will not deadlock by
      calling pci_enable_bridge() again.
      Signed-off-by: NSrinath Mannam <srinath.mannam@broadcom.com>
      [bhelgaas: changelog, comment]
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      40f11adc
  3. 01 8月, 2017 1 次提交
  4. 28 7月, 2017 13 次提交
  5. 27 7月, 2017 17 次提交
  6. 26 7月, 2017 4 次提交
    • S
      nvme: validate admin queue before unquiesce · 7dd1ab16
      Scott Bauer 提交于
      With a misbehaving controller it's possible we'll never
      enter the live state and create an admin queue. When we
      fail out of reset work it's possible we failed out early
      enough without setting up the admin queue. We tear down
      queues after a failed reset, but needed to do some more
      sanitization.
      
      Fixes 443bd90f: "nvme: host: unquiesce queue in nvme_kill_queues()"
      
      [  189.650995] nvme nvme1: pci function 0000:0b:00.0
      [  317.680055] nvme nvme0: Device not ready; aborting reset
      [  317.680183] nvme nvme0: Removing after probe failure status: -19
      [  317.681258] kasan: GPF could be caused by NULL-ptr deref or user memory access
      [  317.681397] general protection fault: 0000 [#1] SMP KASAN
      [  317.682984] CPU: 3 PID: 477 Comm: kworker/3:2 Not tainted 4.13.0-rc1+ #5
      [  317.683112] Hardware name: Gigabyte Technology Co., Ltd. Z170X-UD5/Z170X-UD5-CF, BIOS F5 03/07/2016
      [  317.683284] Workqueue: events nvme_remove_dead_ctrl_work [nvme]
      [  317.683398] task: ffff8803b0990000 task.stack: ffff8803c2ef0000
      [  317.683516] RIP: 0010:blk_mq_unquiesce_queue+0x2b/0xa0
      [  317.683614] RSP: 0018:ffff8803c2ef7d40 EFLAGS: 00010282
      [  317.683716] RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 1ffff1006fbdcde3
      [  317.683847] RDX: 0000000000000038 RSI: 1ffff1006f5a9245 RDI: 0000000000000000
      [  317.683978] RBP: ffff8803c2ef7d58 R08: 1ffff1007bcdc974 R09: 0000000000000000
      [  317.684108] R10: 1ffff1007bcdc975 R11: 0000000000000000 R12: 00000000000001c0
      [  317.684239] R13: ffff88037ad49228 R14: ffff88037ad492d0 R15: ffff88037ad492e0
      [  317.684371] FS:  0000000000000000(0000) GS:ffff8803de6c0000(0000) knlGS:0000000000000000
      [  317.684519] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  317.684627] CR2: 0000002d1860c000 CR3: 000000045b40d000 CR4: 00000000003406e0
      [  317.684758] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [  317.684888] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [  317.685018] Call Trace:
      [  317.685084]  nvme_kill_queues+0x4d/0x170 [nvme_core]
      [  317.685185]  nvme_remove_dead_ctrl_work+0x3a/0x90 [nvme]
      [  317.685289]  process_one_work+0x771/0x1170
      [  317.685372]  worker_thread+0xde/0x11e0
      [  317.685452]  ? pci_mmcfg_check_reserved+0x110/0x110
      [  317.685550]  kthread+0x2d3/0x3d0
      [  317.685617]  ? process_one_work+0x1170/0x1170
      [  317.685704]  ? kthread_create_on_node+0xc0/0xc0
      [  317.685785]  ret_from_fork+0x25/0x30
      [  317.685798] Code: 0f 1f 44 00 00 55 48 b8 00 00 00 00 00 fc ff df 48 89 e5 41 54 4c 8d a7 c0 01 00 00 53 48 89 fb 4c 89 e2 48 c1 ea 03 48 83 ec 08 <80> 3c 02 00 75 50 48 8b bb c0 01 00 00 e8 33 8a f9 00 0f ba b3
      [  317.685872] RIP: blk_mq_unquiesce_queue+0x2b/0xa0 RSP: ffff8803c2ef7d40
      [  317.685908] ---[ end trace a3f8704150b1e8b4 ]---
      Signed-off-by: NScott Bauer <scott.bauer@intel.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      7dd1ab16
    • N
      perf: qcom_l2: fix column exclusion check · 6c17c1c3
      Neil Leeder 提交于
      The check for column exclusion did not verify that the event being
      checked was an L2 event, and not a software event.
      Software events should not be checked for column exclusion.
      This resulted in a group with both software and L2 events sometimes
      incorrectly rejecting the L2 event for column exclusion and
      not counting it.
      
      Add a check for PMU type before applying column exclusion logic.
      
      Fixes: 21bdbb71 ("perf: add qcom l2 cache perf events driver")
      Acked-by: NMark Rutland <mark.rutland@arm.com>
      Signed-off-by: NNeil Leeder <nleeder@codeaurora.org>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      6c17c1c3
    • S
      MD: fix warnning for UP case · ed9b66d2
      Shaohua Li 提交于
      spin_is_locked always returns 0 for UP case, so ignores it
      Reported-by: NJoshua Kinard <kumba@gentoo.org>
      Signed-off-by: NShaohua Li <shli@fb.com>
      ed9b66d2
    • E