04 Oct, 2016

1 commit

  • Pull driver core updates from Greg KH:
    "Here are the "big" driver core patches for 4.9-rc1. Also in here are a
    number of debugfs fixes that cropped up due to the changes that
    happened in 4.8 for that filesystem. Overall, nothing major, just a
    few fixes and cleanups.

    All of these have been in linux-next with no reported issues"

    * tag 'driver-core-4.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (23 commits)
    drivers: dma-coherent: Move spinlock in dma_alloc_from_coherent()
    drivers: dma-coherent: Fix DMA coherent size for less than page
    MAINTAINERS: extend firmware_class maintainer list
    debugfs: propagate release() call result
    driver-core: platform: Catch errors from calls to irq_get_irq_data
    sysfs print name of undiscoverable attribute group
    carl9170: fix debugfs crashes
    b43legacy: fix debugfs crash
    b43: fix debugfs crash
    debugfs: introduce a public file_operations accessor
    device core: Remove deprecated create_singlethread_workqueue
    drivers/base dmam_declare_coherent_memory leaks
    platform: don't return 0 from platform_get_irq[_byname]() on error
    cpu: clean up register_cpu func
    dma-mapping: use vma_pages().
    drivers: dma-coherent: use vma_pages().
    attribute_container: Fix typo
    base: soc: make it explicitly non-modular
    drivers: base: dma-mapping: page align the size when unmap_kernel_range
    platform driver: fix use-after-free in platform_device_del()
    ...

    Linus Torvalds
     

31 Aug, 2016

2 commits

  • The global mutex of 'gdp_mutex' is used to serialize creating/querying
    glue dir and its cleanup. Turns out it isn't a perfect way because
    part(kobj_kset_leave()) of the actual cleanup action() is done inside
    the release handler of the glue dir kobject. That means gdp_mutex has
    to be held before releasing the last reference count of the glue dir
    kobject.

    This patch moves glue dir's cleanup after kobject_del() in device_del()
    for avoiding the race.

    Cc: Yijing Wang
    Reported-by: Chandra Sekhar Lingutla
    Signed-off-by: Ming Lei
    Signed-off-by: Greg Kroah-Hartman

    Ming Lei
     
  • If device_add_property_set() is called for a device, a secondary fwnode
    is allocated and assigned to the device but currently not freed once the
    device is removed.

    This can be triggered on Apple Macs if a Thunderbolt device is plugged
    in on boot since Apple's NHI EFI driver sets a number of properties for
    that device which are leaked on unplug.

    Signed-off-by: Lukas Wunner
    Signed-off-by: Rafael J. Wysocki

    Lukas Wunner
     

07 Dec, 2015

1 commit

  • If multiple devices share single firmware node like it is case with MFD
    devices, the same firmware node (ACPI) is assigned to all of them. The
    function also modifies the shared firmware node in order to preserve
    secondary firmware node of the device in question.

    If the new device which is sharing the firmware node does not have
    secondary node it will be NULL which will be assigned to the secondary node
    of the shared firmware node losing all built-in properties.

    Prevent this by setting the secondary firmware node only if the replacement
    is non-NULL.

    Print also warning if someone tries to overwrite secondary node that has
    already been assigned.

    Signed-off-by: Mika Westerberg
    Signed-off-by: Andy Shevchenko
    Signed-off-by: Rafael J. Wysocki

    Mika Westerberg
     

18 Oct, 2015

1 commit


02 Sep, 2015

2 commits

  • Pull power management and ACPI updates from Rafael Wysocki:
    "From the number of commits perspective, the biggest items are ACPICA
    and cpufreq changes with the latter taking the lead (over 50 commits).

    On the cpufreq front, there are many cleanups and minor fixes in the
    core and governors, driver updates etc. We also have a new cpufreq
    driver for Mediatek MT8173 chips.

    ACPICA mostly updates its debug infrastructure and adds a number of
    fixes and cleanups for a good measure.

    The Operating Performance Points (OPP) framework is updated with new
    DT bindings and support for them among other things.

    We have a few updates of the generic power domains framework and a
    reorganization of the ACPI device enumeration code and bus type
    operations.

    And a lot of fixes and cleanups all over.

    Included is one branch from the MFD tree as it contains some
    PM-related driver core and ACPI PM changes a few other commits are
    based on.

    Specifics:

    - ACPICA update to upstream revision 20150818 including method
    tracing extensions to allow more in-depth AML debugging in the
    kernel and a number of assorted fixes and cleanups (Bob Moore, Lv
    Zheng, Markus Elfring).

    - ACPI sysfs code updates and a documentation update related to AML
    method tracing (Lv Zheng).

    - ACPI EC driver fix related to serialized evaluations of _Qxx
    methods and ACPI tools updates allowing the EC userspace tool to be
    built from the kernel source (Lv Zheng).

    - ACPI processor driver updates preparing it for future introduction
    of CPPC support and ACPI PCC mailbox driver updates (Ashwin
    Chaugule).

    - ACPI interrupts enumeration fix for a regression related to the
    handling of IRQ attribute conflicts between MADT and the ACPI
    namespace (Jiang Liu).

    - Fixes related to ACPI device PM (Mika Westerberg, Srinidhi
    Kasagar).

    - ACPI device registration code reorganization to separate the
    sysfs-related code and bus type operations from the rest (Rafael J
    Wysocki).

    - Assorted cleanups in the ACPI core (Jarkko Nikula, Mathias Krause,
    Andy Shevchenko, Rafael J Wysocki, Nicolas Iooss).

    - ACPI cpufreq driver and ia64 cpufreq driver fixes and cleanups (Pan
    Xinhui, Rafael J Wysocki).

    - cpufreq core cleanups on top of the previous changes allowing it to
    preseve its sysfs directories over system suspend/resume (Viresh
    Kumar, Rafael J Wysocki, Sebastian Andrzej Siewior).

    - cpufreq fixes and cleanups related to governors (Viresh Kumar).

    - cpufreq updates (core and the cpufreq-dt driver) related to the
    turbo/boost mode support (Viresh Kumar, Bartlomiej Zolnierkiewicz).

    - New DT bindings for Operating Performance Points (OPP), support for
    them in the OPP framework and in the cpufreq-dt driver plus related
    OPP framework fixes and cleanups (Viresh Kumar).

    - cpufreq powernv driver updates (Shilpasri G Bhat).

    - New cpufreq driver for Mediatek MT8173 (Pi-Cheng Chen).

    - Assorted cpufreq driver (speedstep-lib, sfi, integrator) cleanups
    and fixes (Abhilash Jindal, Andrzej Hajda, Cristian Ardelean).

    - intel_pstate driver updates including Skylake-S support, support
    for enabling HW P-states per CPU and an additional vendor bypass
    list entry (Kristen Carlson Accardi, Chen Yu, Ethan Zhao).

    - cpuidle core fixes related to the handling of coupled idle states
    (Xunlei Pang).

    - intel_idle driver updates including Skylake Client support and
    support for freeze-mode-specific idle states (Len Brown).

    - Driver core updates related to power management (Andy Shevchenko,
    Rafael J Wysocki).

    - Generic power domains framework fixes and cleanups (Jon Hunter,
    Geert Uytterhoeven, Rajendra Nayak, Ulf Hansson).

    - Device PM QoS framework update to allow the latency tolerance
    setting to be exposed to user space via sysfs (Mika Westerberg).

    - devfreq support for PPMUv2 in Exynos5433 and a fix for an incorrect
    exynos-ppmu DT binding (Chanwoo Choi, Javier Martinez Canillas).

    - System sleep support updates (Alan Stern, Len Brown, SungEun Kim).

    - rockchip-io AVS support updates (Heiko Stuebner).

    - PM core clocks support fixup (Colin Ian King).

    - Power capping RAPL driver update including support for Skylake H/S
    and Broadwell-H (Radivoje Jovanovic, Seiichi Ikarashi).

    - Generic device properties framework fixes related to the handling
    of static (driver-provided) property sets (Andy Shevchenko).

    - turbostat and cpupower updates (Len Brown, Shilpasri G Bhat,
    Shreyas B Prabhu)"

    * tag 'pm+acpi-4.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (180 commits)
    cpufreq: speedstep-lib: Use monotonic clock
    cpufreq: powernv: Increase the verbosity of OCC console messages
    cpufreq: sfi: use kmemdup rather than duplicating its implementation
    cpufreq: drop !cpufreq_driver check from cpufreq_parse_governor()
    cpufreq: rename cpufreq_real_policy as cpufreq_user_policy
    cpufreq: remove redundant 'policy' field from user_policy
    cpufreq: remove redundant 'governor' field from user_policy
    cpufreq: update user_policy.* on success
    cpufreq: use memcpy() to copy policy
    cpufreq: remove redundant CPUFREQ_INCOMPATIBLE notifier event
    cpufreq: mediatek: Add MT8173 cpufreq driver
    dt-bindings: mediatek: Add MT8173 CPU DVFS clock bindings
    PM / Domains: Fix typo in description of genpd_dev_pm_detach()
    PM / Domains: Remove unusable governor dummies
    PM / Domains: Make pm_genpd_init() available to modules
    PM / domains: Align column headers and data in pm_genpd_summary output
    powercap / RAPL: disable the 2nd power limit properly
    tools: cpupower: Fix error when running cpupower monitor
    PM / OPP: Drop unlikely before IS_ERR(_OR_NULL)
    PM / OPP: Fix static checker warning (broken 64bit big endian systems)
    ...

    Linus Torvalds
     
  • Pull irq updates from Thomas Gleixner:
    "This updated pull request does not contain the last few GIC related
    patches which were reported to cause a regression. There is a fix
    available, but I let it breed for a couple of days first.

    The irq departement provides:

    - new infrastructure to support non PCI based MSI interrupts
    - a couple of new irq chip drivers
    - the usual pile of fixlets and updates to irq chip drivers
    - preparatory changes for removal of the irq argument from interrupt
    flow handlers
    - preparatory changes to remove IRQF_VALID"

    * 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (129 commits)
    irqchip/imx-gpcv2: IMX GPCv2 driver for wakeup sources
    irqchip: Add bcm2836 interrupt controller for Raspberry Pi 2
    irqchip: Add documentation for the bcm2836 interrupt controller
    irqchip/bcm2835: Add support for being used as a second level controller
    irqchip/bcm2835: Refactor handle_IRQ() calls out of MAKE_HWIRQ
    PCI: xilinx: Fix typo in function name
    irqchip/gic: Ensure gic_cpu_if_up/down() programs correct GIC instance
    irqchip/gic: Only allow the primary GIC to set the CPU map
    PCI/MSI: pci-xgene-msi: Consolidate chained IRQ handler install/remove
    unicore32/irq: Prepare puv3_gpio_handler for irq argument removal
    tile/pci_gx: Prepare trio_handle_level_irq for irq argument removal
    m68k/irq: Prepare irq handlers for irq argument removal
    C6X/megamode-pic: Prepare megamod_irq_cascade for irq argument removal
    blackfin: Prepare irq handlers for irq argument removal
    arc/irq: Prepare idu_cascade_isr for irq argument removal
    sparc/irq: Use access helper irq_data_get_affinity_mask()
    sparc/irq: Use helper irq_data_get_irq_handler_data()
    parisc/irq: Use access helper irq_data_get_affinity_mask()
    mn10300/irq: Use access helper irq_data_get_affinity_mask()
    irqchip/i8259: Prepare i8259_irq_dispatch for irq argument removal
    ...

    Linus Torvalds
     

06 Aug, 2015

1 commit


28 Jul, 2015

1 commit

  • The new function device_for_each_child_reverse() is helpful to traverse the
    registered devices in a reversed order, e.g. in the case when an operation on
    each device should be done first on the last added device, then on one before
    last and so on.

    Signed-off-by: Andy Shevchenko
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: Lee Jones

    Andy Shevchenko
     

23 Jul, 2015

1 commit

  • Move msi_list from struct pci_dev into struct device, so we can
    support non-PCI-device based generic MSI interrupts.

    msi_list is now conditional under CONFIG_GENERIC_MSI_IRQ, which is
    selected from CONFIG_PCI_MSI, so no functional change for PCI MSI
    users.

    Signed-off-by: Jiang Liu
    Reviewed-by: Yijing Wang
    Acked-by: Bjorn Helgaas
    Cc: Tony Luck
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: Grant Likely
    Cc: Marc Zyngier
    Cc: Stuart Yoder
    Cc: Borislav Petkov
    Cc: Greg Kroah-Hartman
    Cc: Joe Perches
    Cc: Dmitry Torokhov
    Cc: Paul Gortmaker
    Cc: Luis R. Rodriguez
    Cc: Rafael J. Wysocki
    Cc: Joerg Roedel
    Cc: Alexander Gordeev
    Link: http://lkml.kernel.org/r/1436428847-8886-10-git-send-email-jiang.liu@linux.intel.com
    Signed-off-by: Thomas Gleixner

    Jiang Liu
     

26 Jun, 2015

1 commit


15 Apr, 2015

1 commit

  • Pull power management and ACPI updates from Rafael Wysocki:
    "These are mostly fixes and cleanups all over, although there are a few
    items that sort of fall into the new feature category.

    First off, we have new callbacks for PM domains that should help us to
    handle some issues related to device initialization in a better way.

    There also is some consolidation in the unified device properties API
    area allowing us to use that inferface for accessing data coming from
    platform initialization code in addition to firmware-provided data.

    We have some new device/CPU IDs in a few drivers, support for new
    chips and a new cpufreq driver too.

    Specifics:

    - Generic PM domains support update including new PM domain callbacks
    to handle device initialization better (Russell King, Rafael J
    Wysocki, Kevin Hilman)

    - Unified device properties API update including a new mechanism for
    accessing data provided by platform initialization code (Rafael J
    Wysocki, Adrian Hunter)

    - ARM cpuidle update including ARM32/ARM64 handling consolidation
    (Daniel Lezcano)

    - intel_idle update including support for the Silvermont Core in the
    Baytrail SOC and for the Airmont Core in the Cherrytrail and
    Braswell SOCs (Len Brown, Mathias Krause)

    - New cpufreq driver for Hisilicon ACPU (Leo Yan)

    - intel_pstate update including support for the Knights Landing chip
    (Dasaratharaman Chandramouli, Kristen Carlson Accardi)

    - QorIQ cpufreq driver update (Tang Yuantian, Arnd Bergmann)

    - powernv cpufreq driver update (Shilpasri G Bhat)

    - devfreq update including Tegra support changes (Tomeu Vizoso,
    MyungJoo Ham, Chanwoo Choi)

    - powercap RAPL (Running-Average Power Limit) driver update including
    support for Intel Broadwell server chips (Jacob Pan, Mathias Krause)

    - ACPI device enumeration update related to the handling of the
    special PRP0001 device ID allowing DT-style 'compatible' property
    to be used for ACPI device identification (Rafael J Wysocki)

    - ACPI EC driver update including limited _DEP support (Lan Tianyu,
    Lv Zheng)

    - ACPI backlight driver update including a new mechanism to allow
    native backlight handling to be forced on non-Windows 8 systems and
    a new quirk for Lenovo Ideapad Z570 (Aaron Lu, Hans de Goede)

    - New Windows Vista compatibility quirk for Sony VGN-SR19XN (Chen Yu)

    - Assorted ACPI fixes and cleanups (Aaron Lu, Martin Kepplinger,
    Masanari Iida, Mika Westerberg, Nan Li, Rafael J Wysocki)

    - Fixes related to suspend-to-idle for the iTCO watchdog driver and
    the ACPI core system suspend/resume code (Rafael J Wysocki, Chen Yu)

    - PM tracing support for the suspend phase of system suspend/resume
    transitions (Zhonghui Fu)

    - Configurable delay for the system suspend/resume testing facility
    (Brian Norris)

    - PNP subsystem cleanups (Peter Huewe, Rafael J Wysocki)"

    * tag 'pm+acpi-4.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (74 commits)
    ACPI / scan: Fix NULL pointer dereference in acpi_companion_match()
    ACPI / scan: Rework modalias creation when "compatible" is present
    intel_idle: mark cpu id array as __initconst
    powercap / RAPL: mark rapl_ids array as __initconst
    powercap / RAPL: add ID for Broadwell server
    intel_pstate: Knights Landing support
    intel_pstate: remove MSR test
    cpufreq: fix qoriq uniprocessor build
    ACPI / scan: Take the PRP0001 position in the list of IDs into account
    ACPI / scan: Simplify acpi_match_device()
    ACPI / scan: Generalize of_compatible matching
    device property: Introduce firmware node type for platform data
    device property: Make it possible to use secondary firmware nodes
    PM / watchdog: iTCO: stop watchdog during system suspend
    cpufreq: hisilicon: add acpu driver
    ACPI / EC: Call acpi_walk_dep_device_list() after installing EC opregion handler
    cpufreq: powernv: Report cpu frequency throttling
    intel_idle: Add support for the Airmont Core in the Cherrytrail and Braswell SOCs
    intel_idle: Update support for Silvermont Core in Baytrail SOC
    PM / devfreq: tegra: Register governor on module init
    ...

    Linus Torvalds
     

04 Apr, 2015

1 commit

  • Add a secondary pointer to struct fwnode_handle so as to make it
    possible for a device to have two firmware nodes associated with
    it at the same time, for example, an ACPI node and a node with
    a set of properties provided by platform initialization code.

    In the future that will allow device property lookup to fall back
    from the primary firmware node to the secondary one if the given
    property is not present there to make it easier to provide defaults
    for device properties used by device drivers.

    Introduce two helper routines, set_primary_fwnode() and
    set_secondary_fwnode() allowing callers to add a primary/secondary
    firmware node to the given device in such a way that

    (1) If there's only one firmware node for that device, it will be
    pointed to by the device's firmware node pointer.
    (2) If both the primary and secondary firmware nodes are present,
    the primary one will be pointed to by the device's firmware
    node pointer, while the secondary one will be pointed to by the
    primary node's secondary pointer.
    (3) If one of these nodes is removed (by calling one of the new
    nelpers with NULL as the second argument), the other one will
    be preserved.

    Make ACPI use set_primary_fwnode() for attaching its firmware nodes
    to devices.

    Signed-off-by: Rafael J. Wysocki
    Tested-by: Heikki Krogerus
    Acked-by: Greg Kroah-Hartman

    Rafael J. Wysocki
     

25 Mar, 2015

2 commits

  • So I've been annoyed lately with having a bunch of devices such as i2c
    eeproms (for use by VPDs, server world !) and other bits and pieces that
    I want to be able to identify from userspace, and possibly provide
    additional data about from FW.

    Basically, it boils down to correlating the sysfs device with the OF
    tree device node, so that user space can use device-tree info such as
    additional "location" or "label" (or whatever else we can come up with)
    propreties to identify a given device, or get some attributes of use
    about it, etc...

    Now, so far, we've done that in some subsystem in a fairly ad-hoc basis
    using "devspec" properties. For example, PCI creates them if it can
    correlate the probed device with a DT node. Some powerpc specific busses
    do that too.

    However, i2c doesn't and it would be nice to have something more generic
    since technically any device can have a corresponding device tree node.

    This patch adds an "of_node" symlink to devices that have a non-NULL
    dev->of_node pointer, the patch is pretty trivial and seems to work just
    fine for me.

    Signed-off-by: Benjamin Herrenschmidt
    Acked-by: Rob Herring
    Signed-off-by: Greg Kroah-Hartman

    Benjamin Herrenschmidt
     
  • The put_device() function tests whether its argument is NULL and then
    returns immediately. Thus the test around the call is not needed.

    This issue was detected by using the Coccinelle software.

    Signed-off-by: Markus Elfring
    Signed-off-by: Greg Kroah-Hartman

    Markus Elfring
     

27 Jan, 2015

1 commit


15 Dec, 2014

1 commit

  • Pull driver core update from Greg KH:
    "Here's the set of driver core patches for 3.19-rc1.

    They are dominated by the removal of the .owner field in platform
    drivers. They touch a lot of files, but they are "simple" changes,
    just removing a line in a structure.

    Other than that, a few minor driver core and debugfs changes. There
    are some ath9k patches coming in through this tree that have been
    acked by the wireless maintainers as they relied on the debugfs
    changes.

    Everything has been in linux-next for a while"

    * tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (324 commits)
    Revert "ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries"
    fs: debugfs: add forward declaration for struct device type
    firmware class: Deletion of an unnecessary check before the function call "vunmap"
    firmware loader: fix hung task warning dump
    devcoredump: provide a one-way disable function
    device: Add dev__once variants
    ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries
    ath: use seq_file api for ath9k debugfs files
    debugfs: add helper function to create device related seq_file
    drivers/base: cacheinfo: remove noisy error boot message
    Revert "core: platform: add warning if driver has no owner"
    drivers: base: support cpu cache information interface to userspace via sysfs
    drivers: base: add cpu_device_create to support per-cpu devices
    topology: replace custom attribute macros with standard DEVICE_ATTR*
    cpumask: factor out show_cpumap into separate helper function
    driver core: Fix unbalanced device reference in drivers_probe
    driver core: fix race with userland in device_add()
    sysfs/kernfs: make read requests on pre-alloc files use the buffer.
    sysfs/kernfs: allow attributes to request write buffer be pre-allocated.
    fs: sysfs: return EGBIG on write if offset is larger than file size
    ...

    Linus Torvalds
     

08 Nov, 2014

2 commits

  • bus_add_device() should be called before devtmpfs_create_node(), so when
    userland application opens device from devtmpfs, it wouldn't get ENODEV
    from kernel, because device_add() wasn't completed.

    Signed-off-by: Sergey Klyaus
    Signed-off-by: Greg Kroah-Hartman

    Sergey Klyaus
     
  • There is a race condition when removing glue directory.
    It can be reproduced in following test:

    path 1: Add first child device
    device_add()
    get_device_parent()
    /*find parent from glue_dirs.list*/
    list_for_each_entry(k, &dev->class->p->glue_dirs.list, entry)
    if (k->parent == parent_kobj) {
    kobj = kobject_get(k);
    break;
    }
    ....
    class_dir_create_and_add()

    path2: Remove last child device under glue dir
    device_del()
    cleanup_device_parent()
    cleanup_glue_dir()
    kobject_put(glue_dir);

    If path2 has been called cleanup_glue_dir(), but not
    call kobject_put(glue_dir), the glue dir is still
    in parent's kset list. Meanwhile, path1 find the glue
    dir from the glue_dirs.list. Path2 may release glue dir
    before path1 call kobject_get(). So kernel will report
    the warning and bug_on.

    This is a "classic" problem we have of a kref in a list
    that can be found while the last instance could be removed
    at the same time.

    This patch reuse gdp_mutex to fix this race condition.

    The following calltrace is captured in kernel 3.4, but
    the latest kernel still has this bug.

    -----------------------------------------------------
    [ 3965.441471] WARNING: at ...include/linux/kref.h:41 kobject_get+0x33/0x40()
    [ 3965.441474] Hardware name: Romley
    [ 3965.441475] Modules linked in: isd_iop(O) isd_xda(O)...
    ...
    [ 3965.441605] Call Trace:
    [ 3965.441611] [] warn_slowpath_common+0x7a/0xb0
    [ 3965.441615] [] warn_slowpath_null+0x15/0x20
    [ 3965.441618] [] kobject_get+0x33/0x40
    [ 3965.441624] [] get_device_parent.isra.11+0x135/0x1f0
    [ 3965.441627] [] device_add+0xd4/0x6d0
    [ 3965.441631] [] ? dev_set_name+0x3c/0x40
    ....
    [ 3965.441912] kernel BUG at ..../fs/sysfs/group.c:65!
    [ 3965.441915] invalid opcode: 0000 [#1] SMP
    ...
    [ 3965.686743] [] sysfs_create_group+0xe/0x10
    [ 3965.686748] [] blk_trace_init_sysfs+0x14/0x20
    [ 3965.686753] [] blk_register_queue+0x3b/0x120
    [ 3965.686756] [] add_disk+0x1cc/0x490
    ....
    -------------------------------------------------------

    Signed-off-by: Yijing Wang
    Signed-off-by: Weng Meiling
    Cc: #3.4+
    Signed-off-by: Greg Kroah-Hartman

    Yijing Wang
     

15 Oct, 2014

1 commit

  • Pull IOMMU updates from Joerg Roedel:
    "This pull-request includes:

    - change in the IOMMU-API to convert the former iommu_domain_capable
    function to just iommu_capable

    - various fixes in handling RMRR ranges for the VT-d driver (one fix
    requires a device driver core change which was acked by Greg KH)

    - the AMD IOMMU driver now assigns and deassigns complete alias
    groups to fix issues with devices using the wrong PCI request-id

    - MMU-401 support for the ARM SMMU driver

    - multi-master IOMMU group support for the ARM SMMU driver

    - various other small fixes all over the place"

    * tag 'iommu-updates-v3.18' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: (41 commits)
    iommu/vt-d: Work around broken RMRR firmware entries
    iommu/vt-d: Store bus information in RMRR PCI device path
    iommu/vt-d: Only remove domain when device is removed
    driver core: Add BUS_NOTIFY_REMOVED_DEVICE event
    iommu/amd: Fix devid mapping for ivrs_ioapic override
    iommu/irq_remapping: Fix the regression of hpet irq remapping
    iommu: Fix bus notifier breakage
    iommu/amd: Split init_iommu_group() from iommu_init_device()
    iommu: Rework iommu_group_get_for_pci_dev()
    iommu: Make of_device_id array const
    amd_iommu: do not dereference a NULL pointer address.
    iommu/omap: Remove omap_iommu unused owner field
    iommu: Remove iommu_domain_has_cap() API function
    IB/usnic: Convert to use new iommu_capable() API function
    vfio: Convert to use new iommu_capable() API function
    kvm: iommu: Convert to use new iommu_capable() API function
    iommu/tegra: Convert to iommu_capable() API function
    iommu/msm: Convert to iommu_capable() API function
    iommu/vt-d: Convert to iommu_capable() API function
    iommu/fsl: Convert to iommu_capable() API function
    ...

    Linus Torvalds
     

02 Oct, 2014

1 commit

  • This event closes an important gap in the bus notifiers.
    There is already the BUS_NOTIFY_DEL_DEVICE event, but that
    is sent when the device is still bound to its device driver.

    This is too early for the IOMMU code to destroy any mappings
    for the device, as they might still be in use by the driver.

    The new BUS_NOTIFY_REMOVED_DEVICE event introduced with this
    patch closes this gap as it is sent when the device is
    already unbound from its device driver and almost completly
    removed from the driver core.

    With this event the IOMMU code can safely destroy any
    mappings and other data structures when a device is removed.

    Signed-off-by: Joerg Roedel
    Acked-by: Greg Kroah-Hartman
    Tested-by: Jerry Hoemann

    Joerg Roedel
     

24 Sep, 2014

1 commit

  • snprintf() returns the number of bytes that could have been written
    (excluding the null), not the actual number of bytes written. Given a
    long enough subsystem or device name, these functions will advance
    beyond the end of the on-stack buffer in dev_vprintk_exit(), resulting
    in an information leak or stack corruption. I don't know whether such
    a long name is currently possible.

    In case snprintf() returns a value >= the buffer size, do not add
    structured logging information. Also WARN if this happens, so we can
    fix the driver or increase the buffer size.

    Signed-off-by: Ben Hutchings
    Signed-off-by: Greg Kroah-Hartman

    Ben Hutchings
     

17 Apr, 2014

1 commit


26 Mar, 2014

1 commit


09 Mar, 2014

1 commit

  • This reverts commit 401097ea4b89846d66ac78f7f108d49c2e922d9c. The
    original changelog said:

    A patch series to make .shutdown execute asynchronously. Some drivers's
    shutdown can take a lot of time. The patches can help save some shutdown
    time. The patches use Arjan's async API.

    This patch:

    synchronize all tasks submitted by .shutdown

    However, I'm not able to find any evidence that any other patches from
    this series were applied, nor am I able to find any async tasks that are
    scheduled in a .shutdown context.

    On the other hand, we see occasional hangs on shutdown that appear to be
    caused by the async_synchronize_full() in device_shutdown() waiting
    forever for the async probing in sd if a SCSI disk shows up at just the
    wrong time — the system starts the probe, but begins shutting down and
    tears down too much of the SCSI driver to finish the probe.

    If we had any async shutdown tasks, I guess the right fix would be to
    create a "shutdown" async domain and have device_shutdown() only wait
    for that domain. But since there apparently are no async shutdown
    tasks, we can just revert the waiting.

    Signed-off-by: Roland Dreier
    Signed-off-by: Greg Kroah-Hartman

    Roland Dreier
     

16 Feb, 2014

1 commit


08 Feb, 2014

2 commits

  • All device_schedule_callback_owner() users are converted to use
    device_remove_file_self(). Remove now unused
    {sysfs|device}_schedule_callback_owner().

    Signed-off-by: Tejun Heo
    Signed-off-by: Greg Kroah-Hartman

    Tejun Heo
     
  • Sometimes it's necessary to implement a node which wants to delete
    nodes including itself. This isn't straightforward because of kernfs
    active reference. While a file operation is in progress, an active
    reference is held and kernfs_remove() waits for all such references to
    drain before completing. For a self-deleting node, this is a deadlock
    as kernfs_remove() ends up waiting for an active reference that itself
    is sitting on top of.

    This currently is worked around in the sysfs layer using
    sysfs_schedule_callback() which makes such removals asynchronous.
    While it works, it's rather cumbersome and inherently breaks
    synchronicity of the operation - the file operation which triggered
    the operation may complete before the removal is finished (or even
    started) and the removal may fail asynchronously. If a removal
    operation is immmediately followed by another operation which expects
    the specific name to be available (e.g. removal followed by rename
    onto the same name), there's no way to make the latter operation
    reliable.

    The thing is there's no inherent reason for this to be asynchrnous.
    All that's necessary to do this synchronous is a dedicated operation
    which drops its own active ref and deactivates self. This patch
    implements kernfs_remove_self() and its wrappers in sysfs and driver
    core. kernfs_remove_self() is to be called from one of the file
    operations, drops the active ref the task is holding, removes the self
    node, and restores active ref to the dead node so that the ref is
    balanced afterwards. __kernfs_remove() is updated so that it takes an
    early exit if the target node is already fully removed so that the
    active ref restored by kernfs_remove_self() after removal doesn't
    confuse the deactivation path.

    This makes implementing self-deleting nodes very easy. The normal
    removal path doesn't even need to be changed to use
    kernfs_remove_self() for the self-deleting node. The method can
    invoke kernfs_remove_self() on itself before proceeding the normal
    removal path. kernfs_remove() invoked on the node by the normal
    deletion path will simply be ignored.

    This will replace sysfs_schedule_callback(). A subtle feature of
    sysfs_schedule_callback() is that it collapses multiple invocations -
    even if multiple removals are triggered, the removal callback is run
    only once. An equivalent effect can be achieved by testing the return
    value of kernfs_remove_self() - only the one which gets %true return
    value should proceed with actual deletion. All other instances of
    kernfs_remove_self() will wait till the enclosing kernfs operation
    which invoked the winning instance of kernfs_remove_self() finishes
    and then return %false. This trivially makes all users of
    kernfs_remove_self() automatically show correct synchronous behavior
    even when there are multiple concurrent operations - all "echo 1 >
    delete" instances will finish only after the whole operation is
    completed by one of the instances.

    Note that manipulation of active ref is implemented in separate public
    functions - kernfs_[un]break_active_protection().
    kernfs_remove_self() is the only user at the moment but this will be
    used to cater to more complex cases.

    v2: For !CONFIG_SYSFS, dummy version kernfs_remove_self() was missing
    and sysfs_remove_file_self() had incorrect return type. Fix it.
    Reported by kbuild test bot.

    v3: kernfs_[un]break_active_protection() separated out from
    kernfs_remove_self() and exposed as public API.

    Signed-off-by: Tejun Heo
    Cc: Alan Stern
    Cc: kbuild test robot
    Signed-off-by: Greg Kroah-Hartman

    Tejun Heo
     

14 Jan, 2014

2 commits

  • This reverts commit 1ae06819c77cff1ea2833c94f8c093fe8a5c79db.

    Tejun writes:
    I'm sorry but can you please revert the whole series?
    get_active() waiting while a node is deactivated has potential
    to lead to deadlock and that deactivate/reactivate interface is
    something fundamentally flawed and that cgroup will have to work
    with the remove_self() like everybody else. IOW, I think the
    first posting was correct.

    Cc: Tejun Heo
    Cc: Alan Stern
    Cc: kbuild test robot
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     
  • This reverts commit d1ba277e79889085a2faec3b68b91ce89c63f888.

    Tejun writes:
    I'm sorry but can you please revert the whole series?
    get_active() waiting while a node is deactivated has potential
    to lead to deadlock and that deactivate/reactivate interface is
    something fundamentally flawed and that cgroup will have to work
    with the remove_self() like everybody else. IOW, I think the
    first posting was correct.

    Cc: Tejun Heo
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

11 Jan, 2014

2 commits

  • All device_schedule_callback_owner() users are converted to use
    device_remove_file_self(). Remove now unused
    {sysfs|device}_schedule_callback_owner().

    Signed-off-by: Tejun Heo
    Signed-off-by: Greg Kroah-Hartman

    Tejun Heo
     
  • Sometimes it's necessary to implement a node which wants to delete
    nodes including itself. This isn't straightforward because of kernfs
    active reference. While a file operation is in progress, an active
    reference is held and kernfs_remove() waits for all such references to
    drain before completing. For a self-deleting node, this is a deadlock
    as kernfs_remove() ends up waiting for an active reference that itself
    is sitting on top of.

    This currently is worked around in the sysfs layer using
    sysfs_schedule_callback() which makes such removals asynchronous.
    While it works, it's rather cumbersome and inherently breaks
    synchronicity of the operation - the file operation which triggered
    the operation may complete before the removal is finished (or even
    started) and the removal may fail asynchronously. If a removal
    operation is immmediately followed by another operation which expects
    the specific name to be available (e.g. removal followed by rename
    onto the same name), there's no way to make the latter operation
    reliable.

    The thing is there's no inherent reason for this to be asynchrnous.
    All that's necessary to do this synchronous is a dedicated operation
    which drops its own active ref and deactivates self. This patch
    implements kernfs_remove_self() and its wrappers in sysfs and driver
    core. kernfs_remove_self() is to be called from one of the file
    operations, drops the active ref and deactivates using
    __kernfs_deactivate_self(), removes the self node, and restores active
    ref to the dead node using __kernfs_reactivate_self() so that the ref
    is balanced afterwards. __kernfs_remove() is updated so that it takes
    an early exit if the target node is already fully removed so that the
    active ref restored by kernfs_remove_self() after removal doesn't
    confuse the deactivation path.

    This makes implementing self-deleting nodes very easy. The normal
    removal path doesn't even need to be changed to use
    kernfs_remove_self() for the self-deleting node. The method can
    invoke kernfs_remove_self() on itself before proceeding the normal
    removal path. kernfs_remove() invoked on the node by the normal
    deletion path will simply be ignored.

    This will replace sysfs_schedule_callback(). A subtle feature of
    sysfs_schedule_callback() is that it collapses multiple invocations -
    even if multiple removals are triggered, the removal callback is run
    only once. An equivalent effect can be achieved by testing the return
    value of kernfs_remove_self() - only the one which gets %true return
    value should proceed with actual deletion. All other instances of
    kernfs_remove_self() will wait till the enclosing kernfs operation
    which invoked the winning instance of kernfs_remove_self() finishes
    and then return %false. This trivially makes all users of
    kernfs_remove_self() automatically show correct synchronous behavior
    even when there are multiple concurrent operations - all "echo 1 >
    delete" instances will finish only after the whole operation is
    completed by one of the instances.

    v2: For !CONFIG_SYSFS, dummy version kernfs_remove_self() was missing
    and sysfs_remove_file_self() had incorrect return type. Fix it.
    Reported by kbuild test bot.

    v3: Updated to use __kernfs_{de|re}activate_self().

    Signed-off-by: Tejun Heo
    Cc: Alan Stern
    Cc: kbuild test robot
    Signed-off-by: Greg Kroah-Hartman

    Tejun Heo
     

19 Dec, 2013

1 commit


09 Dec, 2013

1 commit

  • We call put_device() in the error path, which is fine for dev==NULL.
    However, in case kobject_set_name_vargs() fails, we have dev!=NULL but
    device_initialized() wasn't called, yet.

    Fix this by splitting device_register() into explicit calls to
    device_add() and an early call to device_initialize().

    Signed-off-by: David Herrmann
    Signed-off-by: Greg Kroah-Hartman

    David Herrmann
     

17 Oct, 2013

1 commit


06 Oct, 2013

2 commits


30 Sep, 2013

1 commit


27 Sep, 2013

2 commits

  • There's no reason for sysfs to be calling ktype->namespace(). It is
    backwards, obfuscates what's going on and unnecessarily tangles two
    separate layers.

    There are two places where symlink code calls ktype->namespace().

    * sysfs_do_create_link_sd() calls it to find out the namespace tag of
    the target directory. Unless symlinking races with cross-namespace
    renaming, this equals @target_sd->s_ns.

    * sysfs_rename_link() uses it to find out the new namespace to rename
    to and the new namespace can be different from the existing one.
    The function is renamed to sysfs_rename_link_ns() with an explicit
    @ns argument and the ktype->namespace() invocation is shifted to the
    device layer.

    While this patch replaces ktype->namespace() invocation with the
    recorded result in @target_sd, this shouldn't result in any behvior
    difference.

    Signed-off-by: Tejun Heo
    Cc: Eric W. Biederman
    Cc: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Tejun Heo
     
  • The put_device(dev) at the bottom of the loop of device_shutdown
    may result in the dev being cleaned up. In device_create_release,
    the dev is kfreed.

    However, device_shutdown attempts to use the dev pointer again after
    put_device by referring to dev->parent.

    Copy the parent pointer instead to avoid this condition.

    This bug was found on Chromium OS's chromeos-3.8, which is based on v3.8.11.
    See bug report : https://code.google.com/p/chromium/issues/detail?id=297842
    This can easily be reproduced when shutting down with
    hidraw devices that report battery condition.
    Two examples are the HP Bluetooth Mouse X4000b and the Apple Magic Mouse.
    For example, with the magic mouse :
    The dev in question is "hidraw0"
    dev->parent is "magicmouse"

    In the course of the shutdown for this device, the input event cleanup calls
    a put on hidraw0, decrementing its reference count.
    When we finally get to put_device(dev) in device_shutdown, kobject_cleanup
    is called and device_create_release does kfree(dev).
    dev->parent is no longer valid, and we may crash in
    put_device(dev->parent).

    This change should be applied on any kernel with this change :
    d1c6c030fcec6f860d9bb6c632a3ebe62e28440b

    Cc: stable@vger.kernel.org
    Signed-off-by: Benson Leung
    Reviewed-by: Ming Lei
    Signed-off-by: Greg Kroah-Hartman

    Benson Leung