1. 04 7月, 2013 1 次提交
  2. 15 1月, 2013 2 次提交
    • 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
  3. 14 1月, 2013 1 次提交
  4. 16 7月, 2012 1 次提交
    • J
      PCI: hotplug: ensure a consistent return value in error case · 83d05710
      Julia Lawall 提交于
      Typically, the return value desired for the failure of a function with an
      integer return value is a negative integer.  In these cases, the return
      value is sometimes a negative integer and sometimes 0, due to a subsequent
      initialization of the return variable within the loop.
      
      A simplified version of the semantic match that finds this problem is:
      (http://coccinelle.lip6.fr/)
      
      //<smpl>
      @r exists@
      identifier ret;
      position p;
      constant C;
      expression e1,e3,e4;
      statement S;
      @@
      
      ret = -C
      ... when != ret = e3
          when any
      if@p (...) S
      ... when any
      if (\(ret != 0\|ret < 0\|ret > 0\) || ...) { ... return ...; }
      ... when != ret = e3
          when any
      *if@p (...)
      {
        ... when != ret = e4
        return ret;
      }
      //</smpl>
      
      [bhelgaas: squashed into one patch]
      Signed-off-by: NJulia Lawall <Julia.Lawall@lip6.fr>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      83d05710
  5. 13 1月, 2012 1 次提交
  6. 15 11月, 2011 1 次提交
  7. 18 10月, 2010 1 次提交
    • T
      shpchp: update workqueue usage · e24dcbef
      Tejun Heo 提交于
      * Rename shpchp_wq to shpchp_ordered_wq and add non-ordered shpchp_wq
        which is used instead of the system workqueue.  This is to remove
        the use of flush_scheduled_work() which is deprecated and scheduled
        for removal.
      
      * With cmwq in place, there's no point in creating workqueues lazily.
        Create both shpchp_wq and shpchp_ordered_wq upfront.
      
      * Include workqueue.h from shpchp.h.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Acked-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      e24dcbef
  8. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  9. 23 2月, 2010 1 次提交
  10. 17 6月, 2009 1 次提交
  11. 24 10月, 2008 2 次提交
  12. 23 10月, 2008 3 次提交
    • A
      PCI: shcphp: remove 'name' parameter · 66f17055
      Alex Chiang 提交于
      We do not need to manage our own name parameter, especially since
      the PCI core can change it on our behalf, in the case of duplicate
      slot names.
      
      Remove 'name' from shpchp's version of struct slot.
      
      This change also removes the unused struct task_event from the
      slot structure.
      
      Cc: kristen.c.accardi@intel.com
      Acked-by: NKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
      Signed-off-by: NAlex Chiang <achiang@hp.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      66f17055
    • A
      PCI: prevent duplicate slot names · 5fe6cc60
      Alex Chiang 提交于
      Prevent callers of pci_create_slot() from registering slots with
      duplicate names. This condition occurs most often when PCI hotplug
      drivers are loaded on platforms with broken firmware that assigns
      identical names to multiple slots.
      
      We now rename these duplicate slots on behalf of the user.
      
      If firmware assigns the name N to multiple slots, then:
      
      	The first registered slot is assigned N
      	The second registered slot is assigned N-1
      	The third registered slot is assigned N-2
      	etc.
      
      This is the permanent fix mentioned in earlier commits d6a9e9b4 and
      167e782e (shpchp/pciehp: Rename duplicate slot name...).
      
      We take advantage of the new 'hotplug' parameter in pci_create_slot()
      to prevent a slot create/rename race between hotplug drivers and
      detection drivers.
      
      	Scenario A:
      	hotplug driver                  detection driver
      	--------------                  ----------------
      	pci_create_slot(hotplug=set)
      					pci_create_slot(hotplug=NULL)
      
      The hotplug driver creates the slot with its desired name, and then
      releases the semaphore. Now, the detection driver tries to create
      the same slot, but it already exists. We don't care about renaming,
      so return the existing slot.
      
      	Scenario B:
      	hotplug driver                  detection driver
      	--------------                  ----------------
      					pci_create_slot(hotplug=NULL)
      	pci_create_slot(hotplug=set)
      
      The detection driver creates the slot with name "X". Then the hotplug
      driver tries to create the same slot, but wants the name "Y" instead.
      We detect that we're trying to create the same slot and that we also
      want a rename, so rename the slot to "Y" and return.
      
      	Scenario C:
      	hotplug driver                  hotplug driver
      	--------------                  ----------------
      	pci_create_slot(hotplug=set)
      					pci_create_slot(hotplug=set)
      
      Two separate hotplug drivers are attempting to claim the slot and
      are passing valid hotplug_slot args to pci_create_slot(). We detect
      that the slot already has a ->hotplug callback, prevent a rename,
      and return -EBUSY.
      
      Cc: kristen.c.accardi@intel.com
      Cc: matthew@wil.cx
      Acked-by: NKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
      Signed-off-by: NAlex Chiang <achiang@hp.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      5fe6cc60
    • A
      PCI Hotplug core: add 'name' param pci_hp_register interface · 1359f270
      Alex Chiang 提交于
      Update pci_hp_register() to take a const char *name parameter.
      
      The motivation for this is to clean up the individual hotplug
      drivers so that each one does not have to manage its own name.
      The PCI core should be the place where we manage the name.
      
      We update the interface and all callsites first, in a
      "no functional change" manner, and clean up the drivers later.
      
      Cc: kristen.c.accardi@intel.com
      Acked-by: NKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
      Reviewed-by: NMatthew Wilcox <willy@linux.intel.com>
      Signed-off-by: NAlex Chiang <achiang@hp.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      1359f270
  13. 22 8月, 2008 1 次提交
    • A
      PCI: shpchp: Rename duplicate slot name N as N-1, N-2, N-M... · d6a9e9b4
      Alex Chiang 提交于
      Commit ef0ff95f (shpchp: fix slot name)
      introduces the shpchp_slot_with_bus module parameter, which was intended
      to help work around broken firmware that assigns the same name to multiple
      slots.
      
      Commit b3bd307c (shpchp: add message about
      shpchp_slot_with_bus option) tells the user to use the above parameter
      in the event of a name collision.
      
      This approach is sub-optimal because it requires too much work from
      the user.
      
      Instead, let's rename the slot on behalf of the user. If firmware
      assigns the name N to multiple slots, then:
      
      	The first registered slot is assigned N
      	The second registered slot is assigned N-1
      	The third registered slot is assigned N-2
      	The Mth registered slot becomes N-M
      
      In the event we overflow the slot->name parameter, we report an
      error to the user.
      
      This is a temporary fix until the entire PCI core can be reworked
      such that individual drivers no longer have to manage their own
      slot names.
      Tested-by: NKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
      Acked-by: NKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
      Signed-off-by: NAlex Chiang <achiang@hp.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      d6a9e9b4
  14. 11 6月, 2008 3 次提交
    • A
      PCI: introduce pci_slot · f46753c5
      Alex Chiang 提交于
      Currently, /sys/bus/pci/slots/ only exposes hotplug attributes when a
      hotplug driver is loaded, but PCI slots have attributes such as address,
      speed, width, etc.  that are not related to hotplug at all.
      
      Introduce pci_slot as the primary data structure and kobject model.
      Hotplug attributes described in hotplug_slot become a secondary
      structure associated with the pci_slot.
      
      This patch only creates the infrastructure that allows the separation of
      PCI slot attributes and hotplug attributes.  In this patch, the PCI
      hotplug core remains the only user of this infrastructure, and thus,
      /sys/bus/pci/slots/ will still only become populated when a hotplug
      driver is loaded.
      
      A later patch in this series will add a second user of this new
      infrastructure and demonstrate splitting the task of exposing pci_slot
      attributes from hotplug_slot attributes.
      
        - Make pci_slot the primary sysfs entity. hotplug_slot becomes a
          subsidiary structure.
          o pci_create_slot() creates and registers a slot with the PCI core
          o pci_slot_add_hotplug() gives it hotplug capability
      
        - Change the prototype of pci_hp_register() to take the bus and
          slot number (on parent bus) as parameters.
      
        - Remove all the ->get_address methods since this functionality is
          now handled by pci_slot directly.
      
      [achiang@hp.com: rpaphp-correctly-pci_hp_register-for-empty-pci-slots]
      Tested-by: NBadari Pulavarty <pbadari@us.ibm.com>
      Acked-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      [akpm@linux-foundation.org: build fix]
      [akpm@linux-foundation.org: make headers_check happy]
      [akpm@linux-foundation.org: nuther build fix]
      [akpm@linux-foundation.org: fix typo in #include]
      Signed-off-by: NAlex Chiang <achiang@hp.com>
      Signed-off-by: NMatthew Wilcox <matthew@wil.cx>
      Cc: Greg KH <greg@kroah.com>
      Cc: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
      Cc: Len Brown <lenb@kernel.org>
      Acked-by: NKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      f46753c5
    • K
      shpchp: check firmware before taking control · ac9c052d
      Kenji Kaneshige 提交于
      Fix the following problems of shpchp driver about getting hotplug
      control from firmware.
      
        - The shpchp driver must not control the hotplug controller if it
          fails to get control from the firmware. But current shpchp
          controls the hotplug controller regardless the result, because it
          doesn't check the return value of get_hp_hw_control_from_firmware().
      
        - Current shpchp driver doesn't support _OSC.
      
      The pciehp driver already have the code for evaluating _OSC and OSHP
      and shpchp and pciehp can share it. So this patch move that code from
      pciehp to acpi_pcihp.c.
      Signed-off-by: NKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      ac9c052d
    • A
      PCI: make {pciehp,shpchp}_slot_with_bus static · 552fe04a
      Adrian Bunk 提交于
      This patch makes the needlessly global {pciehp,shpchp}_slot_with_bus
      static.
      Signed-off-by: NAdrian Bunk <bunk@kernel.org>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      552fe04a
  15. 28 5月, 2008 1 次提交
  16. 26 4月, 2008 1 次提交
  17. 21 4月, 2008 1 次提交
  18. 03 5月, 2007 1 次提交
  19. 08 2月, 2007 1 次提交
  20. 21 12月, 2006 4 次提交
  21. 22 11月, 2006 1 次提交
  22. 27 9月, 2006 1 次提交
  23. 20 6月, 2006 1 次提交
  24. 24 3月, 2006 8 次提交