1. 18 5月, 2013 1 次提交
  2. 18 4月, 2013 2 次提交
  3. 17 4月, 2013 4 次提交
  4. 16 4月, 2013 3 次提交
  5. 13 4月, 2013 5 次提交
  6. 14 2月, 2013 2 次提交
  7. 13 2月, 2013 1 次提交
    • R
      ACPI / hotplug: Fix concurrency issues and memory leaks · 3757b948
      Rafael J. Wysocki 提交于
      This changeset is aimed at fixing a few different but related
      problems in the ACPI hotplug infrastructure.
      
      First of all, since notify handlers may be run in parallel with
      acpi_bus_scan(), acpi_bus_trim() and acpi_bus_hot_remove_device()
      and some of them are installed for ACPI handles that have no struct
      acpi_device objects attached (i.e. before those objects are created),
      those notify handlers have to take acpi_scan_lock to prevent races
      from taking place (e.g. a struct acpi_device is found to be present
      for the given ACPI handle, but right after that it is removed by
      acpi_bus_trim() running in parallel to the given notify handler).
      Moreover, since some of them call acpi_bus_scan() and
      acpi_bus_trim(), this leads to the conclusion that acpi_scan_lock
      should be acquired by the callers of these two funtions rather by
      these functions themselves.
      
      For these reasons, make all notify handlers that can handle device
      addition and eject events take acpi_scan_lock and remove the
      acpi_scan_lock locking from acpi_bus_scan() and acpi_bus_trim().
      Accordingly, update all of their users to make sure that they
      are always called under acpi_scan_lock.
      
      Furthermore, since eject operations are carried out asynchronously
      with respect to the notify events that trigger them, with the help
      of acpi_bus_hot_remove_device(), even if notify handlers take the
      ACPI scan lock, it still is possible that, for example,
      acpi_bus_trim() will run between acpi_bus_hot_remove_device() and
      the notify handler that scheduled its execution and that
      acpi_bus_trim() will remove the device node passed to
      acpi_bus_hot_remove_device() for ejection.  In that case, the struct
      acpi_device object obtained by acpi_bus_hot_remove_device() will be
      invalid and not-so-funny things will ensue.  To protect agaist that,
      make the users of acpi_bus_hot_remove_device() run get_device() on
      ACPI device node objects that are about to be passed to it and make
      acpi_bus_hot_remove_device() run put_device() on them and check if
      their ACPI handles are not NULL (make acpi_device_unregister() clear
      the device nodes' ACPI handles for that check to work).
      
      Finally, observe that acpi_os_hotplug_execute() actually can fail,
      in which case its caller ought to free memory allocated for the
      context object to prevent leaks from happening.  It also needs to
      run put_device() on the device node that it ran get_device() on
      previously in that case.  Modify the code accordingly.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      3757b948
  8. 03 2月, 2013 1 次提交
    • J
      PCI: acpiphp: Remove dead code for PCI host bridge hotplug · be6d2867
      Jiang Liu 提交于
      Commit 668192b6 "PCI: acpiphp: Move host bridge hotplug
      to pci_root.c" has moved PCI host bridge hotplug logic from acpiphp
      to pci_root, but there is still PCI host bridge hotplug related
      dead code left in acpiphp. So remove those dead code.
      
      Now companion ACPI devices are always created before corresponding
      PCI devices. And the ACPI event handle_hotplug_event_bridge() will be
      installed only if it has associated PCI device. So remove dead code to
      handle bridge hot-adding in function handle_hotplug_event_bridge().
      Signed-off-by: NJiang Liu <jiang.liu@huawei.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      be6d2867
  9. 02 2月, 2013 2 次提交
  10. 26 1月, 2013 9 次提交
  11. 19 1月, 2013 1 次提交
    • R
      ACPI / scan: Drop acpi_bus_add() and use acpi_bus_scan() instead · b8bd759a
      Rafael J. Wysocki 提交于
      The only difference between acpi_bus_scan() and acpi_bus_add() is the
      invocation of acpi_update_all_gpes() in the latter which in fact is
      unnecessary, because acpi_update_all_gpes() has already been called
      by acpi_scan_init() and the way it is implemented guarantees the next
      invocations of it to do nothing.
      
      For this reason, drop acpi_bus_add() and make all its callers use
      acpi_bus_scan() directly instead of it.  Additionally, rearrange the
      code in acpi_scan_init() slightly to improve the visibility of the
      acpi_update_all_gpes() call in there.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      b8bd759a
  12. 15 1月, 2013 3 次提交
    • R
      ACPI / scan: Drop the second argument of acpi_bus_trim() · ae281795
      Rafael J. Wysocki 提交于
      All callers of acpi_bus_trim() pass 1 (true) as the second argument
      of it, so remove that argument entirely and change acpi_bus_trim()
      to always behave as though it were 1.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NYasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
      ae281795
    • B
      PCI: shpchp: Use per-slot workqueues to avoid deadlock · f652e7d2
      Bjorn Helgaas 提交于
      When we have an SHPC-capable bridge with a second SHPC-capable bridge
      below it, pushing the upstream bridge's attention button causes a
      deadlock.
      
      The deadlock happens because we use the shpchp_wq workqueue to run
      shpchp_pushbutton_thread(), which uses shpchp_disable_slot() to remove
      devices below the upstream bridge.  When we remove the downstream bridge,
      we call shpc_remove(), the shpchp driver's .remove() method.  That calls
      flush_workqueue(shpchp_wq), which deadlocks because the
      shpchp_pushbutton_thread() work item is still running.
      
      This patch avoids the deadlock by creating a workqueue for every slot
      and removing the single shared workqueue.
      
      Here's the call path that leads to the deadlock:
      
        shpchp_queue_pushbutton_work
          queue_work(shpchp_wq)		# shpchp_pushbutton_thread
          ...
      
        shpchp_pushbutton_thread
          shpchp_disable_slot
            remove_board
              shpchp_unconfigure_device
                pci_stop_and_remove_bus_device
                  ...
                    shpc_remove		# shpchp driver .remove method
                      hpc_release_ctlr
                        cleanup_slots
                          flush_workqueue(shpchp_wq)
      
      This change is based on code inspection, since we don't have hardware
      with this topology.
      Based-on-patch-by: NYijing Wang <wangyijing@huawei.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      CC: stable@vger.kernel.org
      f652e7d2
    • B
      PCI: shpchp: Handle push button event asynchronously · d347e758
      Bjorn Helgaas 提交于
      Use non-ordered workqueue for attention button events.
      
      Attention button events on each slot can be handled asynchronously. So
      we should use non-ordered workqueue. This patch also removes ordered
      workqueue in shpchp as a result.
      
      486b10b9 ("PCI: pciehp: Handle push button event asynchronously") made
      the same change to pciehp.  I split this out from a patch by Yijing Wang
      <wangyijing@huawei.com> so we fix one thing at a time and to make the
      shpchp history correspond more closely with the pciehp history.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      CC: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
      d347e758
  13. 14 1月, 2013 1 次提交
  14. 13 1月, 2013 1 次提交
    • Y
      PCI: pciehp: Use per-slot workqueues to avoid deadlock · c2be6f93
      Yijing Wang 提交于
      When we have a hotplug-capable PCIe port with a second hotplug-capable
      PCIe port below it, removing the device below the upstream port causes
      a deadlock.
      
      The deadlock happens because we use the pciehp_wq workqueue to run
      pciehp_power_thread(), which uses pciehp_disable_slot() to remove devices
      below the upstream port.  When we remove the downstream PCIe port, we call
      pciehp_remove(), the pciehp driver's .remove() method.  That calls
      flush_workqueue(pciehp_wq), which deadlocks because the
      pciehp_power_thread() work item is still running.
      
      This patch avoids the deadlock by creating a workqueue for every PCIe port
      and removing the single shared workqueue.
      
      Here's the call path that leads to the deadlock:
      
        pciehp_queue_pushbutton_work
          queue_work(pciehp_wq)                   # queue pciehp_power_thread
          ...
      
        pciehp_power_thread
          pciehp_disable_slot
            remove_board
      	pciehp_unconfigure_device
      	  pci_stop_and_remove_bus_device
      	    ...
      	      pciehp_remove                 # pciehp driver .remove method
      		pciehp_release_ctrl
      		  pcie_cleanup_slot
      		    flush_workqueue(pciehp_wq)
      
      This is fairly urgent because it can be caused by simply unplugging a
      Thunderbolt adapter, as reported by Daniel below.
      
      [bhelgaas: changelog]
      Reference: http://lkml.kernel.org/r/CAMVG2ssiRgcTD1bej2tkUUfsWmpL5eNtPcNif9va2-Gzb2u8nQ@mail.gmail.comReported-and-tested-by: NDaniel J Blueman <daniel@quora.org>
      Reviewed-by: NKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
      Signed-off-by: NYijing Wang <wangyijing@huawei.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      CC: stable@vger.kernel.org
      c2be6f93
  15. 08 1月, 2013 1 次提交
  16. 03 1月, 2013 3 次提交
    • R
      ACPI: Make acpi_bus_scan() and acpi_bus_add() take only one argument · 0cd6ac52
      Rafael J. Wysocki 提交于
      The callers of acpi_bus_add() usually assume that if it has
      succeeded, then a struct acpi_device object has been attached to
      the handle passed as the first argument.  Unfortunately, however,
      this assumption is wrong, because acpi_bus_scan(), and acpi_bus_add()
      too as a result, may return a pointer to a different struct
      acpi_device object on success (it may be an object corresponding to
      one of the descendant ACPI nodes in the namespace scope below that
      handle).
      
      For this reason, the callers of acpi_bus_add() who care about
      whether or not a struct acpi_device object has been created for
      its first argument need to check that using acpi_bus_get_device()
      anyway, so the second argument of acpi_bus_add() is not really
      useful for them.  The same observation applies to acpi_bus_scan()
      executed directly from acpi_scan_init().
      
      Therefore modify the relevant callers of acpi_bus_add() to check the
      existence of the struct acpi_device in question with the help of
      acpi_bus_get_device() and drop the no longer necessary second
      argument of acpi_bus_add().  Accordingly, modify acpi_scan_init() to
      use acpi_bus_get_device() to get acpi_root and drop the no longer
      needed second argument of acpi_bus_scan().
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      0cd6ac52
    • R
      ACPI: Remove the arguments of acpi_bus_add() that are not used · 636458de
      Rafael J. Wysocki 提交于
      Notice that acpi_bus_add() uses only 2 of its 4 arguments and
      redefine its header to match the body.  Update all of its callers as
      necessary and observe that this leads to quite a number of removed
      lines of code (Linus will like that).
      
      Add a kerneldoc comment documenting acpi_bus_add() and wonder how
      its callers make wrong assumptions about the second argument (make
      note to self to take care of that later).
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      636458de
    • R
      ACPI: Remove acpi_start_single_object() and acpi_bus_start() · 02f57c67
      Rafael J. Wysocki 提交于
      The ACPI PCI root bridge driver was the only ACPI driver implementing
      the .start() callback, which isn't used by any ACPI drivers any more
      now.
      
      For this reason, acpi_start_single_object() has no purpose any more,
      so remove it and all references to it.  Also remove
      acpi_bus_start_device(), whose only purpose was to call
      acpi_start_single_object().
      
      Moreover, since after the removal of acpi_bus_start_device() the
      only purpose of acpi_bus_start() remains to call
      acpi_update_all_gpes(), move that into acpi_bus_add() and drop
      acpi_bus_start() too, remove its header from acpi_bus.h and
      update all of its former users accordingly.
      
      This change was previously proposed in a different from by
      Yinghai Lu.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      02f57c67