13 Jan, 2019

1 commit

  • commit 0211e12dd0a5385ecffd3557bc570dbad7fcf245 upstream.

    When the allocation of node_to_possible_cpumask fails, then
    irq_create_affinity_masks() returns with a pointer to the empty affinity
    masks array, which will cause malfunction.

    Reorder the allocations so the masks array allocation comes last and every
    failure path returns NULL.

    Fixes: 9a0ef98e186d ("genirq/affinity: Assign vectors to all present CPUs")
    Signed-off-by: Thomas Gleixner
    Cc: Christoph Hellwig
    Cc: Ming Lei
    Cc: Mihai Carabas
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

14 Nov, 2018

1 commit

  • commit 746a923b863a1065ef77324e1e43f19b1a3eab5c upstream.

    Commit 1e77d0a1ed74 ("genirq: Sanitize spurious interrupt detection of
    threaded irqs") made detection of spurious interrupts work for threaded
    handlers by:

    a) incrementing a counter every time the thread returns IRQ_HANDLED, and
    b) checking whether that counter has increased every time the thread is
    woken.

    However for oneshot interrupts, the commit unmasks the interrupt before
    incrementing the counter. If another interrupt occurs right after
    unmasking but before the counter is incremented, that interrupt is
    incorrectly considered spurious:

    time
    | irq_thread()
    | irq_thread_fn()
    | action->thread_fn()
    | irq_finalize_oneshot()
    | unmask_threaded_irq() /* interrupt is unmasked */
    |
    | /* interrupt fires, incorrectly deemed spurious */
    |
    | atomic_inc(&desc->threads_handled); /* counter is incremented */
    v

    This is observed with a hi3110 CAN controller receiving data at high volume
    (from a separate machine sending with "cangen -g 0 -i -x"): The controller
    signals a huge number of interrupts (hundreds of millions per day) and
    every second there are about a dozen which are deemed spurious.

    In theory with high CPU load and the presence of higher priority tasks, the
    number of incorrectly detected spurious interrupts might increase beyond
    the 99,900 threshold and cause disablement of the interrupt.

    In practice it just increments the spurious interrupt count. But that can
    cause people to waste time investigating it over and over.

    Fix it by moving the accounting before the invocation of
    irq_finalize_oneshot().

    [ tglx: Folded change log update ]

    Fixes: 1e77d0a1ed74 ("genirq: Sanitize spurious interrupt detection of threaded irqs")
    Signed-off-by: Lukas Wunner
    Signed-off-by: Thomas Gleixner
    Cc: Mathias Duckeck
    Cc: Akshay Bhat
    Cc: Casey Fitzpatrick
    Cc: stable@vger.kernel.org # v3.16+
    Link: https://lkml.kernel.org/r/1dfd8bbd16163940648045495e3e9698e63b50ad.1539867047.git.lukas@wunner.de
    Signed-off-by: Greg Kroah-Hartman

    Lukas Wunner
     

09 Aug, 2018

1 commit

  • commit d1f0301b3333eef5efbfa1fe0f0edbea01863d5d upstream.

    The support of force threading interrupts which are set up with both a
    primary and a threaded handler wreckaged the setup of regular requested
    threaded interrupts (primary handler == NULL).

    The reason is that it does not check whether the primary handler is set to
    the default handler which wakes the handler thread. Instead it replaces the
    thread handler with the primary handler as it would do with force threaded
    interrupts which have been requested via request_irq(). So both the primary
    and the thread handler become the same which then triggers the warnon that
    the thread handler tries to wakeup a not configured secondary thread.

    Fortunately this only happens when the driver omits the IRQF_ONESHOT flag
    when requesting the threaded interrupt, which is normaly caught by the
    sanity checks when force irq threading is disabled.

    Fix it by skipping the force threading setup when a regular threaded
    interrupt is requested. As a consequence the interrupt request which lacks
    the IRQ_ONESHOT flag is rejected correctly instead of silently wreckaging
    it.

    Fixes: 2a1d3ab8986d ("genirq: Handle force threading of irqs with primary and thread handler")
    Reported-by: Kurt Kanzenbach
    Signed-off-by: Thomas Gleixner
    Tested-by: Kurt Kanzenbach
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

17 Jul, 2018

1 commit

  • commit 84676c1f21e8ff54befe985f4f14dc1edc10046b upstream.

    Currently we assign managed interrupt vectors to all present CPUs. This
    works fine for systems were we only online/offline CPUs. But in case of
    systems that support physical CPU hotplug (or the virtualized version of
    it) this means the additional CPUs covered for in the ACPI tables or on
    the command line are not catered for. To fix this we'd either need to
    introduce new hotplug CPU states just for this case, or we can start
    assining vectors to possible but not present CPUs.

    Reported-by: Christian Borntraeger
    Tested-by: Christian Borntraeger
    Tested-by: Stefan Haberland
    Fixes: 4b855ad37194 ("blk-mq: Create hctx for each present CPU")
    Cc: linux-kernel@vger.kernel.org
    Cc: Thomas Gleixner
    Signed-off-by: Christoph Hellwig
    Signed-off-by: Jens Axboe
    Signed-off-by: Greg Kroah-Hartman

    Christoph Hellwig
     

11 Jul, 2018

1 commit

  • …SK_OFFSTACK=y kernels(v1)

    commit 10d94ff4d558b96bfc4f55bb0051ae4d938246fe upstream.

    When the irqaffinity= kernel parameter is passed in a CPUMASK_OFFSTACK=y
    kernel, it fails to boot, because zalloc_cpumask_var() cannot be used before
    initializing the slab allocator to allocate a cpumask.

    So, use alloc_bootmem_cpumask_var() instead.

    Also do some cleanups while at it: in init_irq_default_affinity() remove
    an #ifdef via using cpumask_available().

    Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Link: http://lkml.kernel.org/r/20171026045800.27087-1-rakib.mullick@gmail.com
    Link: http://lkml.kernel.org/r/20171101041451.12581-1-rakib.mullick@gmail.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Cc: Janne Huttunen <janne.huttunen@nokia.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    Rakib Mullick
     

03 Mar, 2018

1 commit

  • [ Upstream commit 11bca0a83f83f6093d816295668e74ef24595944 ]

    An interrupt storm on a bad interrupt will cause the kernel
    log to be clogged.

    [ 60.089234] ->handle_irq(): ffffffffbe2f803f,
    [ 60.090455] 0xffffffffbf2af380
    [ 60.090510] handle_bad_irq+0x0/0x2e5
    [ 60.090522] ->irq_data.chip(): ffffffffbf2af380,
    [ 60.090553] IRQ_NOPROBE set
    [ 60.090584] ->handle_irq(): ffffffffbe2f803f,
    [ 60.090590] handle_bad_irq+0x0/0x2e5
    [ 60.090596] ->irq_data.chip(): ffffffffbf2af380,
    [ 60.090602] 0xffffffffbf2af380
    [ 60.090608] ->action(): (null)
    [ 60.090779] handle_bad_irq+0x0/0x2e5

    This was seen when running an upstream kernel on Acer Chromebook R11. The
    system was unstable as result.

    Guard the log message with __printk_ratelimit to reduce the impact. This
    won't prevent the interrupt storm from happening, but at least the system
    remains stable.

    Signed-off-by: Guenter Roeck
    Signed-off-by: Thomas Gleixner
    Cc: Dmitry Torokhov
    Cc: Joe Perches
    Cc: Andy Shevchenko
    Cc: Mika Westerberg
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=197953
    Link: https://lkml.kernel.org/r/1512234784-21038-1-git-send-email-linux@roeck-us.net
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Guenter Roeck
     

30 Nov, 2017

1 commit

  • commit 4f8413a3a799c958f7a10a6310a451e6b8aef5ad upstream.

    When requesting a shared interrupt, we assume that the firmware
    support code (DT or ACPI) has called irqd_set_trigger_type
    already, so that we can retrieve it and check that the requester
    is being reasonnable.

    Unfortunately, we still have non-DT, non-ACPI systems around,
    and these guys won't call irqd_set_trigger_type before requesting
    the interrupt. The consequence is that we fail the request that
    would have worked before.

    We can either chase all these use cases (boring), or address it
    in core code (easier). Let's have a per-irq_desc flag that
    indicates whether irqd_set_trigger_type has been called, and
    let's just check it when checking for a shared interrupt.
    If it hasn't been set, just take whatever the interrupt
    requester asks.

    Fixes: 382bd4de6182 ("genirq: Use irqd_get_trigger_type to compare the trigger type for shared IRQs")
    Reported-and-tested-by: Petr Cvek
    Signed-off-by: Marc Zyngier
    Signed-off-by: Greg Kroah-Hartman

    Marc Zyngier
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

16 Oct, 2017

1 commit


13 Oct, 2017

2 commits

  • Any usage of the irq_gc_mask_disable_reg_and_ack() function has
    been replaced with the desired functionality.

    The incorrect and ambiguously named function is removed here to
    prevent accidental misuse.

    Signed-off-by: Doug Berger
    Signed-off-by: Marc Zyngier

    Doug Berger
     
  • The irq_gc_mask_disable_reg_and_ack() function name implies that it
    provides the combined functions of irq_gc_mask_disable_reg() and
    irq_gc_ack(). However, the implementation does not actually do
    that since it writes the mask instead of the disable register. It
    also does not maintain the mask cache which makes it inappropriate
    to use with other masking functions.

    In addition, commit 659fb32d1b67 ("genirq: replace irq_gc_ack() with
    {set,clr}_bit variants (fwd)") effectively renamed irq_gc_ack() to
    irq_gc_ack_set_bit() so this function probably should have also been
    renamed at that time.

    The generic chip code currently provides three functions for use
    with the irq_mask member of the irq_chip structure and two functions
    for use with the irq_ack member of the irq_chip structure. These
    functions could be combined into six functions for use with the
    irq_mask_ack member of the irq_chip structure. However, since only
    one of the combinations is currently used, only the function
    irq_gc_mask_disable_and_ack_set() is added by this commit.

    The '_reg' and '_bit' portions of the base function name were left
    out of the new combined function name in an attempt to keep the
    function name length manageable with the 80 character source code
    line length while still allowing the distinct aspects of each
    combination to be captured by the name.

    If other combinations are desired in the future please add them to
    the irq generic chip library at that time.

    Signed-off-by: Doug Berger
    Signed-off-by: Marc Zyngier

    Doug Berger
     

09 Oct, 2017

3 commits

  • Managed interrupts can end up in a stale state on CPU hotplug. If the
    interrupt is not targeting a single CPU, i.e. the affinity mask spawns
    multiple CPUs then the following can happen:

    After boot:

    dstate: 0x01601200
    IRQD_ACTIVATED
    IRQD_IRQ_STARTED
    IRQD_SINGLE_TARGET
    IRQD_AFFINITY_SET
    IRQD_AFFINITY_MANAGED
    node: 0
    affinity: 24-31
    effectiv: 24
    pending: 0

    After offlining CPU 31 - 24

    dstate: 0x01a31000
    IRQD_IRQ_DISABLED
    IRQD_IRQ_MASKED
    IRQD_SINGLE_TARGET
    IRQD_AFFINITY_SET
    IRQD_AFFINITY_MANAGED
    IRQD_MANAGED_SHUTDOWN
    node: 0
    affinity: 24-31
    effectiv: 24
    pending: 0

    Now CPU 25 gets onlined again, so it should get the effective interrupt
    affinity for this interruopt, but due to the x86 interrupt affinity setter
    restrictions this ends up after restarting the interrupt with:

    dstate: 0x01601300
    IRQD_ACTIVATED
    IRQD_IRQ_STARTED
    IRQD_SINGLE_TARGET
    IRQD_AFFINITY_SET
    IRQD_SETAFFINITY_PENDING
    IRQD_AFFINITY_MANAGED
    node: 0
    affinity: 24-31
    effectiv: 24
    pending: 24-31

    So the interrupt is still affine to CPU 24, which was the last CPU to go
    offline of that affinity set and the move to an online CPU within 24-31,
    in this case 25, is pending. This mechanism is x86/ia64 specific as those
    architectures cannot move interrupts from thread context and do this when
    an interrupt is actually handled. So the move is set to pending.

    Whats worse is that offlining CPU 25 again results in:

    dstate: 0x01601300
    IRQD_ACTIVATED
    IRQD_IRQ_STARTED
    IRQD_SINGLE_TARGET
    IRQD_AFFINITY_SET
    IRQD_SETAFFINITY_PENDING
    IRQD_AFFINITY_MANAGED
    node: 0
    affinity: 24-31
    effectiv: 24
    pending: 24-31

    This means the interrupt has not been shut down, because the outgoing CPU
    is not in the effective affinity mask, but of course nothing notices that
    the effective affinity mask is pointing at an offline CPU.

    In the case of restarting a managed interrupt the move restriction does not
    apply, so the affinity setting can be made unconditional. This needs to be
    done _before_ the interrupt is started up as otherwise the condition for
    moving it from thread context would not longer be fulfilled.

    With that change applied onlining CPU 25 after offlining 31-24 results in:

    dstate: 0x01600200
    IRQD_ACTIVATED
    IRQD_IRQ_STARTED
    IRQD_SINGLE_TARGET
    IRQD_AFFINITY_MANAGED
    node: 0
    affinity: 24-31
    effectiv: 25
    pending:

    And after offlining CPU 25:

    dstate: 0x01a30000
    IRQD_IRQ_DISABLED
    IRQD_IRQ_MASKED
    IRQD_SINGLE_TARGET
    IRQD_AFFINITY_MANAGED
    IRQD_MANAGED_SHUTDOWN
    node: 0
    affinity: 24-31
    effectiv: 25
    pending:

    which is the correct and expected result.

    Fixes: 761ea388e8c4 ("genirq: Handle managed irqs gracefully in irq_startup()")
    Reported-by: YASUAKI ISHIMATSU
    Signed-off-by: Thomas Gleixner
    Cc: axboe@kernel.dk
    Cc: linux-scsi@vger.kernel.org
    Cc: Sumit Saxena
    Cc: Marc Zyngier
    Cc: mpe@ellerman.id.au
    Cc: Shivasharan Srikanteshwara
    Cc: Kashyap Desai
    Cc: keith.busch@intel.com
    Cc: peterz@infradead.org
    Cc: Hannes Reinecke
    Cc: Christoph Hellwig
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/alpine.DEB.2.20.1710042208400.2406@nanos

    Thomas Gleixner
     
  • The effective affinity mask handling has no safety net when the mask is not
    updated by the interrupt chip or the mask contains offline CPUs.

    If that happens the CPU unplug code fails to migrate interrupts.

    Add sanity checks and emit a warning when the mask contains only offline
    CPUs.

    Fixes: 415fcf1a2293 ("genirq/cpuhotplug: Use effective affinity mask")
    Signed-off-by: Thomas Gleixner
    Cc: Marc Zyngier
    Cc: Christoph Hellwig
    Cc: stable@vger.kernel.org
    Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1710042208400.2406@nanos

    Thomas Gleixner
     
  • Emit a one time warning when the effective affinity mask is enabled in
    Kconfig, but the interrupt chip does not update the mask in its
    irq_set_affinity() callback,

    Signed-off-by: Thomas Gleixner
    Cc: Marc Zyngier
    Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1710042208400.2406@nanos

    Thomas Gleixner
     

28 Sep, 2017

1 commit

  • When generic irq chips are allocated for an irq domain the domain name is
    set to the irq chip name. That was done to have named domains before the
    recent changes which enforce domain naming were done.

    Since then the overwrite causes a memory leak when the domain name is
    dynamically allocated and even worse it would cause the domain free code to
    free the wrong name pointer, which might point to a constant.

    Remove the name assignment to prevent this.

    Fixes: d59f6617eef0 ("genirq: Allow fwnode to carry name information only")
    Signed-off-by: Jeffy Chen
    Signed-off-by: Thomas Gleixner
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/20170928043731.4764-1-jeffy.chen@rock-chips.com

    Jeffy Chen
     

26 Sep, 2017

1 commit

  • Fix various address spaces warning of sparse.

    kernel/irq/irqdomain.c:1463:14: warning: incorrect type in assignment (different address spaces)
    kernel/irq/irqdomain.c:1463:14: expected void **slot
    kernel/irq/irqdomain.c:1463:14: got void [noderef] **
    kernel/irq/irqdomain.c:1465:66: warning: incorrect type in argument 2 (different address spaces)
    kernel/irq/irqdomain.c:1465:66: expected void [noderef] **slot
    kernel/irq/irqdomain.c:1465:66: got void **slot

    Signed-off-by: Masahiro Yamada
    Signed-off-by: Thomas Gleixner
    Cc: Marc Zyngier
    Cc: Jason Cooper
    Link: https://lkml.kernel.org/r/1506082841-11530-1-git-send-email-yamada.masahiro@socionext.com

    Masahiro Yamada
     

25 Sep, 2017

1 commit

  • __free_irq() can return a NULL irqaction for example when trying to free
    already-free IRQ, but the callsite unconditionally dereferences the
    returned pointer.

    Fix this by adding a check and return NULL.

    Signed-off-by: Alexandru Moise
    Signed-off-by: Thomas Gleixner
    Link: https://lkml.kernel.org/r/20170919200412.GA29985@gmail.com

    Alexandru Moise
     

17 Sep, 2017

1 commit

  • The result of cpumask_any_and() is invalid when result greater or equal
    nr_cpu_ids. The current check is checking for greater only. Fix it.

    Fixes: 761ea388e8c4 ("genirq: Handle managed irqs gracefully in irq_startup()")
    Signed-off-by: Thomas Gleixner
    Cc: Boris Ostrovsky
    Cc: Juergen Gross
    Cc: Tony Luck
    Cc: Chen Yu
    Cc: Marc Zyngier
    Cc: Alok Kataria
    Cc: Joerg Roedel
    Cc: "Rafael J. Wysocki"
    Cc: Steven Rostedt
    Cc: Christoph Hellwig
    Cc: Peter Zijlstra
    Cc: Borislav Petkov
    Cc: stable@vger.kernel.org
    Cc: Paolo Bonzini
    Cc: Rui Zhang
    Cc: "K. Y. Srinivasan"
    Cc: Arjan van de Ven
    Cc: Dan Williams
    Cc: Len Brown
    Link: http://lkml.kernel.org/r/20170913213152.272283444@linutronix.de

    Thomas Gleixner
     

13 Sep, 2017

1 commit


07 Sep, 2017

1 commit

  • for_each_active_irq() iterates the sparse irq allocation bitmap. The caller
    must hold sparse_irq_lock. Several code pathes expect that an active bit in
    the sparse bitmap also has a valid interrupt descriptor.

    Unfortunately that's not true. The (de)allocation is a two step process,
    which holds the sparse_irq_lock only across the queue/remove from the radix
    tree and the set/clear in the allocation bitmap.

    If a iteration locks sparse_irq_lock between the two steps, then it might
    see an active bit but the corresponding irq descriptor is NULL. If that is
    dereferenced unconditionally, then the kernel oopses. Of course, all
    iterator sites could be audited and fixed, but....

    There is no reason why the sparse_irq_lock needs to be dropped between the
    two steps, in fact the code becomes simpler when the mutex is held across
    both and the semantics become more straight forward, so future problems of
    missing NULL pointer checks in the iteration are avoided and all existing
    sites are fixed in one go.

    Expand the lock held sections so both operations are covered and the bitmap
    and the radixtree are in sync.

    Fixes: a05a900a51c7 ("genirq: Make sparse_lock a mutex")
    Reported-and-tested-by: Huang Ying
    Signed-off-by: Thomas Gleixner
    Cc: stable@vger.kernel.org

    Thomas Gleixner
     

06 Sep, 2017

2 commits

  • On allocating the interrupts routed via a wire-to-MSI bridge, the allocator
    iterates over the MSI descriptors to build the hierarchy, but fails to use
    the descriptor interrupt number, and instead uses the base number,
    generating the wrong IRQ domain mappings.

    The fix is to use the MSI descriptor interrupt number when setting up
    the interrupt instead of the base interrupt for the allocation range.

    The only saving grace is that although the MSI descriptors are allocated
    in bulk, the wired interrupts are only allocated one by one (so
    desc->irq == virq) and the bug went unnoticed so far.

    Fixes: 2145ac9310b60 ("genirq/msi: Add msi_domain_populate_irqs")
    Signed-off-by: John Keeping
    Signed-off-by: Thomas Gleixner
    Reviewed-by: Marc Zyngier
    Cc: stable@vger.kernel.org
    Link: http://lkml.kernel.org/r/20170906103540.373864a2.john@metanate.com

    John Keeping
     
  • Pull device properties framework updates from Rafael Wysocki:
    "These introduce fwnode operations for all of the separate types of
    'firmware nodes' that can be handled by the device properties
    framework, make the framework use const fwnode arguments all over, add
    a helper for the consolidated handling of node references and switch
    over the framework to the new UUID API.

    Specifics:

    - Introduce fwnode operations for all of the separate types of
    'firmware nodes' that can be handled by the device properties
    framework and drop the type field from struct fwnode_handle (Sakari
    Ailus, Arnd Bergmann).

    - Make the device properties framework use const fwnode arguments
    where possible (Sakari Ailus).

    - Add a helper for the consolidated handling of node references to
    the device properties framework (Sakari Ailus).

    - Switch over the ACPI part of the device properties framework to the
    new UUID API (Andy Shevchenko)"

    * tag 'devprop-4.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
    ACPI: device property: Switch to use new generic UUID API
    device property: export irqchip_fwnode_ops
    device property: Introduce fwnode_property_get_reference_args
    device property: Constify fwnode property API
    device property: Constify argument to pset fwnode backend
    ACPI: Constify internal fwnode arguments
    ACPI: Constify acpi_bus helper functions, switch to macros
    ACPI: Prepare for constifying acpi_get_next_subnode() fwnode argument
    device property: Get rid of struct fwnode_handle type field
    ACPI: Use IS_ERR_OR_NULL() instead of non-NULL check in is_acpi_data_node()

    Linus Torvalds
     

05 Sep, 2017

1 commit

  • Pull irq updates from Thomas Gleixner:
    "The interrupt subsystem delivers this time:

    - Refactoring of the GIC-V3 driver to prepare for the GIC-V4 support

    - Initial GIC-V4 support

    - Consolidation of the FSL MSI support

    - Utilize the effective affinity interface in various ARM irqchip
    drivers

    - Yet another interrupt chip driver (UniPhier AIDET)

    - Bulk conversion of the irq chip driver to use %pOF

    - The usual small fixes and improvements all over the place"

    * 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (77 commits)
    irqchip/ls-scfg-msi: Add MSI affinity support
    irqchip/ls-scfg-msi: Add LS1043a v1.1 MSI support
    irqchip/ls-scfg-msi: Add LS1046a MSI support
    arm64: dts: ls1046a: Add MSI dts node
    arm64: dts: ls1043a: Share all MSIs
    arm: dts: ls1021a: Share all MSIs
    arm64: dts: ls1043a: Fix typo of MSI compatible string
    arm: dts: ls1021a: Fix typo of MSI compatible string
    irqchip/ls-scfg-msi: Fix typo of MSI compatible strings
    irqchip/irq-bcm7120-l2: Use correct I/O accessors for irq_fwd_mask
    irqchip/mmp: Make mmp_intc_conf const
    irqchip/gic: Make irq_chip const
    irqchip/gic-v3: Advertise GICv4 support to KVM
    irqchip/gic-v4: Enable low-level GICv4 operations
    irqchip/gic-v4: Add some basic documentation
    irqchip/gic-v4: Add VLPI configuration interface
    irqchip/gic-v4: Add VPE command interface
    irqchip/gic-v4: Add per-VM VPE domain creation
    irqchip/gic-v3-its: Set implementation defined bit to enable VLPIs
    irqchip/gic-v3-its: Allow doorbell interrupts to be injected/cleared
    ...

    Linus Torvalds
     

01 Sep, 2017

1 commit


26 Aug, 2017

3 commits

  • kernel/irq/proc.c: In function ‘show_irq_affinity’:
    include/linux/cpumask.h:24:29: warning: ‘mask’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    #define cpumask_bits(maskp) ((maskp)->bits)

    gcc is silly, but admittedly it can't know that this won't be called with
    anything else than the enumerated constants.

    Shut up the warning by creating a default clause.

    Fixes: 6bc6d4abd22e ("genirq/proc: Use the the accessor to report the effective affinity
    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     
  • This code generates a Smatch warning:

    kernel/irq/irqdomain.c:1511 irq_domain_push_irq()
    warn: variable dereferenced before check 'root_irq_data' (see line 1508)

    irq_get_irq_data() can return a NULL pointer, but the code dereferences
    the returned pointer before checking it.

    Move the NULL pointer check before the dereference.

    [ tglx: Rewrote changelog to be precise and conforming to the instructions
    in submitting-patches and added a Fixes tag. Sigh! ]

    Fixes: 495c38d3001f ("irqdomain: Add irq_domain_{push,pop}_irq() functions")
    Signed-off-by: Dan Carpenter
    Signed-off-by: Thomas Gleixner
    Acked-by: David Daney
    Cc: Marc Zyngier
    Cc: kernel-janitors@vger.kernel.org
    Link: http://lkml.kernel.org/r/20170825121409.6rfv4vt6ztz2oqkt@mwanda

    Dan Carpenter
     
  • kernel/irq/proc.c:69:2-3: Unneeded semicolon

    Remove unneeded semicolon.

    Generated by: scripts/coccinelle/misc/semicolon.cocci

    Fixes: 0d3f54257dc3 ("genirq: Introduce effective affinity mask")
    Signed-off-by: Fengguang Wu
    Signed-off-by: Thomas Gleixner
    Cc: kbuild-all@01.org
    Link: http://lkml.kernel.org/r/20170822075053.GA93890@lkp-hsx02

    kbuild test robot
     

23 Aug, 2017

1 commit

  • When assigning an interrupt to a vcpu, it is not unlikely that
    the level of the hierarchy implementing irq_set_vcpu_affinity
    is not the top level (think a generic MSI domain on top of a
    virtualization aware interrupt controller).

    In such a case, let's iterate over the hierarchy until we find
    an irqchip implementing it.

    Reviewed-by: Thomas Gleixner
    Signed-off-by: Marc Zyngier

    Marc Zyngier
     

20 Aug, 2017

1 commit

  • Valid CPU ids are [0, nr_cpu_ids-1] inclusive.

    Fixes: 3b8e29a82dd1 ("genirq: Implement ipi_send_mask/single()")
    Fixes: f9bce791ae2a ("genirq: Add a new function to get IPI reverse mapping")
    Signed-off-by: Alexey Dobriyan
    Signed-off-by: Thomas Gleixner
    Cc: stable@vger.kernel.org
    Link: http://lkml.kernel.org/r/20170819095751.GB27864@avx2

    Alexey Dobriyan
     

18 Aug, 2017

9 commits

  • irq_modify_status starts by clearing the trigger settings from
    irq_data before applying the new settings, but doesn't restore them,
    leaving them to IRQ_TYPE_NONE.

    That's pretty confusing to the potential request_irq() that could
    follow. Instead, snapshot the settings before clearing them, and restore
    them if the irq_modify_status() invocation was not changing the trigger.

    Fixes: 1e2a7d78499e ("irqdomain: Don't set type when mapping an IRQ")
    Reported-and-tested-by: jeffy
    Signed-off-by: Marc Zyngier
    Signed-off-by: Thomas Gleixner
    Cc: Jon Hunter
    Cc: stable@vger.kernel.org
    Link: http://lkml.kernel.org/r/20170818095345.12378-1-marc.zyngier@arm.com

    Marc Zyngier
     
  • Merge the flow handlers and irq domain extensions which are in a separate
    branch so they can be consumed by the gpio folks.

    Thomas Gleixner
     
  • For an already existing irqdomain hierarchy, as might be obtained via
    a call to pci_enable_msix_range(), a PCI driver wishing to add an
    additional irqdomain to the hierarchy needs to be able to insert the
    irqdomain to that already initialized hierarchy. Calling
    irq_domain_create_hierarchy() allows the new irqdomain to be created,
    but no existing code allows for initializing the associated irq_data.

    Add a couple of helper functions (irq_domain_push_irq() and
    irq_domain_pop_irq()) to initialize the irq_data for the new
    irqdomain added to an existing hierarchy.

    Signed-off-by: David Daney
    Signed-off-by: Thomas Gleixner
    Reviewed-by: Marc Zyngier
    Cc: Mark Rutland
    Cc: Alexandre Courbot
    Cc: Linus Walleij
    Cc: linux-gpio@vger.kernel.org
    Link: http://lkml.kernel.org/r/1503017616-3252-6-git-send-email-david.daney@cavium.com

    David Daney
     
  • A follow-on patch will call irq_domain_free_irqs_hierarchy() when the
    free() function pointer may be NULL.

    Add a NULL pointer check to handle this new use case.

    Signed-off-by: David Daney
    Signed-off-by: Thomas Gleixner
    Reviewed-by: Marc Zyngier
    Cc: Mark Rutland
    Cc: Alexandre Courbot
    Cc: Linus Walleij
    Cc: linux-gpio@vger.kernel.org
    Link: http://lkml.kernel.org/r/1503017616-3252-5-git-send-email-david.daney@cavium.com

    David Daney
     
  • The code to add and remove items to and from the revmap occurs several
    times.

    In preparation for the follow on patches that add more uses of this
    code, factor this out in to separate static functions.

    Signed-off-by: David Daney
    Signed-off-by: Thomas Gleixner
    Reviewed-by: Marc Zyngier
    Cc: Mark Rutland
    Cc: Alexandre Courbot
    Cc: Linus Walleij
    Cc: linux-gpio@vger.kernel.org
    Link: http://lkml.kernel.org/r/1503017616-3252-4-git-send-email-david.daney@cavium.com

    David Daney
     
  • Follow-on patch for gpio-thunderx uses a irqdomain hierarchy which
    requires slightly different flow handlers, add them to chip.c which
    contains most of the other flow handlers. Make these conditionally
    compiled based on CONFIG_IRQ_FASTEOI_HIERARCHY_HANDLERS.

    Signed-off-by: David Daney
    Signed-off-by: Thomas Gleixner
    Cc: Mark Rutland
    Cc: Alexandre Courbot
    Cc: Marc Zyngier
    Cc: Linus Walleij
    Cc: linux-gpio@vger.kernel.org
    Link: http://lkml.kernel.org/r/1503017616-3252-3-git-send-email-david.daney@cavium.com

    David Daney
     
  • Many of the family of functions including irq_chip_mask_parent(),
    irq_chip_unmask_parent() are exported, but not all.

    Add EXPORT_SYMBOL_GPL to irq_chip_enable_parent,
    irq_chip_disable_parent and irq_chip_set_affinity_parent, so they
    likewise are usable from modules.

    Signed-off-by: David Daney
    Signed-off-by: Thomas Gleixner
    Cc: Mark Rutland
    Cc: Alexandre Courbot
    Cc: Marc Zyngier
    Cc: Linus Walleij
    Cc: linux-gpio@vger.kernel.org
    Link: http://lkml.kernel.org/r/1503017616-3252-2-git-send-email-david.daney@cavium.com

    David Daney
     
  • If CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK is defined, but that the
    interrupt is not single target, the effective affinity reported in
    /proc/irq/x/effective_affinity will be empty, which is not the truth.

    Instead, use the accessor to report the affinity, which will pick
    the right mask.

    Signed-off-by: Marc Zyngier
    Signed-off-by: Thomas Gleixner
    Cc: Andrew Lunn
    Cc: James Hogan
    Cc: Jason Cooper
    Cc: Paul Burton
    Cc: Chris Zankel
    Cc: Kevin Cernekee
    Cc: Wei Xu
    Cc: Max Filippov
    Cc: Florian Fainelli
    Cc: Gregory Clement
    Cc: Matt Redfearn
    Cc: Sebastian Hesselbarth
    Link: http://lkml.kernel.org/r/20170818083925.10108-3-marc.zyngier@arm.com

    Marc Zyngier
     
  • When developing new (and therefore buggy) interrupt related
    code, it can sometimes be useful to inject interrupts without
    having to rely on a device to actually generate them.

    This functionnality relies either on the irqchip driver to
    expose a irq_set_irqchip_state(IRQCHIP_STATE_PENDING) callback,
    or on the core code to be able to retrigger a (edge-only)
    interrupt.

    To use this feature:

    echo -n trigger > /sys/kernel/debug/irq/irqs/IRQNUM

    WARNING: This is DANGEROUS, and strictly a debug feature.
    Do not use it on a production system. Your HW is likely to
    catch fire, your data to be corrupted, and reporting this will
    make you look an even bigger fool than the idiot who wrote
    this patch.

    Signed-off-by: Marc Zyngier
    Signed-off-by: Thomas Gleixner
    Link: http://lkml.kernel.org/r/20170818081156.9264-1-marc.zyngier@arm.com

    Marc Zyngier
     

16 Aug, 2017

2 commits