1. 01 11月, 2011 1 次提交
  2. 15 10月, 2011 1 次提交
    • P
      PCI hotplug: acpiphp: Prevent deadlock on PCI-to-PCI bridge remove · 6af8bef1
      Prarit Bhargava 提交于
      I originally submitted a patch to workaround this by pushing all Ejection
      Requests and Device Checks onto the kacpi_hotplug queue.
      
      http://marc.info/?l=linux-acpi&m=131678270930105&w=2
      
      The patch is still insufficient in that Bus Checks also need to be added.
      
      Rather than add all events, including non-PCI-hotplug events, to the
      hotplug queue, mjg suggested that a better approach would be to modify
      the acpiphp driver so only acpiphp events would be added to the
      kacpi_hotplug queue.
      
      It's a longer patch, but at least we maintain the benefit of having separate
      queues in ACPI.  This, of course, is still only a workaround the problem.
      As Bjorn and mjg pointed out, we have to refactor a lot of this code to do
      the right thing but at this point it is a better to have this code working.
      
      The acpi core places all events on the kacpi_notify queue.  When the acpiphp
      driver is loaded and a PCI card with a PCI-to-PCI bridge is removed the
      following call sequence occurs:
      
      cleanup_p2p_bridge()
      	    -> cleanup_bridge()
      		    -> acpi_remove_notify_handler()
      			    -> acpi_os_wait_events_complete()
      				    -> flush_workqueue(kacpi_notify_wq)
      
      which is the queue we are currently executing on and the process will hang.
      
      Move all hotplug acpiphp events onto the kacpi_hotplug workqueue.  In
      handle_hotplug_event_bridge() and handle_hotplug_event_func() we can simply
      push the rest of the work onto the kacpi_hotplug queue and then avoid the
      deadlock.
      Signed-off-by: NPrarit Bhargava <prarit@redhat.com>
      Cc: mjg@redhat.com
      Cc: bhelgaas@google.com
      Cc: linux-acpi@vger.kernel.org
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      6af8bef1
  3. 17 7月, 2011 1 次提交
  4. 12 5月, 2011 1 次提交
  5. 31 3月, 2011 1 次提交
  6. 05 3月, 2011 1 次提交
    • S
      PCI hotplug: acpiphp: set current_state to D0 in register_slot · 47e9037a
      Stefano Stabellini 提交于
      If a device doesn't support power management (pm_cap == 0) but it is
      acpi_pci_power_manageable() because there is a _PS0 method declared for
      it and _EJ0 is also declared for the slot then nobody is going to set
      current_state = PCI_D0 for this device.  This is what I think it is
      happening:
      
      pci_enable_device
          |
      __pci_enable_device_flags
      /* here we do not set current_state because !pm_cap */
          |
      do_pci_enable_device
          |
      pci_set_power_state
          |
      __pci_start_power_transition
          |
      pci_platform_power_transition
      /* platform_pci_power_manageable() calls acpi_pci_power_manageable that
       * returns true */
          |
      platform_pci_set_power_state
      /* acpi_pci_set_power_state gets called and does nothing because the
       * acpi device has _EJ0, see the comment "If the ACPI device has _EJ0,
       * ignore the device" */
      
      at this point if we refer to the commit message that introduced the
      comment above (10b3dcae), it is up to
      the hotplug driver to set the state to D0.
      However AFAICT the pci hotplug driver never does, in fact
      drivers/pci/hotplug/acpiphp_glue.c:register_slot sets the slot flags to
      (SLOT_ENABLED | SLOT_POWEREDON) but it does not set the pci device
      current state to PCI_D0.
      
      So my proposed fix is also to set current_state = PCI_D0 in
      register_slot.
      Comments are very welcome.
      Signed-off-by: NStefano Stabellini <stefano.stabellini@eu.citrix.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      47e9037a
  7. 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
  8. 15 3月, 2010 1 次提交
  9. 01 2月, 2010 1 次提交
  10. 25 11月, 2009 1 次提交
  11. 05 11月, 2009 2 次提交
  12. 15 9月, 2009 4 次提交
  13. 14 9月, 2009 2 次提交
  14. 10 9月, 2009 1 次提交
  15. 18 6月, 2009 2 次提交
  16. 27 5月, 2009 1 次提交
    • A
      PCI Hotplug: acpiphp: don't store a pci_dev in acpiphp_func · 9d911d79
      Alex Chiang 提交于
      An oops can occur if a user attempts to use both PCI logical
      hotplug and the ACPI physical hotplug driver (acpiphp) in this
      sequence, where $slot/address == $device.
      
      In other words, if acpiphp has claimed a PCI device, and that
      device is logically removed, then acpiphp may oops when it
      attempts to access it again.
      
      	# echo 1 > /sys/bus/pci/devices/$device/remove
      	# echo 0 > /sys/bus/pci/slots/$slot/power
      
      Unable to handle kernel NULL pointer dereference (address 0000000000000000)
      Call Trace:
       [<a000000100016390>] show_stack+0x50/0xa0
       [<a000000100016c60>] show_regs+0x820/0x860
       [<a00000010003b390>] die+0x190/0x2a0
       [<a000000100066a40>] ia64_do_page_fault+0x8e0/0xa40
       [<a00000010000c7a0>] ia64_native_leave_kernel+0x0/0x270
       [<a0000001003b2660>] pci_remove_bus_device+0x120/0x260
       [<a0000002060549f0>] acpiphp_disable_slot+0x410/0x540 [acpiphp]
       [<a0000002060505c0>] disable_slot+0xc0/0x120 [acpiphp]
       [<a0000002040d21c0>] power_write_file+0x1e0/0x2a0 [pci_hotplug]
       [<a0000001003bb820>] pci_slot_attr_store+0x60/0xa0
       [<a000000100240f70>] sysfs_write_file+0x230/0x2c0
       [<a000000100195750>] vfs_write+0x190/0x2e0
       [<a0000001001961a0>] sys_write+0x80/0x100
       [<a00000010000c600>] ia64_ret_from_syscall+0x0/0x20
       [<a000000000010720>] __kernel_syscall_via_break+0x0/0x20
      
      The root cause of this oops is that the logical remove ("echo 1 >
      /sys/bus/pci/devices/$device/remove") destroyed the pci_dev. The
      pci_dev struct itself wasn't deallocated because acpiphp kept a
      reference, but some of its fields became invalid.
      
      acpiphp doesn't have any real reason to keep a pointer to a
      pci_dev around. It can always derive it using pci_get_slot().
      
      If a logical remove destroys the pci_dev, acpiphp won't find it
      and is thus prevented from causing mischief.
      Reviewed-by: NMatthew Wilcox <willy@linux.intel.com>
      Reviewed-by: NKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
      Tested-by: NKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
      Reported-by: NKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
      Acked-by: NBjorn Helgaas <bjorn.helgaas@hp.com>
      Signed-off-by: NAlex Chiang <achiang@hp.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      9d911d79
  17. 07 4月, 2009 1 次提交
  18. 17 1月, 2009 1 次提交
  19. 08 1月, 2009 3 次提交
  20. 17 12月, 2008 1 次提交
  21. 11 10月, 2008 1 次提交
  22. 24 9月, 2008 1 次提交
  23. 03 7月, 2008 1 次提交
    • A
      PCI: acpiphp: cleanup notify handler on all root bridges · a13307ce
      Alex Chiang 提交于
      During the development of the physical PCI slot patch series, Gary Hade
      kept on reporting strange oopses due to interactions between pci_slot
      and acpiphp.
      
      	http://lkml.org/lkml/2007/11/28/319
      
      find_root_bridges() unconditionally installs
      handle_hotplug_event_bridge() as an ACPI_SYSTEM_NOTIFY handler for all
      root bridges.
      
      However, during module cleanup, remove_bridge() will only remove the
      notify handler iff the root bridge had a hot-pluggable slot directly
      underneath. That is:
      
      	root bridge -> hotplug slot
      
      But, if the topology looks like either of the following:
      
      	root bridge -> non-hotplug slot
      	root bridge -> p2p bridge -> hotplug slot
      
      Then we currently do not remove the notify handler from that root
      bridge.
      
      This can cause a kernel oops if we modprobe acpiphp later and it gets
      loaded somewhere else in memory. If the root bridge then receives a
      hotplug event, it will then attempt to call a stale, non-existent notify
      handler and we blow up.
      
      Much thanks goes to Gary Hade for his persistent debugging efforts.
      Signed-off-by: NAlex Chiang <achiang@hp.com>
      Signed-off-by: NGary Hade <garyhade@us.ibm.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      a13307ce
  24. 11 6月, 2008 1 次提交
    • 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
  25. 21 4月, 2008 1 次提交
  26. 05 3月, 2008 1 次提交
    • S
      PCI: fix section mismatch warning in pci_scan_child_bus · 0ab2b57f
      Sam Ravnborg 提交于
      Fix following warning:
      WARNING: vmlinux.o(.text+0x47bdb1): Section mismatch in reference from the function pci_scan_child_bus() to the function .devinit.text:pcibios_fixup_bus()
      
      We had plenty of functions that could be annotated __devinit but due to
      the former restriction that exported symbols could not be annotated
      they were not so.  So annotate these function and fix the references
      from the pci/hotplug/* code to silence the resuting warnings.
      Signed-off-by: NSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      0ab2b57f
  27. 02 2月, 2008 2 次提交
  28. 29 11月, 2007 1 次提交
    • R
      pci hotplug: kernel-doc fixes · 26e6c66e
      Randy Dunlap 提交于
      acpiphp.h: not using kernel-doc, so change /** to /*
      acpiphp_core.c: lots of kernel-doc cleanups
      acpiphp_glue.c: lots of kernel-doc cleanups
      acpiphp_ibm.c: lots of kernel-doc cleanups
      cpqphp_core.c: lots of kernel-doc cleanups
      cpqphp_ctrl.c: lots of kernel-doc cleanups
      fakephp.c:  correct kernel-doc notation
      pciehp_ctrl.c: correct kernel-doc notation
      rpadlpar_core.c: correct function names & kernel-doc notation
      rpaphp_core.c: correct kernel-doc notation
      shpchp_ctrl.c: correct kernel-doc notation
      Signed-off-by: NRandy Dunlap <randy.dunlap@oracle.com>
      Cc: Kristen Accardi <kristen.c.accardi@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      26e6c66e
  29. 12 7月, 2007 3 次提交