06 Apr, 2019

1 commit

  • [ Upstream commit 1136b0728969901a091f0471968b2b76ed14d9ad ]

    Waiman reported that on large systems with a large amount of interrupts the
    readout of /proc/stat takes a long time to sum up the interrupt
    statistics. In principle this is not a problem. but for unknown reasons
    some enterprise quality software reads /proc/stat with a high frequency.

    The reason for this is that interrupt statistics are accounted per cpu. So
    the /proc/stat logic has to sum up the interrupt stats for each interrupt.

    This can be largely avoided for interrupts which are not marked as
    'PER_CPU' interrupts by simply adding a per interrupt summation counter
    which is incremented along with the per interrupt per cpu counter.

    The PER_CPU interrupts need to avoid that and use only per cpu accounting
    because they share the interrupt number and the interrupt descriptor and
    concurrent updates would conflict or require unwanted synchronization.

    Reported-by: Waiman Long
    Signed-off-by: Thomas Gleixner
    Reviewed-by: Waiman Long
    Reviewed-by: Marc Zyngier
    Reviewed-by: Davidlohr Bueso
    Cc: Matthew Wilcox
    Cc: Andrew Morton
    Cc: Alexey Dobriyan
    Cc: Kees Cook
    Cc: linux-fsdevel@vger.kernel.org
    Cc: Davidlohr Bueso
    Cc: Miklos Szeredi
    Cc: Daniel Colascione
    Cc: Dave Chinner
    Cc: Randy Dunlap
    Link: https://lkml.kernel.org/r/20190208135020.925487496@linutronix.de

    8

    Thomas Gleixner
     

22 Jun, 2018

1 commit

  • Function irq_desc_get_msi_desc() is not referenced in the kernel (and does
    not seem to have been referenced since e39758e0ea76, 3 years ago), so
    delete it.

    Signed-off-by: John Garry
    Signed-off-by: Thomas Gleixner
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Link: https://lkml.kernel.org/r/1529667333-92959-1-git-send-email-john.garry@huawei.com

    John Garry
     

28 Dec, 2017

1 commit

  • The IRQ code already has support for lockdep class for the lock mutex
    in an interrupt descriptor. Extend this to add a second class for the
    request mutex in the descriptor. Not having a class is resulting in
    false positive splats in some code paths.

    Signed-off-by: Andrew Lunn
    Signed-off-by: Thomas Gleixner
    Acked-by: linus.walleij@linaro.org
    Cc: grygorii.strashko@ti.com
    Cc: f.fainelli@gmail.com
    Link: https://lkml.kernel.org/r/1512234664-21555-1-git-send-email-andrew@lunn.ch

    Andrew Lunn
     

05 Dec, 2017

1 commit

  • The irq_balancing_disabled and irq_is_percpu{,_devid} functions are
    clearly intended to return bool like the functions in
    kernel/irq/settings.h, but actually return an int containing a masked
    value of desc->status_use_accessors. This can lead to subtle breakage
    if, for example, the return value is subsequently truncated when
    assigned to a narrower type.

    As Linus points out:

    | In particular, what can (and _has_ happened) is that people end up
    | using these functions that return true or false, and they assign the
    | result to something like a bitfield (or a char) or whatever.
    |
    | And the code looks *obviously* correct, when you have things like
    |
    | dev->percpu = irq_is_percpu_devid(dev->irq);
    |
    | and that "percpu" thing is just one status bit among many. It may even
    | *work*, because maybe that "percpu" flag ends up not being all that
    | important, or it just happens to never be set on the particular
    | hardware that people end up testing.
    |
    | But while it looks obviously correct, and might even work, it's really
    | fundamentally broken. Because that "true or false" function didn't
    | actually return 0/1, it returned 0 or 0x20000.
    |
    | And 0x20000 may not fit in a bitmask or a "char" or whatever.

    Fix the problem by consistently using bool as the return type for these
    functions.

    Reported-by: Linus Torvalds
    Signed-off-by: Will Deacon
    Signed-off-by: Thomas Gleixner
    Cc: marc.zyngier@arm.com
    Link: https://lkml.kernel.org/r/1512142179-24616-1-git-send-email-will.deacon@arm.com

    Will Deacon
     

16 Nov, 2017

1 commit

  • Pull arm64 updates from Will Deacon:
    "The big highlight is support for the Scalable Vector Extension (SVE)
    which required extensive ABI work to ensure we don't break existing
    applications by blowing away their signal stack with the rather large
    new vector context ( of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: (97 commits)
    arm64: Make ARMV8_DEPRECATED depend on SYSCTL
    arm64: Implement __lshrti3 library function
    arm64: support __int128 on gcc 5+
    arm64/sve: Add documentation
    arm64/sve: Detect SVE and activate runtime support
    arm64/sve: KVM: Hide SVE from CPU features exposed to guests
    arm64/sve: KVM: Treat guest SVE use as undefined instruction execution
    arm64/sve: KVM: Prevent guests from using SVE
    arm64/sve: Add sysctl to set the default vector length for new processes
    arm64/sve: Add prctl controls for userspace vector length management
    arm64/sve: ptrace and ELF coredump support
    arm64/sve: Preserve SVE registers around EFI runtime service calls
    arm64/sve: Preserve SVE registers around kernel-mode NEON use
    arm64/sve: Probe SVE capabilities and usable vector lengths
    arm64: cpufeature: Move sys_caps_initialised declarations
    arm64/sve: Backend logic for setting the vector length
    arm64/sve: Signal handling support
    arm64/sve: Support vector length resetting for new processes
    arm64/sve: Core task context handling
    arm64/sve: Low-level CPU setup
    ...

    Linus Torvalds
     

14 Nov, 2017

1 commit

  • Pull irq core updates from Thomas Gleixner:
    "A rather large update for the interrupt core code and the irq chip drivers:

    - Add a new bitmap matrix allocator and supporting changes, which is
    used to replace the x86 vector allocator which comes with separate
    pull request. This allows to replace the convoluted nested loop
    allocation function in x86 with a facility which supports the
    recently added property of managed interrupts proper and allows to
    switch to a best effort vector reservation scheme, which addresses
    problems with vector exhaustion.

    - A large update to the ARM GIC-V3-ITS driver adding support for
    range selectors.

    - New interrupt controllers:
    - Meson and Meson8 GPIO
    - BCM7271 L2
    - Socionext EXIU

    If you expected that this will stop at some point, I have to
    disappoint you. There are new ones posted already. Sigh!

    - STM32 interrupt controller support for new platforms.

    - A pile of fixes, cleanups and updates to the MIPS GIC driver

    - The usual small fixes, cleanups and updates all over the place.
    Most visible one is to move the irq chip drivers Kconfig switches
    into a separate Kconfig menu"

    * 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (70 commits)
    genirq: Fix type of shifting literal 1 in __setup_irq()
    irqdomain: Drop pointless NULL check in virq_debug_show_one
    genirq/proc: Return proper error code when irq_set_affinity() fails
    irq/work: Use llist_for_each_entry_safe
    irqchip: mips-gic: Print warning if inherited GIC base is used
    irqchip/mips-gic: Add pr_fmt and reword pr_* messages
    irqchip/stm32: Move the wakeup on interrupt mask
    irqchip/stm32: Fix initial values
    irqchip/stm32: Add stm32h7 support
    dt-bindings/interrupt-controllers: Add compatible string for stm32h7
    irqchip/stm32: Add multi-bank management
    irqchip/stm32: Select GENERIC_IRQ_CHIP
    irqchip/exiu: Add support for Socionext Synquacer EXIU controller
    dt-bindings: Add description of Socionext EXIU interrupt controller
    irqchip/gic-v3-its: Fix VPE activate callback return value
    irqchip: mips-gic: Make IPI bitmaps static
    irqchip: mips-gic: Share register writes in gic_set_type()
    irqchip: mips-gic: Remove gic_vpes variable
    irqchip: mips-gic: Use num_possible_cpus() to reserve IPIs
    irqchip: mips-gic: Configure EIC when CPUs come online
    ...

    Linus Torvalds
     

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
     

24 Oct, 2017

1 commit

  • irq_is_percpu indicates whether an irq should only target a single cpu.
    PERCPU_DEVID flag indicates that an irq can be configured differently on
    each cpu it can target.

    Provide a function to check whether an irq is PERCPU_DEVID.

    Reviewed-by: Thomas Gleixner
    Reviewed-by: Marc Zyngier
    Signed-off-by: Will Deacon
    Signed-off-by: Julien Thierry

    Julien Thierry
     

26 Sep, 2017

1 commit

  • For debugging the allocation of unused or potentially leaked interrupt
    descriptor it's helpful to have some information about the site which
    allocated them. In case of MSI this is simple because the caller hands the
    device struct pointer into the domain allocation function.

    Duplicate the device name and show it in the debugfs entry of the interrupt
    descriptor.

    Signed-off-by: Thomas Gleixner
    Tested-by: Juergen Gross
    Tested-by: Yu Chen
    Acked-by: Juergen Gross
    Cc: Boris Ostrovsky
    Cc: Tony Luck
    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: Paolo Bonzini
    Cc: Rui Zhang
    Cc: "K. Y. Srinivasan"
    Cc: Arjan van de Ven
    Cc: Dan Williams
    Cc: Len Brown
    Link: https://lkml.kernel.org/r/20170913213152.433038426@linutronix.de

    Thomas Gleixner
     

04 Jul, 2017

1 commit

  • The irq_request/release_resources() callbacks ar currently invoked under
    desc->lock with interrupts disabled. This is a source of problems on RT and
    conceptually not required.

    Add a seperate mutex to struct irq_desc which allows to serialize
    request/free_irq(), which can be used to move the resource functions out of
    the desc->lock held region.

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Marc Zyngier
    Cc: Heiko Stuebner
    Cc: Julia Cartwright
    Cc: Linus Walleij
    Cc: Brian Norris
    Cc: Doug Anderson
    Cc: linux-rockchip@lists.infradead.org
    Cc: John Keeping
    Cc: linux-gpio@vger.kernel.org
    Link: http://lkml.kernel.org/r/20170629214344.039220922@linutronix.de

    Thomas Gleixner
     

23 Jun, 2017

1 commit

  • Debugging (hierarchical) interupt domains is tedious as there is no
    information about the hierarchy and no information about states of
    interrupts in the various domain levels.

    Add a debugfs directory 'irq' and subdirectories 'domains' and 'irqs'.

    The domains directory contains the domain files. The content is information
    about the domain. If the domain is part of a hierarchy then the parent
    domains are printed as well.

    # ls /sys/kernel/debug/irq/domains/
    default INTEL-IR-2 INTEL-IR-MSI-2 IO-APIC-IR-2 PCI-MSI
    DMAR-MSI INTEL-IR-3 INTEL-IR-MSI-3 IO-APIC-IR-3 unknown-1
    INTEL-IR-0 INTEL-IR-MSI-0 IO-APIC-IR-0 IO-APIC-IR-4 VECTOR
    INTEL-IR-1 INTEL-IR-MSI-1 IO-APIC-IR-1 PCI-HT

    # cat /sys/kernel/debug/irq/domains/VECTOR
    name: VECTOR
    size: 0
    mapped: 216
    flags: 0x00000041

    # cat /sys/kernel/debug/irq/domains/IO-APIC-IR-0
    name: IO-APIC-IR-0
    size: 24
    mapped: 19
    flags: 0x00000041
    parent: INTEL-IR-3
    name: INTEL-IR-3
    size: 65536
    mapped: 167
    flags: 0x00000041
    parent: VECTOR
    name: VECTOR
    size: 0
    mapped: 216
    flags: 0x00000041

    Unfortunately there is no per cpu information about the VECTOR domain (yet).

    The irqs directory contains detailed information about mapped interrupts.

    # cat /sys/kernel/debug/irq/irqs/3
    handler: handle_edge_irq
    status: 0x00004000
    istate: 0x00000000
    ddepth: 1
    wdepth: 0
    dstate: 0x01018000
    IRQD_IRQ_DISABLED
    IRQD_SINGLE_TARGET
    IRQD_MOVE_PCNTXT
    node: 0
    affinity: 0-143
    effectiv: 0
    pending:
    domain: IO-APIC-IR-0
    hwirq: 0x3
    chip: IR-IO-APIC
    flags: 0x10
    IRQCHIP_SKIP_SET_WAKE
    parent:
    domain: INTEL-IR-3
    hwirq: 0x20000
    chip: INTEL-IR
    flags: 0x0
    parent:
    domain: VECTOR
    hwirq: 0x3
    chip: APIC
    flags: 0x0

    This was developed to simplify the debugging of the managed affinity
    changes.

    Signed-off-by: Thomas Gleixner
    Acked-by: Marc Zyngier
    Cc: Jens Axboe
    Cc: Michael Ellerman
    Cc: Keith Busch
    Cc: Peter Zijlstra
    Cc: Christoph Hellwig
    Link: http://lkml.kernel.org/r/20170619235444.537566163@linutronix.de
    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     

14 Sep, 2016

1 commit

  • Information about interrupts is exposed via /proc/interrupts, but the
    format of that file has changed over kernel versions and differs across
    architectures. It also has varying column numbers depending on hardware.

    That all makes it hard for tools to parse.

    To solve this, expose the information through sysfs so each irq attribute
    is in a separate file in a consistent, machine parsable way.

    This feature is only available when both CONFIG_SPARSE_IRQ and
    CONFIG_SYSFS are enabled.

    Examples:
    /sys/kernel/irq/18/actions: i801_smbus,ehci_hcd:usb1,uhci_hcd:usb7
    /sys/kernel/irq/18/chip_name: IR-IO-APIC
    /sys/kernel/irq/18/hwirq: 18
    /sys/kernel/irq/18/name: fasteoi
    /sys/kernel/irq/18/per_cpu_count: 0,0
    /sys/kernel/irq/18/type: level

    /sys/kernel/irq/25/actions: ahci0
    /sys/kernel/irq/25/chip_name: IR-PCI-MSI
    /sys/kernel/irq/25/hwirq: 512000
    /sys/kernel/irq/25/name: edge
    /sys/kernel/irq/25/per_cpu_count: 29036,0
    /sys/kernel/irq/25/type: edge

    [ tglx: Moved kobject_del() under sparse_irq_lock, massaged code comments
    and changelog ]

    Signed-off-by: Craig Gallek
    Cc: David Decotigny
    Link: http://lkml.kernel.org/r/1473783291-122873-1-git-send-email-kraigatgoog@gmail.com
    Signed-off-by: Thomas Gleixner

    Craig Gallek
     

02 May, 2016

1 commit

  • In order to prepare the genirq layer for the concept of partitionned
    percpu interrupts, let's allow an affinity to be associated with
    such an interrupt. We introduce:

    - irq_set_percpu_devid_partition: flag an interrupt as a percpu-devid
    interrupt, and associate it with an affinity
    - irq_get_percpu_devid_partition: allow the affinity of that interrupt
    to be retrieved.

    This will allow a driver to discover which CPUs the per-cpu interrupt
    can actually fire on.

    Signed-off-by: Marc Zyngier
    Cc: Mark Rutland
    Cc: devicetree@vger.kernel.org
    Cc: Jason Cooper
    Cc: Will Deacon
    Cc: Rob Herring
    Link: http://lkml.kernel.org/r/1460365075-7316-3-git-send-email-marc.zyngier@arm.com
    Signed-off-by: Thomas Gleixner

    Marc Zyngier
     

14 Dec, 2015

1 commit

  • The new VMD device driver needs to iterate over a list of
    "demultiplexing" interrupts. Protecting that list with a lock is not
    possible because the list is also required in code pathes which hold
    irq descriptor lock. Therefor the demultiplexing interrupt handler
    would create a lock inversion scenario if it calls a demux handler
    with the list protection lock held.

    A solution for this is to free the irq descriptor via RCU, so the
    list can be walked with rcu read lock held.

    Signed-off-by: Thomas Gleixner
    Cc: Keith Busch

    Thomas Gleixner
     

16 Sep, 2015

6 commits


15 Sep, 2015

1 commit

  • __do_IRQ() was removed by commit 1c77ff2 "genirq: Remove __do_IRQ",
    but the comment referring to __do_IRQ() was left.

    Update the comment for generic_handle_irq_desc().

    Signed-off-by: Huang Shijie
    Cc: jiang.liu@linux.intel.com
    Cc: peterz@infradead.org
    Cc: rafael.j.wysocki@intel.com
    Cc: jason@lakedaemon.net
    Cc: marc.zyngier@arm.com
    Link: http://lkml.kernel.org/r/1441074950-3893-1-git-send-email-shijie.huang@arm.com
    Signed-off-by: Thomas Gleixner

    Huang Shijie
     

06 Aug, 2015

1 commit

  • If we have a reference to irq_desc already, there is no point to do
    another lookup.

    Signed-off-by: Thomas Gleixner
    Cc: Jiang Liu
    Cc: Peter Zijlstra
    Cc: Rusty Russell
    Cc: Bjorn Helgaas
    Link: http://lkml.kernel.org/r/20150802203609.638130301@linutronix.de
    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     

08 Jul, 2015

1 commit

  • When a cpu goes up some architectures (e.g. x86) have to walk the irq
    space to set up the vector space for the cpu. While this needs extra
    protection at the architecture level we can avoid a few race
    conditions by preventing the concurrent allocation/free of irq
    descriptors and the associated data.

    When a cpu goes down it moves the interrupts which are targeted to
    this cpu away by reassigning the affinities. While this happens
    interrupts can be allocated and freed, which opens a can of race
    conditions in the code which reassignes the affinities because
    interrupt descriptors might be freed underneath.

    Example:

    CPU1 CPU2
    cpu_up/down
    irq_desc = irq_to_desc(irq);
    remove_from_radix_tree(desc);
    raw_spin_lock(&desc->lock);
    free(desc);

    We could protect the irq descriptors with RCU, but that would require
    a full tree change of all accesses to interrupt descriptors. But
    fortunately these kind of race conditions are rather limited to a few
    things like cpu hotplug. The normal setup/teardown is very well
    serialized. So the simpler and obvious solution is:

    Prevent allocation and freeing of interrupt descriptors accross cpu
    hotplug.

    Signed-off-by: Thomas Gleixner
    Acked-by: Peter Zijlstra
    Cc: xiao jin
    Cc: Joerg Roedel
    Cc: Borislav Petkov
    Cc: Yanmin Zhang
    Link: http://lkml.kernel.org/r/20150705171102.063519515@linutronix.de

    Thomas Gleixner
     

27 Jun, 2015

2 commits

  • The main use case for the exisiting __irq_set_*_locked() inlines is to
    replace the handler [,chip and name] of an interrupt from a region
    which has the irq descriptor lock held, e.g. from the irq_set_type()
    callback. The first argument is the irq number, so the functions need
    so perform a pointless lookup of the interrupt descriptor for those
    cases which have the irq_data pointer handy.

    Provide new functions which take an irq_data pointer instead of the
    interrupt number, so the lookup of the interrupt descriptor can be
    avoided.

    Signed-off-by: Thomas Gleixner
    Cc: Jiang Liu

    Conflicts:
    include/linux/irqdesc.h

    Thomas Gleixner
     
  • Introduce helper irq_desc_get_irq() to retrieve the irq number from
    the irq descriptor.

    Signed-off-by: Jiang Liu
    Cc: Konrad Rzeszutek Wilk
    Cc: Tony Luck
    Cc: Bjorn Helgaas
    Cc: Benjamin Herrenschmidt
    Cc: Randy Dunlap
    Cc: Yinghai Lu
    Cc: Borislav Petkov
    Cc: Marc Zyngier
    Link: http://lkml.kernel.org/r/1433391238-19471-17-git-send-email-jiang.liu@linux.intel.com
    Signed-off-by: Thomas Gleixner

    Jiang Liu
     

25 Jun, 2015

1 commit

  • Seems we have little chance to move irqdesc.h from include/linux/ into
    kernel/irq/, so remove the outdated comments.

    Signed-off-by: Jiang Liu
    Cc: Konrad Rzeszutek Wilk
    Cc: Tony Luck
    Cc: Bjorn Helgaas
    Cc: Benjamin Herrenschmidt
    Cc: Randy Dunlap
    Cc: Yinghai Lu
    Cc: Borislav Petkov
    Cc: Jason Cooper
    Cc: Kevin Cernekee
    Cc: Arnd Bergmann
    Cc: Marc Zyngier
    Link: http://lkml.kernel.org/r/1433391238-19471-2-git-send-email-jiang.liu@linux.intel.com
    Signed-off-by: Thomas Gleixner

    Jiang Liu
     

12 Jun, 2015

2 commits

  • With the introduction of hierarchy irqdomain, struct irq_data becomes
    per-chip instead of per-irq and there may be multiple irq_datas
    associated with the same irq. Some per-irq data stored in struct
    irq_data now may get duplicated into multiple irq_datas, and causes
    inconsistent view.

    So introduce struct irq_common_data to host per-irq common data and to
    achieve consistent view among irq_chips.

    Signed-off-by: Jiang Liu
    Cc: Konrad Rzeszutek Wilk
    Cc: Tony Luck
    Cc: Bjorn Helgaas
    Cc: Benjamin Herrenschmidt
    Cc: Randy Dunlap
    Cc: Yinghai Lu
    Cc: Borislav Petkov
    Cc: Jason Cooper
    Cc: Kevin Cernekee
    Cc: Arnd Bergmann
    Cc: Marc Zyngier
    Link: http://lkml.kernel.org/r/1433145945-789-4-git-send-email-jiang.liu@linux.intel.com
    Signed-off-by: Thomas Gleixner

    Jiang Liu
     
  • For irq associated with hierarchy irqdomains, there will be multiple
    irq_datas for one irq_desc. So enhance irq_data_to_desc() to support
    hierarchy irqdomain. Also export irq_data_to_desc() as an inline
    function for later reuse.

    Signed-off-by: Jiang Liu
    Cc: Konrad Rzeszutek Wilk
    Cc: Tony Luck
    Cc: Bjorn Helgaas
    Cc: Benjamin Herrenschmidt
    Cc: Randy Dunlap
    Cc: Yinghai Lu
    Cc: Borislav Petkov
    Cc: Marc Zyngier
    Link: http://lkml.kernel.org/r/1433145945-789-2-git-send-email-jiang.liu@linux.intel.com
    Signed-off-by: Thomas Gleixner

    Jiang Liu
     

05 Mar, 2015

1 commit

  • It currently is required that all users of NO_SUSPEND interrupt
    lines pass the IRQF_NO_SUSPEND flag when requesting the IRQ or the
    WARN_ON_ONCE() in irq_pm_install_action() will trigger. That is
    done to warn about situations in which unprepared interrupt handlers
    may be run unnecessarily for suspended devices and may attempt to
    access those devices by mistake. However, it may cause drivers
    that have no technical reasons for using IRQF_NO_SUSPEND to set
    that flag just because they happen to share the interrupt line
    with something like a timer.

    Moreover, the generic handling of wakeup interrupts introduced by
    commit 9ce7a25849e8 (genirq: Simplify wakeup mechanism) only works
    for IRQs without any NO_SUSPEND users, so the drivers of wakeup
    devices needing to use shared NO_SUSPEND interrupt lines for
    signaling system wakeup generally have to detect wakeup in their
    interrupt handlers. Thus if they happen to share an interrupt line
    with a NO_SUSPEND user, they also need to request that their
    interrupt handlers be run after suspend_device_irqs().

    In both cases the reason for using IRQF_NO_SUSPEND is not because
    the driver in question has a genuine need to run its interrupt
    handler after suspend_device_irqs(), but because it happens to
    share the line with some other NO_SUSPEND user. Otherwise, the
    driver would do without IRQF_NO_SUSPEND just fine.

    To make it possible to specify that condition explicitly, introduce
    a new IRQ action handler flag for shared IRQs, IRQF_COND_SUSPEND,
    that, when set, will indicate to the IRQ core that the interrupt
    user is generally fine with suspending the IRQ, but it also can
    tolerate handler invocations after suspend_device_irqs() and, in
    particular, it is capable of detecting system wakeup and triggering
    it as appropriate from its interrupt handler.

    That will allow us to work around a problem with a shared timer
    interrupt line on at91 platforms.

    Link: http://marc.info/?l=linux-kernel&m=142252777602084&w=2
    Link: http://marc.info/?t=142252775300011&r=1&w=2
    Link: https://lkml.org/lkml/2014/12/15/552
    Reported-by: Boris Brezillon
    Signed-off-by: Rafael J. Wysocki
    Acked-by: Peter Zijlstra (Intel)
    Acked-by: Mark Rutland

    Rafael J. Wysocki
     

10 Oct, 2014

1 commit

  • Pull ACPI and power management updates from Rafael Wysocki:
    "Features-wise, to me the most important this time is a rework of
    wakeup interrupts handling in the core that makes them work
    consistently across all of the available sleep states, including
    suspend-to-idle. Many thanks to Thomas Gleixner for his help with
    this work.

    Second is an update of the generic PM domains code that has been in
    need of some care for quite a while. Unused code is being removed, DT
    support is being added and domains are now going to be attached to
    devices in bus type code in analogy with the ACPI PM domain. The
    majority of work here was done by Ulf Hansson who also has been the
    most active developer this time.

    Apart from this we have a traditional ACPICA update, this time to
    upstream version 20140828 and a few ACPI wakeup interrupts handling
    patches on top of the general rework mentioned above. There also are
    several cpufreq commits including renaming the cpufreq-cpu0 driver to
    cpufreq-dt, as this is what implements generic DT-based cpufreq
    support, and a new DT-based idle states infrastructure for cpuidle.

    In addition to that, the ACPI LPSS driver is updated, ACPI support for
    Apple machines is improved, a few bugs are fixed and a few cleanups
    are made all over.

    Finally, the Adaptive Voltage Scaling (AVS) subsystem now has a tree
    maintained by Kevin Hilman that will be merged through the PM tree.

    Numbers-wise, the generic PM domains update takes the lead this time
    with 32 non-merge commits, second is cpufreq (15 commits) and the 3rd
    place goes to the wakeup interrupts handling rework (13 commits).

    Specifics:

    - Rework the handling of wakeup IRQs by the IRQ core such that all of
    them will be switched over to "wakeup" mode in suspend_device_irqs()
    and in that mode the first interrupt will abort system suspend in
    progress or wake up the system if already in suspend-to-idle (or
    equivalent) without executing any interrupt handlers. Among other
    things that eliminates the wakeup-related motivation to use the
    IRQF_NO_SUSPEND interrupt flag with interrupts which don't really
    need it and should not use it (Thomas Gleixner and Rafael Wysocki)

    - Switch over ACPI to handling wakeup interrupts with the help of the
    new mechanism introduced by the above IRQ core rework (Rafael Wysocki)

    - Rework the core generic PM domains code to eliminate code that's
    not used, add DT support and add a generic mechanism by which
    devices can be added to PM domains automatically during enumeration
    (Ulf Hansson, Geert Uytterhoeven and Tomasz Figa).

    - Add debugfs-based mechanics for debugging generic PM domains
    (Maciej Matraszek).

    - ACPICA update to upstream version 20140828. Included are updates
    related to the SRAT and GTDT tables and the _PSx methods are in the
    METHOD_NAME list now (Bob Moore and Hanjun Guo).

    - Add _OSI("Darwin") support to the ACPI core (unfortunately, that
    can't really be done in a straightforward way) to prevent
    Thunderbolt from being turned off on Apple systems after boot (or
    after resume from system suspend) and rework the ACPI Smart Battery
    Subsystem (SBS) driver to work correctly with Apple platforms
    (Matthew Garrett and Andreas Noever).

    - ACPI LPSS (Low-Power Subsystem) driver update cleaning up the code,
    adding support for 133MHz I2C source clock on Intel Baytrail to it
    and making it avoid using UART RTS override with Auto Flow Control
    (Heikki Krogerus).

    - ACPI backlight updates removing the video_set_use_native_backlight
    quirk which is not necessary any more, making the code check the
    list of output devices returned by the _DOD method to avoid
    creating acpi_video interfaces that won't work and adding a quirk
    for Lenovo Ideapad Z570 (Hans de Goede, Aaron Lu and Stepan Bujnak)

    - New Win8 ACPI OSI quirks for some Dell laptops (Edward Lin)

    - Assorted ACPI code cleanups (Fabian Frederick, Rasmus Villemoes,
    Sudip Mukherjee, Yijing Wang, and Zhang Rui)

    - cpufreq core updates and cleanups (Viresh Kumar, Preeti U Murthy,
    Rasmus Villemoes)

    - cpufreq driver updates: cpufreq-cpu0/cpufreq-dt (driver name change
    among other things), ppc-corenet, powernv (Viresh Kumar, Preeti U
    Murthy, Shilpasri G Bhat, Lucas Stach)

    - cpuidle support for DT-based idle states infrastructure, new ARM64
    cpuidle driver, cpuidle core cleanups (Lorenzo Pieralisi, Rasmus
    Villemoes)

    - ARM big.LITTLE cpuidle driver updates: support for DT-based
    initialization and Exynos5800 compatible string (Lorenzo Pieralisi,
    Kevin Hilman)

    - Rework of the test_suspend kernel command line argument and a new
    trace event for console resume (Srinivas Pandruvada, Todd E Brandt)

    - Second attempt to optimize swsusp_free() (hibernation core) to make
    it avoid going through all PFNs which may be way too slow on some
    systems (Joerg Roedel)

    - devfreq updates (Paul Bolle, Punit Agrawal, Ãrjan Eide).

    - rockchip-io Adaptive Voltage Scaling (AVS) driver and AVS entry
    update in MAINTAINERS (Heiko Stübner, Kevin Hilman)

    - PM core fix related to clock management (Geert Uytterhoeven)

    - PM core's sysfs code cleanup (Johannes Berg)"

    * tag 'pm+acpi-3.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (105 commits)
    ACPI / fan: printk replacement
    PM / clk: Fix crash in clocks management code if !CONFIG_PM_RUNTIME
    PM / Domains: Rename cpu_data to cpuidle_data
    cpufreq: cpufreq-dt: fix potential double put of cpu OF node
    cpufreq: cpu0: rename driver and internals to 'cpufreq_dt'
    PM / hibernate: Iterate over set bits instead of PFNs in swsusp_free()
    cpufreq: ppc-corenet: remove duplicate update of cpu_data
    ACPI / sleep: Rework the handling of ACPI GPE wakeup from suspend-to-idle
    PM / sleep: Rename platform suspend/resume functions in suspend.c
    PM / sleep: Export dpm_suspend_late/noirq() and dpm_resume_early/noirq()
    ACPICA: Introduce acpi_enable_all_wakeup_gpes()
    ACPICA: Clear all non-wakeup GPEs in acpi_hw_enable_wakeup_gpe_block()
    ACPI / video: check _DOD list when creating backlight devices
    PM / Domains: Move dev_pm_domain_attach|detach() to pm_domain.h
    cpufreq: Replace strnicmp with strncasecmp
    cpufreq: powernv: Set the cpus to nominal frequency during reboot/kexec
    cpufreq: powernv: Set the pstate of the last hotplugged out cpu in policy->cpus to minimum
    cpufreq: Allow stop CPU callback to be used by all cpufreq drivers
    PM / devfreq: exynos: Enable building exynos PPMU as module
    PM / devfreq: Export helper functions for drivers
    ...

    Linus Torvalds
     

03 Sep, 2014

1 commit

  • Calling irq_find_mapping from outside a irq_{enter,exit} section is
    unsafe and produces ugly messages if CONFIG_PROVE_RCU is enabled:
    If coming from the idle state, the rcu_read_lock call in irq_find_mapping
    will generate an unpleasant warning:

    ===============================
    [ INFO: suspicious RCU usage. ]
    3.16.0-rc1+ #135 Not tainted
    -------------------------------
    include/linux/rcupdate.h:871 rcu_read_lock() used illegally while idle!

    other info that might help us debug this:

    RCU used illegally from idle CPU!
    rcu_scheduler_active = 1, debug_locks = 0
    RCU used illegally from extended quiescent state!
    1 lock held by swapper/0/0:
    #0: (rcu_read_lock){......}, at: []
    irq_find_mapping+0x4c/0x198

    As this issue is fairly widespread and involves at least three
    different architectures, a possible solution is to add a new
    handle_domain_irq entry point into the generic IRQ code that
    the interrupt controller code can call.

    This new function takes an irq_domain, and calls into irq_find_domain
    inside the irq_{enter,exit} block. An additional "lookup" parameter is
    used to allow non-domain architecture code to be replaced by this as well.

    Interrupt controllers can then be updated to use the new mechanism.

    This code is sitting behind a new CONFIG_HANDLE_DOMAIN_IRQ, as not all
    architectures implement set_irq_regs (yes, mn10300, I'm looking at you...).

    Reported-by: Vladimir Murzin
    Signed-off-by: Marc Zyngier
    Link: https://lkml.kernel.org/r/1409047421-27649-2-git-send-email-marc.zyngier@arm.com
    Signed-off-by: Jason Cooper

    Marc Zyngier
     

01 Sep, 2014

1 commit


04 May, 2014

1 commit

  • Till reported that the spurious interrupt detection of threaded
    interrupts is broken in two ways:

    - note_interrupt() is called for each action thread of a shared
    interrupt line. That's wrong as we are only interested whether none
    of the device drivers felt responsible for the interrupt, but by
    calling multiple times for a single interrupt line we account
    IRQ_NONE even if one of the drivers felt responsible.

    - note_interrupt() when called from the thread handler is not
    serialized. That leaves the members of irq_desc which are used for
    the spurious detection unprotected.

    To solve this we need to defer the spurious detection of a threaded
    interrupt to the next hardware interrupt context where we have
    implicit serialization.

    If note_interrupt is called with action_ret == IRQ_WAKE_THREAD, we
    check whether the previous interrupt requested a deferred check. If
    not, we request a deferred check for the next hardware interrupt and
    return.

    If set, we check whether one of the interrupt threads signaled
    success. Depending on this information we feed the result into the
    spurious detector.

    If one primary handler of a shared interrupt returns IRQ_HANDLED we
    disable the deferred check of irq threads on the same line, as we have
    found at least one device driver who cared.

    Reported-by: Till Straumann
    Signed-off-by: Thomas Gleixner
    Tested-by: Austin Schuh
    Cc: Oliver Hartkopp
    Cc: Wolfgang Grandegger
    Cc: Pavel Pisa
    Cc: Marc Kleine-Budde
    Cc: linux-can@vger.kernel.org
    Cc: stable@vger.kernel.org
    Link: http://lkml.kernel.org/r/alpine.LFD.2.02.1303071450130.22263@ionos

    Thomas Gleixner
     

20 Dec, 2013

1 commit

  • This patch adds an accessor function for IRQ_PER_CPU flag.
    The accessor function is useful to determine whether an IRQ is percpu or not.

    This patch is based on an older patch posted by Chris Smith here [1].
    There is a minor change w.r.t. Chris's original patch: The accessor function
    is renamed as 'irq_is_percpu' instead of 'irq_is_per_cpu'.

    [1]: http://lkml.indiana.edu/hypermail/linux/kernel/1207.3/02955.html

    Signed-off-by: Chris Smith
    Signed-off-by: Vinayak Kale
    Acked-by: Will Deacon
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Will Deacon
    Signed-off-by: Catalin Marinas

    Vinayak Kale
     

13 Sep, 2013

1 commit


01 Nov, 2012

1 commit

  • Attempts to retrigger nested threaded IRQs currently fail because they
    have no primary handler. In order to support retrigger of nested
    IRQs, the parent IRQ needs to be retriggered.

    To fix, when an IRQ needs to be resent, if the interrupt has a parent
    IRQ and runs in the context of the parent IRQ, then resend the parent.

    Also, handle_nested_irq() needs to clear the replay flag like the
    other handlers, otherwise check_irq_resend() will set it and it will
    never be cleared. Without clearing, it results in the first resend
    working fine, but check_irq_resend() returning early on subsequent
    resends because the replay flag is still set.

    Problem discovered on ARM/OMAP platforms where a nested IRQ that's
    also a wakeup IRQ happens late in suspend and needed to be retriggered
    during the resume process.

    [khilman@ti.com: changelog edits, clear IRQS_REPLAY in handle_nested_irq()]

    Reported-by: Kevin Hilman
    Tested-by: Kevin Hilman
    Cc: linux-arm-kernel@lists.infradead.org
    Link: http://lkml.kernel.org/r/1350425269-11489-1-git-send-email-khilman@deeprootsystems.com
    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     

02 Oct, 2012

1 commit

  • Pull the trivial tree from Jiri Kosina:
    "Tiny usual fixes all over the place"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (34 commits)
    doc: fix old config name of kprobetrace
    fs/fs-writeback.c: cleanup riteback_sb_inodes kerneldoc
    btrfs: fix the commment for the action flags in delayed-ref.h
    btrfs: fix trivial typo for the comment of BTRFS_FREE_INO_OBJECTID
    vfs: fix kerneldoc for generic_fh_to_parent()
    treewide: fix comment/printk/variable typos
    ipr: fix small coding style issues
    doc: fix broken utf8 encoding
    nfs: comment fix
    platform/x86: fix asus_laptop.wled_type module parameter
    mfd: printk/comment fixes
    doc: getdelays.c: remember to close() socket on error in create_nl_socket()
    doc: aliasing-test: close fd on write error
    mmc: fix comment typos
    dma: fix comments
    spi: fix comment/printk typos in spi
    Coccinelle: fix typo in memdup_user.cocci
    tmiofb: missing NULL pointer checks
    tools: perf: Fix typo in tools/perf
    tools/testing: fix comment / output typos
    ...

    Linus Torvalds
     

15 Aug, 2012

1 commit


19 Jul, 2012

1 commit

  • With the new interrupt sampling system, we are no longer using the
    timer_rand_state structure in the irq descriptor, so we can stop
    initializing it now.

    [ Merged in fixes from Sedat to find some last missing references to
    rand_initialize_irq() ]

    Signed-off-by: "Theodore Ts'o"
    Signed-off-by: Sedat Dilek

    Theodore Ts'o
     

01 Nov, 2011

1 commit

  • Recent commit "irq: Track the owner of irq descriptor" in
    commit ID b6873807a7143b7 placed module.h into linux/irq.h
    but we are trying to limit module.h inclusion to just C files
    that really need it, due to its size and number of children
    includes. This targets just reversing that include.

    Add in the basic "struct module" since that is all we really need
    to ensure things compile. In theory, b687380 should have added the
    module.h include to the irqdesc.h header as well, but the implicit
    module.h everywhere presence masked this from showing up. So give
    it the "struct module" as well.

    As for the C files, irqdesc.c is only using THIS_MODULE, so it
    does not need module.h - give it export.h instead. The C file
    irq/manage.c is now (as of b687380) using try_module_get and
    module_put and so it needs module.h (which it already has).

    Also convert the irq_alloc_descs variants to macros, since all
    they really do is is call the __irq_alloc_descs primitive.
    This avoids including export.h and no debug info is lost.

    Signed-off-by: Paul Gortmaker

    Paul Gortmaker