12 May, 2011

1 commit


11 May, 2011

1 commit

  • The following patch sets the MaxPayload setting to match the parent
    reading when inserting a PCIE card into a hotplug slot. On our system,
    the upstream bridge is set to 256, but when inserting a card, the card
    setting defaults to 128. As soon as I/O is performed to the card it
    starts receiving errors since the payload size is too small.

    Reviewed-by: Kenji Kaneshige
    Signed-off-by: Jordan Hargrave
    Signed-off-by: Jesse Barnes

    Jordan_Hargrave@Dell.com
     

31 Mar, 2011

1 commit


05 Mar, 2011

1 commit

  • 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 (10b3dcae0f275e2546e55303d64ddbb58cec7599), 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: Stefano Stabellini
    Signed-off-by: Jesse Barnes

    Stefano Stabellini
     

11 Jan, 2011

1 commit


24 Dec, 2010

1 commit


12 Nov, 2010

1 commit

  • While testing various randconfigs with ktest.pl, I hit the following panic:

    BUG: unable to handle kernel paging request at f7e54b03
    IP: [] ibmphp_access_ebda+0x101/0x19bb

    Adding printks, I found that the loop that reads the ebda blocks
    can move out of the mapped section.

    ibmphp_access_ebda: start=f7e44c00 size=5120 end=f7e46000
    ibmphp_access_ebda: io_mem=f7e44d80 offset=384
    ibmphp_access_ebda: io_mem=f7e54b03 offset=65283

    The start of the iomap was at f7e44c00 and had a size of 5120,
    making the end f7e46000. We start with an offset of 0x180 or
    384, giving the first read at 0xf7e44d80. Reading that location
    yields 65283, which is much bigger than the 5120 that was allocated
    and makes the next read at f7e54b03 which is outside the mapped area.

    Perhaps this is a bug in the driver, or buggy hardware, but this patch
    is more about not crashing my box on start up and just giving a warning
    if it detects this error.

    This patch at least lets my box boot with just a warning.

    Cc: Chandru Siddalingappa
    Signed-off-by: Steven Rostedt
    Signed-off-by: Jesse Barnes

    Steven Rostedt
     

29 Oct, 2010

1 commit

  • * 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6: (27 commits)
    x86: allocate space within a region top-down
    x86: update iomem_resource end based on CPU physical address capabilities
    x86/PCI: allocate space from the end of a region, not the beginning
    PCI: allocate bus resources from the top down
    resources: support allocating space within a region from the top down
    resources: handle overflow when aligning start of available area
    resources: ensure callback doesn't allocate outside available space
    resources: factor out resource_clip() to simplify find_resource()
    resources: add a default alignf to simplify find_resource()
    x86/PCI: MMCONFIG: fix region end calculation
    PCI: Add support for polling PME state on suspended legacy PCI devices
    PCI: Export some PCI PM functionality
    PCI: fix message typo
    PCI: log vendor/device ID always
    PCI: update Intel chipset names and defines
    PCI: use new ccflags variable in Makefile
    PCI: add PCI_MSIX_TABLE/PBA defines
    PCI: add PCI vendor id for STmicroelectronics
    x86/PCI: irq and pci_ids patch for Intel Patsburg DeviceIDs
    PCI: OLPC: Only enable PCI configuration type override on XO-1
    ...

    Linus Torvalds
     

23 Oct, 2010

1 commit

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq:
    workqueue: remove in_workqueue_context()
    workqueue: Clarify that schedule_on_each_cpu is synchronous
    memory_hotplug: drop spurious calls to flush_scheduled_work()
    shpchp: update workqueue usage
    pciehp: update workqueue usage
    isdn/eicon: don't call flush_scheduled_work() from diva_os_remove_soft_isr()
    workqueue: add and use WQ_MEM_RECLAIM flag
    workqueue: fix HIGHPRI handling in keep_working()
    workqueue: add queue_work and activate_work trace points
    workqueue: prepare for more tracepoints
    workqueue: implement flush[_delayed]_work_sync()
    workqueue: factor out start_flush_work()
    workqueue: cleanup flush/cancel functions
    workqueue: implement alloc_ordered_workqueue()

    Fix up trivial conflict in fs/gfs2/main.c as per Tejun

    Linus Torvalds
     

18 Oct, 2010

2 commits

  • * 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: Tejun Heo
    Acked-by: Jesse Barnes

    Tejun Heo
     
  • * Rename pciehp_wq to pciehp_ordered_wq and add non-ordered pciehp_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 pciehp_wq and pciehp_ordered_wq upfront.

    * Include workqueue.h from pciehp.h.

    Signed-off-by: Tejun Heo
    Acked-by: Jesse Barnes

    Tejun Heo
     

16 Oct, 2010

1 commit


05 Oct, 2010

1 commit

  • All these files use the big kernel lock in a trivial
    way to serialize their private file operations,
    typically resulting from an earlier semi-automatic
    pushdown from VFS.

    None of these drivers appears to want to lock against
    other code, and they all use the BKL as the top-level
    lock in their file operations, meaning that there
    is no lock-order inversion problem.

    Consequently, we can remove the BKL completely,
    replacing it with a per-file mutex in every case.
    Using a scripted approach means we can avoid
    typos.

    These drivers do not seem to be under active
    maintainance from my brief investigation. Apologies
    to those maintainers that I have missed.

    file=$1
    name=$2
    if grep -q lock_kernel ${file} ; then
    if grep -q 'include.*linux.mutex.h' ${file} ; then
    sed -i '/include.*/d' ${file}
    else
    sed -i 's/include.*.*$/include /g' ${file}
    fi
    sed -i ${file} \
    -e "/^#include.*linux.mutex.h/,$ {
    1,/^\(static\|int\|long\)/ {
    /^\(static\|int\|long\)/istatic DEFINE_MUTEX(${name}_mutex);

    } }" \
    -e "s/\(un\)*lock_kernel\>[ ]*()/mutex_\1lock(\&${name}_mutex)/g" \
    -e '/[ ]*cycle_kernel_lock();/d'
    else
    sed -i -e '/include.*\/d' ${file} \
    -e '/cycle_kernel_lock()/d'
    fi

    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     

26 Aug, 2010

1 commit


25 Aug, 2010

2 commits

  • After commit 852972acff8f10f3a15679be2059bb94916cba5d (ACPI: Disable
    ASPM if the platform won't provide _OSC control for PCIe) control of
    the PCIe Capability Structure is unconditionally requested by
    acpi_pci_root_add(), which in principle may cause problems to
    happen in two ways. First, the BIOS may refuse to give control of
    the PCIe Capability Structure if it is not asked for any of the
    _OSC features depending on it at the same time. Second, the BIOS may
    assume that control of the _OSC features depending on the PCIe
    Capability Structure will be requested in the future and may behave
    incorrectly if that doesn't happen. For this reason, control of
    the PCIe Capability Structure should always be requested along with
    control of any other _OSC features that may depend on it (ie. PCIe
    native PME, PCIe native hot-plug, PCIe AER).

    Rework the PCIe port driver so that (1) it checks which native PCIe
    port services can be enabled, according to the BIOS, and (2) it
    requests control of all these services simultaneously. In
    particular, this causes pcie_portdrv_probe() to fail if the BIOS
    refuses to grant control of the PCIe Capability Structure, which
    means that no native PCIe port services can be enabled for the PCIe
    Root Complex the given port belongs to. If that happens, ASPM is
    disabled to avoid problems with mishandling it by the part of the
    PCIe hierarchy for which control of the PCIe Capability Structure
    has not been received.

    Make it possible to override this behavior using 'pcie_ports=native'
    (use the PCIe native services regardless of the BIOS response to the
    control request), or 'pcie_ports=compat' (do not use the PCIe native
    services at all).

    Accordingly, rework the existing PCIe port service drivers so that
    they don't request control of the services directly.

    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Jesse Barnes

    Rafael J. Wysocki
     
  • It is possible that the BIOS will not grant control of all _OSC
    features requested via acpi_pci_osc_control_set(), so it is
    recommended to negotiate the final set of _OSC features with the
    query flag set before calling _OSC to request control of these
    features.

    To implement it, rework acpi_pci_osc_control_set() so that the caller
    can specify the mask of _OSC control bits to negotiate and the mask
    of _OSC control bits that are absolutely necessary to it. Then,
    acpi_pci_osc_control_set() will run _OSC queries in a loop until
    the mask of _OSC control bits returned by the BIOS is equal to the
    mask passed to it. Also, before running the _OSC request
    acpi_pci_osc_control_set() will check if the caller's required
    control bits are present in the final mask.

    Using this mechanism we will be able to avoid situations in which the
    BIOS doesn't grant control of certain _OSC features, because they
    depend on some other _OSC features that have not been requested.

    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Jesse Barnes

    Rafael J. Wysocki
     

31 Jul, 2010

4 commits


12 Jun, 2010

1 commit

  • There are devices out there which are PCI Hot-plug controllers with
    compaq PCI IDs, but are not bridges, hence have pdev->subordinate
    NULL. But cpqphp expects the pointer to be non-NULL.

    Add a check to the probe function to avoid oopses like:
    BUG: unable to handle kernel NULL pointer dereference at 00000050
    IP: [] cpqhpc_probe+0x951/0x1120 [cpqphp]
    *pdpt = 0000000033779001 *pde = 0000000000000000
    ...

    The device here was:
    00:0b.0 PCI Hot-plug controller [0804]: Compaq Computer Corporation PCI Hotplug Controller [0e11:a0f7] (rev 11)
    Subsystem: Compaq Computer Corporation Device [0e11:a2f8]

    Signed-off-by: Jiri Slaby
    Cc: Greg KH
    Signed-off-by: Jesse Barnes

    Jiri Slaby
     

22 May, 2010

3 commits

  • * 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6: (36 commits)
    PCI: hotplug: pciehp: Removed check for hotplug of display devices
    PCI: read memory ranges out of Broadcom CNB20LE host bridge
    PCI: Allow manual resource allocation for PCI hotplug bridges
    x86/PCI: make ACPI MCFG reserved error messages ACPI specific
    PCI hotplug: Use kmemdup
    PM/PCI: Update PCI power management documentation
    PCI: output FW warning in pci_read/write_vpd
    PCI: fix typos pci_device_dis/enable to pci_dis/enable_device in comments
    PCI quirks: disable msi on AMD rs4xx internal gfx bridges
    PCI: Disable MSI for MCP55 on P5N32-E SLI
    x86/PCI: irq and pci_ids patch for additional Intel Cougar Point DeviceIDs
    PCI: aerdrv: trivial cleanup for aerdrv_core.c
    PCI: aerdrv: trivial cleanup for aerdrv.c
    PCI: aerdrv: introduce default_downstream_reset_link
    PCI: aerdrv: rework find_aer_service
    PCI: aerdrv: remove is_downstream
    PCI: aerdrv: remove magical ROOT_ERR_STATUS_MASKS
    PCI: aerdrv: redefine PCI_ERR_ROOT_*_SRC
    PCI: aerdrv: rework do_recovery
    PCI: aerdrv: rework get_e_source()
    ...

    Linus Torvalds
     
  • Removed check to prevent hotplug of display devices within pciehp.
    Originally this was thought to have been required within the PCI
    Hotplug specification for some legacy devices. However there is
    no such requirement in the most recent revision. The check prevents
    hotplug of not only display devices but also computational GPUs
    which require serviceability.

    Signed-off-by: Praveen Kalamegham
    Signed-off-by: Jesse Barnes

    Praveen Kalamegham
     
  • This allows bin_attr->read,write,mmap callbacks to check file specific data
    (such as inode owner) as part of any privilege validation.

    Signed-off-by: Chris Wright
    Signed-off-by: Greg Kroah-Hartman

    Chris Wright
     

21 May, 2010

1 commit

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (44 commits)
    vlynq: make whole Kconfig-menu dependant on architecture
    add descriptive comment for TIF_MEMDIE task flag declaration.
    EEPROM: max6875: Header file cleanup
    EEPROM: 93cx6: Header file cleanup
    EEPROM: Header file cleanup
    agp: use NULL instead of 0 when pointer is needed
    rtc-v3020: make bitfield unsigned
    PCI: make bitfield unsigned
    jbd2: use NULL instead of 0 when pointer is needed
    cciss: fix shadows sparse warning
    doc: inode uses a mutex instead of a semaphore.
    uml: i386: Avoid redefinition of NR_syscalls
    fix "seperate" typos in comments
    cocbalt_lcdfb: correct sections
    doc: Change urls for sparse
    Powerpc: wii: Fix typo in comment
    i2o: cleanup some exit paths
    Documentation/: it's -> its where appropriate
    UML: Fix compiler warning due to missing task_struct declaration
    UML: add kernel.h include to signal.c
    ...

    Linus Torvalds
     

19 May, 2010

1 commit

  • Use kmemdup when some other buffer is immediately copied into the
    allocated region.

    A simplified version of the semantic patch that makes this change is as
    follows: (http://coccinelle.lip6.fr/)

    //
    @@
    expression from,to,size,flag;
    statement S;
    @@

    - to = \(kmalloc\|kzalloc\)(size,flag);
    + to = kmemdup(from,size,flag);
    if (to==NULL || ...) S
    - memcpy(to, from, size);
    //

    Signed-off-by: Julia Lawall
    Signed-off-by: Jesse Barnes

    Julia Lawall
     

28 Apr, 2010

1 commit


23 Apr, 2010

1 commit


30 Mar, 2010

1 commit

  • …it 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: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

25 Mar, 2010

1 commit


16 Mar, 2010

1 commit


15 Mar, 2010

2 commits


08 Mar, 2010

1 commit

  • Constify struct sysfs_ops.

    This is part of the ops structure constification
    effort started by Arjan van de Ven et al.

    Benefits of this constification:

    * prevents modification of data that is shared
    (referenced) by many other structure instances
    at runtime

    * detects/prevents accidental (but not intentional)
    modification attempts on archs that enforce
    read-only kernel data at runtime

    * potentially better optimized code as the compiler
    can assume that the const data cannot be changed

    * the compiler/linker move const data into .rodata
    and therefore exclude them from false sharing

    Signed-off-by: Emese Revfy
    Acked-by: David Teigland
    Acked-by: Matt Domsch
    Acked-by: Maciej Sosnowski
    Acked-by: Hans J. Koch
    Acked-by: Pekka Enberg
    Acked-by: Jens Axboe
    Acked-by: Stephen Hemminger
    Signed-off-by: Greg Kroah-Hartman

    Emese Revfy
     

04 Mar, 2010

1 commit

  • …l/git/tip/linux-2.6-tip

    * 'x86-bootmem-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (30 commits)
    early_res: Need to save the allocation name in drop_range_partial()
    sparsemem: Fix compilation on PowerPC
    early_res: Add free_early_partial()
    x86: Fix non-bootmem compilation on PowerPC
    core: Move early_res from arch/x86 to kernel/
    x86: Add find_fw_memmap_area
    Move round_up/down to kernel.h
    x86: Make 32bit support NO_BOOTMEM
    early_res: Enhance check_and_double_early_res
    x86: Move back find_e820_area to e820.c
    x86: Add find_early_area_size
    x86: Separate early_res related code from e820.c
    x86: Move bios page reserve early to head32/64.c
    sparsemem: Put mem map for one node together.
    sparsemem: Put usemap for one node together
    x86: Make 64 bit use early_res instead of bootmem before slab
    x86: Only call dma32_reserve_bootmem 64bit !CONFIG_NUMA
    x86: Make early_node_mem get mem > 4 GB if possible
    x86: Dynamically increase early_res array size
    x86: Introduce max_early_res and early_res_count
    ...

    Linus Torvalds
     

24 Feb, 2010

1 commit


23 Feb, 2010

4 commits

  • Move bus_size_bridges and assign resources out of pciehp_add_bridge()
    and do them all together, one time, including slot bridge, to avoid to
    calling assign resources several times when there are several bridges
    under the slot bridge. Using pci_assign_unassigned_bridge_resources.

    Signed-off-by: Yinghai Lu
    Reviewed-by: Alex Chiang
    Signed-off-by: Jesse Barnes

    Yinghai Lu
     
  • check ioremap() return value.

    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Jesse Barnes

    Andrew Morton
     
  • Add header file to fix build error:

    drivers/pci/hotplug/ibmphp_hpc.c:135: error: implicit declaration of function 'init_MUTEX'
    drivers/pci/hotplug/ibmphp_hpc.c:136: error: implicit declaration of function 'init_MUTEX_LOCKED'
    drivers/pci/hotplug/ibmphp_hpc.c:797: error: implicit declaration of function 'down'
    drivers/pci/hotplug/ibmphp_hpc.c:807: error: implicit declaration of function 'up'

    Signed-off-by: Randy Dunlap
    Signed-off-by: Jesse Barnes

    Randy Dunlap
     
  • Stanse found an ommitted pci_dev_put on one error path in
    cpcihp_generic_init. The path is taken on !dev, but also when
    dev->hdr_type != PCI_HEADER_TYPE_BRIDGE. However it omits to
    pci_dev_put on the latter.

    As it is fine to pass NULL to pci_dev_put, put it in there
    uncoditionally.

    Signed-off-by: Jiri Slaby
    Cc: Scott Murray
    Signed-off-by: Jesse Barnes

    Jiri Slaby