08 Aug, 2019

1 commit

  • Since commit c66d4bd110a1f8 ("genirq/affinity: Add new callback for
    (re)calculating interrupt sets"), irq_create_affinity_masks() returns
    NULL in case of single vector. This change has caused regression on some
    drivers, such as lpfc.

    The problem is that single vector requests can happen in some generic cases:

    1) kdump kernel

    2) irq vectors resource is close to exhaustion.

    If in that situation the affinity mask for a single vector is not created,
    every caller has to handle the special case.

    There is no reason why the mask cannot be created, so remove the check for
    a single vector and create the mask.

    Fixes: c66d4bd110a1f8 ("genirq/affinity: Add new callback for (re)calculating interrupt sets")
    Signed-off-by: Ming Lei
    Signed-off-by: Thomas Gleixner
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190805011906.5020-1-ming.lei@redhat.com

    Ming Lei
     

09 Jul, 2019

2 commits

  • Pull x96 apic updates from Thomas Gleixner:
    "Updates for the x86 APIC interrupt handling and APIC timer:

    - Fix a long standing issue with spurious interrupts which was caused
    by the big vector management rework a few years ago. Robert Hodaszi
    provided finally enough debug data and an excellent initial failure
    analysis which allowed to understand the underlying issues.

    This contains a change to the core interrupt management code which
    is required to handle this correctly for the APIC/IO_APIC. The core
    changes are NOOPs for most architectures except ARM64. ARM64 is not
    impacted by the change as confirmed by Marc Zyngier.

    - Newer systems allow to disable the PIT clock for power saving
    causing panic in the timer interrupt delivery check of the IO/APIC
    when the HPET timer is not enabled either. While the clock could be
    turned on this would cause an endless whack a mole game to chase
    the proper register in each affected chipset.

    These systems provide the relevant frequencies for TSC, CPU and the
    local APIC timer via CPUID and/or MSRs, which allows to avoid the
    PIT/HPET based calibration. As the calibration code is the only
    usage of the legacy timers on modern systems and is skipped anyway
    when the frequencies are known already, there is no point in
    setting up the PIT and actually checking for the interrupt delivery
    via IO/APIC.

    To achieve this on a wide variety of platforms, the CPUID/MSR based
    frequency readout has been made more robust, which also allowed to
    remove quite some workarounds which turned out to be not longer
    required. Thanks to Daniel Drake for analysis, patches and
    verification"

    * 'x86-apic-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    x86/irq: Seperate unused system vectors from spurious entry again
    x86/irq: Handle spurious interrupt after shutdown gracefully
    x86/ioapic: Implement irq_get_irqchip_state() callback
    genirq: Add optional hardware synchronization for shutdown
    genirq: Fix misleading synchronize_irq() documentation
    genirq: Delay deactivation in free_irq()
    x86/timer: Skip PIT initialization on modern chipsets
    x86/apic: Use non-atomic operations when possible
    x86/apic: Make apic_bsp_setup() static
    x86/tsc: Set LAPIC timer period to crystal clock frequency
    x86/apic: Rename 'lapic_timer_frequency' to 'lapic_timer_period'
    x86/tsc: Use CPUID.0x16 to calculate missing crystal frequency

    Linus Torvalds
     
  • Pull irq updates from Thomas Gleixner:
    "The irq departement provides the usual mixed bag:

    Core:

    - Further improvements to the irq timings code which aims to predict
    the next interrupt for power state selection to achieve better
    latency/power balance

    - Add interrupt statistics to the core NMI handlers

    - The usual small fixes and cleanups

    Drivers:

    - Support for Renesas RZ/A1, Annapurna Labs FIC, Meson-G12A SoC and
    Amazon Gravition AMR/GIC interrupt controllers.

    - Rework of the Renesas INTC controller driver

    - ACPI support for Socionext SoCs

    - Enhancements to the CSKY interrupt controller

    - The usual small fixes and cleanups"

    * 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (39 commits)
    irq/irqdomain: Fix comment typo
    genirq: Update irq stats from NMI handlers
    irqchip/gic-pm: Remove PM_CLK dependency
    irqchip/al-fic: Introduce Amazon's Annapurna Labs Fabric Interrupt Controller Driver
    dt-bindings: interrupt-controller: Add Amazon's Annapurna Labs FIC
    softirq: Use __this_cpu_write() in takeover_tasklets()
    irqchip/mbigen: Stop printing kernel addresses
    irqchip/gic: Add dependency for ARM_GIC_MAX_NR
    genirq/affinity: Remove unused argument from [__]irq_build_affinity_masks()
    genirq/timings: Add selftest for next event computation
    genirq/timings: Add selftest for irqs circular buffer
    genirq/timings: Add selftest for circular array
    genirq/timings: Encapsulate storing function
    genirq/timings: Encapsulate timings push
    genirq/timings: Optimize the period detection speed
    genirq/timings: Fix timings buffer inspection
    genirq/timings: Fix next event index function
    irqchip/qcom: Use struct_size() in devm_kzalloc()
    irqchip/irq-csky-mpintc: Remove unnecessary loop in interrupt handler
    dt-bindings: interrupt-controller: Update csky mpintc
    ...

    Linus Torvalds
     

06 Jul, 2019

2 commits

  • Fix typo in the comment on top of __irq_domain_add().

    Signed-off-by: Zenghui Yu
    Signed-off-by: Thomas Gleixner
    Link: https://lkml.kernel.org/r/1562388072-23492-1-git-send-email-yuzenghui@huawei.com

    Zenghui Yu
     
  • The NMI handlers handle_percpu_devid_fasteoi_nmi() and handle_fasteoi_nmi()
    do not update the interrupt counts. Due to that the NMI interrupt count
    does not show up correctly in /proc/interrupts.

    Add the statistics and treat the NMI handlers in the same way as per cpu
    interrupts and prevent them from updating irq_desc::tot_count as this might
    be corrupted due to concurrency.

    [ tglx: Massaged changelog ]

    Fixes: 2dcf1fbcad35 ("genirq: Provide NMI handlers")
    Signed-off-by: Shijith Thotton
    Signed-off-by: Thomas Gleixner
    Link: https://lkml.kernel.org/r/1562313336-11888-1-git-send-email-sthotton@marvell.com

    Shijith Thotton
     

03 Jul, 2019

3 commits

  • free_irq() ensures that no hardware interrupt handler is executing on a
    different CPU before actually releasing resources and deactivating the
    interrupt completely in a domain hierarchy.

    But that does not catch the case where the interrupt is on flight at the
    hardware level but not yet serviced by the target CPU. That creates an
    interesing race condition:

    CPU 0 CPU 1 IRQ CHIP

    interrupt is raised
    sent to CPU1
    Unable to handle
    immediately
    (interrupts off,
    deep idle delay)
    mask()
    ...
    free()
    shutdown()
    synchronize_irq()
    release_resources()
    do_IRQ()
    -> resources are not available

    That might be harmless and just trigger a spurious interrupt warning, but
    some interrupt chips might get into a wedged state.

    Utilize the existing irq_get_irqchip_state() callback for the
    synchronization in free_irq().

    synchronize_hardirq() is not using this mechanism as it might actually
    deadlock unter certain conditions, e.g. when called with interrupts
    disabled and the target CPU is the one on which the synchronization is
    invoked. synchronize_irq() uses it because that function cannot be called
    from non preemtible contexts as it might sleep.

    No functional change intended and according to Marc the existing GIC
    implementations where the driver supports the callback should be able
    to cope with that core change. Famous last words.

    Fixes: 464d12309e1b ("x86/vector: Switch IOAPIC to global reservation mode")
    Reported-by: Robert Hodaszi
    Signed-off-by: Thomas Gleixner
    Reviewed-by: Marc Zyngier
    Tested-by: Marc Zyngier
    Link: https://lkml.kernel.org/r/20190628111440.279463375@linutronix.de

    Thomas Gleixner
     
  • The function might sleep, so it cannot be called from interrupt
    context. Not even with care.

    Signed-off-by: Thomas Gleixner
    Cc: Marc Zyngier
    Link: https://lkml.kernel.org/r/20190628111440.189241552@linutronix.de

    Thomas Gleixner
     
  • When interrupts are shutdown, they are immediately deactivated in the
    irqdomain hierarchy. While this looks obviously correct there is a subtle
    issue:

    There might be an interrupt in flight when free_irq() is invoking the
    shutdown. This is properly handled at the irq descriptor / primary handler
    level, but the deactivation might completely disable resources which are
    required to acknowledge the interrupt.

    Split the shutdown code and deactivate the interrupt after synchronization
    in free_irq(). Fixup all other usage sites where this is not an issue to
    invoke the combined shutdown_and_deactivate() function instead.

    This still might be an issue if the interrupt in flight servicing is
    delayed on a remote CPU beyond the invocation of synchronize_irq(), but
    that cannot be handled at that level and needs to be handled in the
    synchronize_irq() context.

    Fixes: f8264e34965a ("irqdomain: Introduce new interfaces to support hierarchy irqdomains")
    Reported-by: Robert Hodaszi
    Signed-off-by: Thomas Gleixner
    Reviewed-by: Marc Zyngier
    Link: https://lkml.kernel.org/r/20190628111440.098196390@linutronix.de

    Thomas Gleixner
     

21 Jun, 2019

1 commit

  • In the presence of any form of instrumentation, nmi_enter() should be
    done before calling any traceable code and any instrumentation code.

    Currently, nmi_enter() is done in handle_domain_nmi(), which is much
    too late as instrumentation code might get called before. Move the
    nmi_enter/exit() calls to the arch IRQ vector handler.

    On arm64, it is not possible to know if the IRQ vector handler was
    called because of an NMI before acknowledging the interrupt. However, It
    is possible to know whether normal interrupts could be taken in the
    interrupted context (i.e. if taking an NMI in that context could
    introduce a potential race condition).

    When interrupting a context with IRQs disabled, call nmi_enter() as soon
    as possible. In contexts with IRQs enabled, defer this to the interrupt
    controller, which is in a better position to know if an interrupt taken
    is an NMI.

    Fixes: bc3c03ccb464 ("arm64: Enable the support of pseudo-NMIs")
    Cc: # 5.1.x-
    Cc: Will Deacon
    Cc: Thomas Gleixner
    Cc: Jason Cooper
    Cc: Mark Rutland
    Reviewed-by: Marc Zyngier
    Signed-off-by: Julien Thierry
    Signed-off-by: Catalin Marinas

    Julien Thierry
     

12 Jun, 2019

9 commits

  • The *affd argument is neither used in irq_build_affinity_masks() nor
    __irq_build_affinity_masks(). Remove it.

    Signed-off-by: Minwoo Im
    Signed-off-by: Thomas Gleixner
    Reviewed-by: Ming Lei
    Cc: Minwoo Im
    Cc: linux-block@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190602112117.31839-1-minwoo.im.dev@gmail.com

    Minwoo Im
     
  • The circular buffers are now validated with selftests. The next interrupt
    index algorithm which is the hardest part to validate needs extra coverage.

    Add a selftest which uses the intervals stored in the arrays and insert all
    the values except the last one. The next event computation must return the
    same value as the last element which was not inserted.

    Signed-off-by: Daniel Lezcano
    Signed-off-by: Thomas Gleixner
    Cc: andriy.shevchenko@linux.intel.com
    Link: https://lkml.kernel.org/r/20190527205521.12091-9-daniel.lezcano@linaro.org

    Daniel Lezcano
     
  • After testing the per cpu interrupt circular event, make sure the per
    interrupt circular buffer usage is correct.

    Add tests to validate the interrupt circular buffer.

    Signed-off-by: Daniel Lezcano
    Signed-off-by: Thomas Gleixner
    Cc: andriy.shevchenko@linux.intel.com
    Link: https://lkml.kernel.org/r/20190527205521.12091-8-daniel.lezcano@linaro.org

    Daniel Lezcano
     
  • Due to the complexity of the code and the difficulty to debug it, add some
    selftests to the framework in order to spot issues or regression at boot
    time when the runtime testing is enabled for this subsystem.

    This tests the circular buffer at the limits and validates:
    - the encoding / decoding of the values
    - the macro to browse the irq timings circular buffer
    - the function to push data in the circular buffer

    Signed-off-by: Daniel Lezcano
    Signed-off-by: Thomas Gleixner
    Cc: andriy.shevchenko@linux.intel.com
    Link: https://lkml.kernel.org/r/20190527205521.12091-7-daniel.lezcano@linaro.org

    Daniel Lezcano
     
  • For the next patches providing the selftest, it is required to insert
    interval values directly in the buffer in order to check the correctness of
    the code. Encapsulate the code doing that in a always inline function in
    order to reuse it in the test code.

    No functional changes.

    Signed-off-by: Daniel Lezcano
    Signed-off-by: Thomas Gleixner
    Cc: andriy.shevchenko@linux.intel.com
    Link: https://lkml.kernel.org/r/20190527205521.12091-6-daniel.lezcano@linaro.org

    Daniel Lezcano
     
  • For the next patches providing the selftest, it is required to artificially
    insert timings value in the circular buffer in order to check the
    correctness of the code. Encapsulate the common code between the future
    test code and the current code with an always-inline tag.

    No functional change.

    Signed-off-by: Daniel Lezcano
    Signed-off-by: Thomas Gleixner
    Cc: andriy.shevchenko@linux.intel.com
    Link: https://lkml.kernel.org/r/20190527205521.12091-5-daniel.lezcano@linaro.org

    Daniel Lezcano
     
  • With a minimal period and if there is a period which is a multiple of it
    but lesser than the max period then it will be detected before and the
    minimal period will be never reached.

    1 2 1 2 1 2 1 2 1 2 1 2

    In that case, the minimum period is 2 and the maximum period is 5. That
    means all repeating pattern of 2 will be detected as repeating pattern of
    4, it is pointless to go up to 2 when searching for the period as it will
    always fail.

    Remove one loop iteration by increasing the minimal period to 3.

    Signed-off-by: Daniel Lezcano
    Signed-off-by: Thomas Gleixner
    Cc: andriy.shevchenko@linux.intel.com
    Link: https://lkml.kernel.org/r/20190527205521.12091-4-daniel.lezcano@linaro.org

    Daniel Lezcano
     
  • It appears the index beginning computation is not correct, the current
    code does:

    i = (irqts->count & IRQ_TIMINGS_MASK) - 1

    If irqts->count is equal to zero, we end up with an index equal to -1,
    but that does not happen because the function checks against zero
    before and returns in such case.

    However, if irqts->count is a multiple of IRQ_TIMINGS_SIZE, the
    resulting & bit op will be zero and leads also to a -1 index.

    Re-introduce the iteration loop belonging to the previous variance
    code which was correct.

    Fixes: bbba0e7c5cda "genirq/timings: Add array suffix computation code"
    Signed-off-by: Daniel Lezcano
    Signed-off-by: Thomas Gleixner
    Cc: andriy.shevchenko@linux.intel.com
    Link: https://lkml.kernel.org/r/20190527205521.12091-3-daniel.lezcano@linaro.org

    Daniel Lezcano
     
  • The current code is luckily working with most of the interval samples
    testing but actually it fails to correctly detect pattern repetition
    breaking at the end of the buffer.

    Narrowing down the bug has been a real pain because of the pointers,
    so the routine is rewrittne by using indexes instead.

    Fixes: bbba0e7c5cda "genirq/timings: Add array suffix computation code"
    Signed-off-by: Daniel Lezcano
    Signed-off-by: Thomas Gleixner
    Cc: andriy.shevchenko@linux.intel.com
    Link: https://lkml.kernel.org/r/20190527205521.12091-2-daniel.lezcano@linaro.org

    Daniel Lezcano
     

29 May, 2019

1 commit


21 May, 2019

1 commit


20 May, 2019

1 commit

  • Pull IRQ chip updates from Ingo Molnar:
    "A late irqchips update:

    - New TI INTR/INTA set of drivers

    - Rewrite of the stm32mp1-exti driver as a platform driver

    - Update the IOMMU MSI mapping API to be RT friendly

    - A number of cleanups and other low impact fixes"

    * 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (34 commits)
    iommu/dma-iommu: Remove iommu_dma_map_msi_msg()
    irqchip/gic-v3-mbi: Don't map the MSI page in mbi_compose_m{b, s}i_msg()
    irqchip/ls-scfg-msi: Don't map the MSI page in ls_scfg_msi_compose_msg()
    irqchip/gic-v3-its: Don't map the MSI page in its_irq_compose_msi_msg()
    irqchip/gicv2m: Don't map the MSI page in gicv2m_compose_msi_msg()
    iommu/dma-iommu: Split iommu_dma_map_msi_msg() in two parts
    genirq/msi: Add a new field in msi_desc to store an IOMMU cookie
    arm64: arch_k3: Enable interrupt controller drivers
    irqchip/ti-sci-inta: Add msi domain support
    soc: ti: Add MSI domain bus support for Interrupt Aggregator
    irqchip/ti-sci-inta: Add support for Interrupt Aggregator driver
    dt-bindings: irqchip: Introduce TISCI Interrupt Aggregator bindings
    irqchip/ti-sci-intr: Add support for Interrupt Router driver
    dt-bindings: irqchip: Introduce TISCI Interrupt router bindings
    gpio: thunderx: Use the default parent apis for {request,release}_resources
    genirq: Introduce irq_chip_{request,release}_resource_parent() apis
    firmware: ti_sci: Add helper apis to manage resources
    firmware: ti_sci: Add RM mapping table for am654
    firmware: ti_sci: Add support for IRQ management
    firmware: ti_sci: Add support for RM core ops
    ...

    Linus Torvalds
     

08 May, 2019

2 commits

  • Pull driver core/kobject updates from Greg KH:
    "Here is the "big" set of driver core patches for 5.2-rc1

    There are a number of ACPI patches in here as well, as Rafael said
    they should go through this tree due to the driver core changes they
    required. They have all been acked by the ACPI developers.

    There are also a number of small subsystem-specific changes in here,
    due to some changes to the kobject core code. Those too have all been
    acked by the various subsystem maintainers.

    As for content, it's pretty boring outside of the ACPI changes:
    - spdx cleanups
    - kobject documentation updates
    - default attribute groups for kobjects
    - other minor kobject/driver core fixes

    All have been in linux-next for a while with no reported issues"

    * tag 'driver-core-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (47 commits)
    kobject: clean up the kobject add documentation a bit more
    kobject: Fix kernel-doc comment first line
    kobject: Remove docstring reference to kset
    firmware_loader: Fix a typo ("syfs" -> "sysfs")
    kobject: fix dereference before null check on kobj
    Revert "driver core: platform: Fix the usage of platform device name(pdev->name)"
    init/config: Do not select BUILD_BIN2C for IKCONFIG
    Provide in-kernel headers to make extending kernel easier
    kobject: Improve doc clarity kobject_init_and_add()
    kobject: Improve docs for kobject_add/del
    driver core: platform: Fix the usage of platform device name(pdev->name)
    livepatch: Replace klp_ktype_patch's default_attrs with groups
    cpufreq: schedutil: Replace default_attrs field with groups
    padata: Replace padata_attr_type default_attrs field with groups
    irqdesc: Replace irq_kobj_type's default_attrs field with groups
    net-sysfs: Replace ktype default_attrs field with groups
    block: Replace all ktype default_attrs with groups
    samples/kobject: Replace foo_ktype's default_attrs field with groups
    kobject: Add support for default attribute groups to kobj_type
    driver core: Postpone DMA tear-down until after devres release for probe failure
    ...

    Linus Torvalds
     
  • Pull printk updates from Petr Mladek:

    - Allow state reset of printk_once() calls.

    - Prevent crashes when dereferencing invalid pointers in vsprintf().
    Only the first byte is checked for simplicity.

    - Make vsprintf warnings consistent and inlined.

    - Treewide conversion of obsolete %pf, %pF to %ps, %pF printf
    modifiers.

    - Some clean up of vsprintf and test_printf code.

    * tag 'printk-for-5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/pmladek/printk:
    lib/vsprintf: Make function pointer_string static
    vsprintf: Limit the length of inlined error messages
    vsprintf: Avoid confusion between invalid address and value
    vsprintf: Prevent crash when dereferencing invalid pointers
    vsprintf: Consolidate handling of unknown pointer specifiers
    vsprintf: Factor out %pO handler as kobject_string()
    vsprintf: Factor out %pV handler as va_format()
    vsprintf: Factor out %p[iI] handler as ip_addr_string()
    vsprintf: Do not check address of well-known strings
    vsprintf: Consistent %pK handling for kptr_restrict == 0
    vsprintf: Shuffle restricted_pointer()
    printk: Tie printk_once / printk_deferred_once into .data.once for reset
    treewide: Switch printk users from %pf and %pF to %ps and %pS, respectively
    lib/test_printf: Switch to bitmap_zalloc()

    Linus Torvalds
     

07 May, 2019

1 commit

  • Pull irq updates from Ingo Molnar:
    "The changes in this cycle were:

    - Remove the irq timings/variance statistics code that tried to
    predict when the next interrupt would occur, which didn't work out
    as hoped and is replaced by another mechanism.

    - This new mechanism is the 'array suffix computation' estimate,
    which is superior to the previous one as it can detect not just a
    single periodic pattern, but independent periodic patterns along a
    log-2 scale of bucketing and exponential moving average. The
    comments are longer than the code - and it works better at
    predicting various complex interrupt patterns from real-world
    devices than the previous estimate.

    - avoid IRQ-work self-IPIs on the local CPU

    - fix work-list corruption in irq_set_affinity_notifier()"

    * 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    irq_work: Do not raise an IPI when queueing work on the local CPU
    genirq/devres: Use struct_size() in devm_kzalloc()
    genirq/timings: Add array suffix computation code
    genirq/timings: Remove variance computation code
    genirq: Prevent use-after-free and work list corruption

    Linus Torvalds
     

06 May, 2019

1 commit


03 May, 2019

1 commit

  • When an MSI doorbell is located downstream of an IOMMU, it is required
    to swizzle the physical address with an appropriately-mapped IOVA for any
    device attached to one of our DMA ops domain.

    At the moment, the allocation of the mapping may be done when composing
    the message. However, the composing may be done in non-preemtible
    context while the allocation requires to be called from preemptible
    context.

    A follow-up change will split the current logic in two functions
    requiring to keep an IOMMU cookie per MSI.

    A new field is introduced in msi_desc to store an IOMMU cookie. As the
    cookie may not be required in some configuration, the field is protected
    under a new config CONFIG_IRQ_MSI_IOMMU.

    A pair of helpers has also been introduced to access the field.

    Signed-off-by: Julien Grall
    Reviewed-by: Robin Murphy
    Reviewed-by: Eric Auger
    Signed-off-by: Marc Zyngier

    Julien Grall
     

01 May, 2019

1 commit


29 Apr, 2019

1 commit


26 Apr, 2019

1 commit

  • The kobj_type default_attrs field is being replaced by the
    default_groups field. Replace irq_kobj_type's default_attrs field with
    default_groups and use the ATTRIBUTE_GROUPS macro to create irq_groups.

    This patch was tested by verifying that the sysfs files for the
    attributes in the default groups were created.

    Signed-off-by: Kimberly Brown
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Kimberly Brown
     

17 Apr, 2019

1 commit

  • One of the more common cases of allocation size calculations is finding
    the size of a structure that has a zero-sized array at the end, along
    with memory for some number of elements for that array. For example:

    struct foo {
    int stuff;
    struct boo entry[];
    };

    size = sizeof(struct foo) + count * sizeof(struct boo);
    instance = devm_kzalloc(dev, size, GFP_KERNEL);

    Instead of leaving these open-coded and prone to type mistakes, we can
    now use the new struct_size() helper.

    instance = devm_kzalloc(dev, struct_size(instance, entry, count), GFP_KERNEL);

    This code was detected with the help of Coccinelle.

    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: Thomas Gleixner
    Link: https://lkml.kernel.org/r/20190410170914.GA16161@embeddedor

    Gustavo A. R. Silva
     

09 Apr, 2019

1 commit

  • %pF and %pf are functionally equivalent to %pS and %ps conversion
    specifiers. The former are deprecated, therefore switch the current users
    to use the preferred variant.

    The changes have been produced by the following command:

    git grep -l '%p[fF]' | grep -v '^\(tools\|Documentation\)/' | \
    while read i; do perl -i -pe 's/%pf/%ps/g; s/%pF/%pS/g;' $i; done

    And verifying the result.

    Link: http://lkml.kernel.org/r/20190325193229.23390-1-sakari.ailus@linux.intel.com
    Cc: Andy Shevchenko
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: sparclinux@vger.kernel.org
    Cc: linux-um@lists.infradead.org
    Cc: xen-devel@lists.xenproject.org
    Cc: linux-acpi@vger.kernel.org
    Cc: linux-pm@vger.kernel.org
    Cc: drbd-dev@lists.linbit.com
    Cc: linux-block@vger.kernel.org
    Cc: linux-mmc@vger.kernel.org
    Cc: linux-nvdimm@lists.01.org
    Cc: linux-pci@vger.kernel.org
    Cc: linux-scsi@vger.kernel.org
    Cc: linux-btrfs@vger.kernel.org
    Cc: linux-f2fs-devel@lists.sourceforge.net
    Cc: linux-mm@kvack.org
    Cc: ceph-devel@vger.kernel.org
    Cc: netdev@vger.kernel.org
    Signed-off-by: Sakari Ailus
    Acked-by: David Sterba (for btrfs)
    Acked-by: Mike Rapoport (for mm/memblock.c)
    Acked-by: Bjorn Helgaas (for drivers/pci)
    Acked-by: Rafael J. Wysocki
    Signed-off-by: Petr Mladek

    Sakari Ailus
     

06 Apr, 2019

2 commits

  • The previous approach based on the variance was discarding values from
    the timings when they were considered as anomalies as stated by the
    normal law statistical model.

    However in the interrupt life, there can be multiple anomalies due to the
    nature of the device generating the interrupts, and most of the time a
    repeating pattern can be observed, that is particulary true for network,
    console, MMC or SSD devices.

    The variance approach missed the patterns and it was only able to deal with
    the interrupt coming in regular intervals, thus reducing considerably the
    scope of what is predictable.

    In order to find out the repeating patterns, the interrupt intervals are
    grouped in a ilog2 basis to create a suite of numbers with small
    amplitude. Every group contains an exponential moving average of the values
    belonging to the group. The array suffix, a data structure used for string
    searching, data compression, etc ..., is built from the suite of numbers
    and the suffixes are then searched in this suite.

    The tests showed the algorithm is able to find all repeating patterns,
    as well as regular interval in less than 1us on x86-i7.

    Signed-off-by: Daniel Lezcano
    Signed-off-by: Thomas Gleixner
    Cc: rjw@rjwysocki.net
    Cc: ulf.hansson@linaro.org
    Cc: linux-pm@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190328151336.5316-2-daniel.lezcano@linaro.org

    Daniel Lezcano
     
  • The variance computation did not provide the expected results and will be
    replaced with a different approach to compute the next interrupt based on
    the array suffixes derived algorithm.

    There is no good way to transform the variance code to the new algorithm,
    so for ease of review remove the existing code first.

    Signed-off-by: Daniel Lezcano
    Signed-off-by: Thomas Gleixner
    Cc: rjw@rjwysocki.net
    Cc: ulf.hansson@linaro.org
    Cc: linux-pm@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190328151336.5316-1-daniel.lezcano@linaro.org

    Daniel Lezcano
     

05 Apr, 2019

2 commits

  • If a child irqchip calls irq_chip_set_wake_parent() but its parent irqchip
    has the IRQCHIP_SKIP_SET_WAKE flag set an error is returned.

    This is inconsistent behaviour vs. set_irq_wake_real() which returns 0 when
    the irqchip has the IRQCHIP_SKIP_SET_WAKE flag set. It doesn't attempt to
    walk the chain of parents and set irq wake on any chips that don't have the
    flag set either. If the intent is to call the .irq_set_wake() callback of
    the parent irqchip, then we expect irqchip implementations to omit the
    IRQCHIP_SKIP_SET_WAKE flag and implement an .irq_set_wake() function that
    calls irq_chip_set_wake_parent().

    The problem has been observed on a Qualcomm sdm845 device where set wake
    fails on any GPIO interrupts after applying work in progress wakeup irq
    patches to the GPIO driver. The chain of chips looks like this:

    QCOM GPIO -> QCOM PDC (SKIP) -> ARM GIC (SKIP)

    The GPIO controllers parent is the QCOM PDC irqchip which in turn has ARM
    GIC as parent. The QCOM PDC irqchip has the IRQCHIP_SKIP_SET_WAKE flag
    set, and so does the grandparent ARM GIC.

    The GPIO driver doesn't know if the parent needs to set wake or not, so it
    unconditionally calls irq_chip_set_wake_parent() causing this function to
    return a failure because the parent irqchip (PDC) doesn't have the
    .irq_set_wake() callback set. Returning 0 instead makes everything work and
    irqs from the GPIO controller can be configured for wakeup.

    Make it consistent by returning 0 (success) from irq_chip_set_wake_parent()
    when a parent chip has IRQCHIP_SKIP_SET_WAKE set.

    [ tglx: Massaged changelog ]

    Fixes: 08b55e2a9208e ("genirq: Add irqchip_set_wake_parent")
    Signed-off-by: Stephen Boyd
    Signed-off-by: Thomas Gleixner
    Acked-by: Marc Zyngier
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: linux-gpio@vger.kernel.org
    Cc: Lina Iyer
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190325181026.247796-1-swboyd@chromium.org

    Stephen Boyd
     
  • When CONFIG_SPARSE_IRQ is disable, the request_mutex in struct irq_desc
    is not initialized which causes malfunction.

    Fixes: 9114014cf4e6 ("genirq: Add mutex to irq desc to serialize request/free_irq()")
    Signed-off-by: Kefeng Wang
    Signed-off-by: Thomas Gleixner
    Reviewed-by: Mukesh Ojha
    Cc: Marc Zyngier
    Cc:
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190404074512.145533-1-wangkefeng.wang@huawei.com

    Kefeng Wang
     

25 Mar, 2019

1 commit

  • When irq_set_affinity_notifier() replaces the notifier, then the
    reference count on the old notifier is dropped which causes it to be
    freed. But nothing ensures that the old notifier is not longer queued
    in the work list. If it is queued this results in a use after free and
    possibly in work list corruption.

    Ensure that the work is canceled before the reference is dropped.

    Signed-off-by: Prasad Sodagudi
    Signed-off-by: Thomas Gleixner
    Cc: marc.zyngier@arm.com
    Link: https://lkml.kernel.org/r/1553439424-6529-1-git-send-email-psodagud@codeaurora.org

    Prasad Sodagudi
     

23 Mar, 2019

1 commit

  • In preparation to enabling -Wimplicit-fallthrough, mark switch
    cases where we are expecting to fall through.

    With -Wimplicit-fallthrough added to CFLAGS:

    kernel/irq/manage.c: In function ‘irq_do_set_affinity’:
    kernel/irq/manage.c:198:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
    cpumask_copy(desc->irq_common_data.affinity, mask);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    kernel/irq/manage.c:199:2: note: here
    case IRQ_SET_MASK_OK_NOCOPY:
    ^~~~

    Annotate it.

    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: Thomas Gleixner
    Cc: Kees Cook
    Link: https://lkml.kernel.org/r/20190228213714.GA9246@embeddedor

    Gustavo A. R. Silva
     

22 Mar, 2019

1 commit


09 Mar, 2019

1 commit

  • Pull GPIO updates from Linus Walleij:
    "This is the bulk of GPIO changes for the v5.1 cycle:

    Core changes:

    - The big change this time around is the irqchip handling in the
    qualcomm pin controllers, closely coupled with the gpiochip. This
    rework, in a classic fall-between-the-chairs fashion has been
    sidestepped for too long.

    The Qualcomm IRQchips using the SPMI and SSBI transport mechanisms
    have been rewritten to use hierarchical irqchip. This creates the
    base from which I intend to gradually pull support for hierarchical
    irqchips into the gpiolib irqchip helpers to cut down on duplicate
    code.

    We have too many hacks in the kernel because people have been
    working around the missing hierarchical irqchip for years, and once
    it was there, noone understood it for a while. We are now slowly
    adapting to using it.

    This is why this pull requests include changes to MFD, SPMI,
    IRQchip core and some ARM Device Trees pertaining to the Qualcomm
    chip family. Since Qualcomm have so many chips and such large
    deployments it is paramount that this platform gets this right, and
    now it (hopefully) does.

    - Core support for pull-up and pull-down configuration, also from the
    device tree. When a simple GPIO chip supports an "off or on" pull-up
    or pull-down resistor, we provide a way to set this up using
    machine descriptors or device tree.

    If more elaborate control of pull up/down (such as resistance shunt
    setting) is required, drivers should be phased over to use pin
    control. We do not yet provide a userspace ABI for this pull
    up-down setting but I suspect the makers are going to ask for it
    soon enough. PCA953x is the first user of this new API.

    - The GPIO mockup driver has been revamped after some discussion
    improving the IRQ simulator in the process.

    The idea is to make it possible to use the mockup for both testing
    and virtual prototyping, e.g. when you do not yet have a GPIO
    expander to play with but really want to get something to develop
    code around before hardware is available. It's neat. The blackbox
    testing usecase is currently making its way into kernelci.

    - ACPI GPIO core preserves non direction flags when updating flags.

    - A new device core helper for devm_platform_ioremap_resource() is
    funneled through the GPIO tree with Greg's ACK.

    New drivers:

    - TQ-Systems QTMX86 GPIO controllers (using port-mapped I/O)

    - Gateworks PLD GPIO driver (vaccumed up from OpenWrt)

    - AMD G-Series PCH (Platform Controller Hub) GPIO driver.

    - Fintek F81804 & F81966 subvariants.

    - PCA953x now supports NXP PCAL6416.

    Driver improvements:

    - IRQ support on the Nintendo Wii (Hollywood) GPIO.

    - get_direction() support for the MVEBU driver.

    - Set the right output level on SAMA5D2.

    - Drop the unused irq trigger setting on the Spreadtrum driver.

    - Wakeup support for PCA953x.

    - A slew of cleanups in the various Intel drivers"

    * tag 'gpio-v5.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (110 commits)
    gpio: gpio-omap: fix level interrupt idling
    gpio: amd-fch: Set proper output level for direction_output
    x86: apuv2: remove unused variable
    gpio: pca953x: Use PCA_LATCH_INT
    platform/x86: fix PCENGINES_APU2 Kconfig warning
    gpio: pca953x: Fix dereference of irq data in shutdown
    gpio: amd-fch: Fix type error found by sparse
    gpio: amd-fch: Drop const from resource
    gpio: mxc: add check to return defer probe if clock tree NOT ready
    gpio: ftgpio: Register per-instance irqchip
    gpio: ixp4xx: Add DT bindings
    x86: pcengines apuv2 gpio/leds/keys platform driver
    gpio: AMD G-Series PCH gpio driver
    drivers: depend on HAS_IOMEM for devm_platform_ioremap_resource()
    gpio: tqmx86: Set proper output level for direction_output
    gpio: sprd: Change to use SoC compatible string
    gpio: sprd: Use SoC compatible string instead of wildcard string
    gpio: of: Handle both enable-gpio{,s}
    gpio: of: Restrict enable-gpio quirk to regulator-gpio
    gpio: davinci: use devm_platform_ioremap_resource()
    ...

    Linus Torvalds
     

23 Feb, 2019

1 commit