16 Nov, 2015

1 commit

  • ….kernel.org/pub/scm/linux/kernel/git/tip/tip

    Pull irq and timer fixes from Thomas Gleixner:

    - An irq regression fix to restore the wakeup behaviour of chained
    interrupts.

    - A timer fix for a long standing race versus timers scheduled on a
    target cpu which got exposed by recent changes in the workqueue
    implementation.

    * 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    genirq/PM: Restore system wake up from chained interrupts

    * 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    timers: Use proper base migration in add_timer_on()

    Linus Torvalds
     

10 Nov, 2015

1 commit

  • Commit e509bd7da149 ("genirq: Allow migration of chained interrupts
    by installing default action") breaks PCS wake up IRQ behaviour on
    TI OMAP based platforms (dra7-evm).

    TI OMAP IRQ wake up configuration:
    GIC-irqchip->PCM_IRQ
    |- omap_prcm_register_chain_handler
    |- PRCM-irqchip -> PRCM_IO_IRQ
    |- pcs_irq_chain_handler
    |- pinctrl-irqchip -> PCS_uart1_wakeup_irq

    This happens because IRQ PM code (irq/pm.c) is expected to ignore
    chained interrupts by default:
    static bool suspend_device_irq(struct irq_desc *desc)
    {
    if (!desc->action || desc->no_suspend_depth)
    return false;
    - it's expected !desc->action = true for chained interrupts;

    but, after above change, all chained interrupt descriptors will
    have default action handler installed - chained_action.
    As result, chained interrupts will be silently disabled during system
    suspend.

    Hence, fix it by introducing helper function irq_desc_is_chained() and
    use it in suspend_device_irq() for chained interrupts identification
    and skip them, once detected.

    Fixes: e509bd7da149 ("genirq: Allow migration of chained interrupts..")
    Signed-off-by: Grygorii Strashko
    Reviewed-by: Mika Westerberg
    Cc: Tony Lindgren
    Cc:
    Cc:
    Cc: Tony Lindgren
    Link: http://lkml.kernel.org/r/1447149492-20699-1-git-send-email-grygorii.strashko@ti.com
    Signed-off-by: Thomas Gleixner

    Grygorii Strashko
     

16 Sep, 2015

1 commit

  • Add a sysfs attribute, /sys/power/pm_wakeup_irq, reporting the IRQ
    number of the first wakeup interrupt (that is, the first interrupt
    from an IRQ line armed for system wakeup) seen by the kernel during
    the most recent system suspend/resume cycle.

    This feature will be useful for system wakeup diagnostics of
    spurious wakeup interrupts.

    Signed-off-by: Alexandra Yates
    [ rjw: Fixed up pm_wakeup_irq definition ]
    Signed-off-by: Rafael J. Wysocki

    Alexandra Yates
     

12 Jul, 2015

2 commits


18 May, 2015

1 commit

  • Nested IRQs can only fire when the parent irq fires. So when the
    parent is suspended, there is no need to suspend the child irq.

    Suspending nested irqs can cause a problem is they are suspended or
    resumed in the wrong order. If an interrupt fires while the parent is
    active but the child is suspended, then the interrupt will not be
    acknowledged properly and so an interrupt storm can result. This is
    particularly likely if the parent is resumed before the child, and the
    interrupt was raised during suspend.

    Ensuring correct ordering would be possible, but it is simpler to just
    never suspend nested interrupts.

    Signed-off-by: NeilBrown
    Cc: GTA04 owners
    Cc: Kalle Jokiniemi
    Acked-by: Peter Zijlstra
    Cc: Rafael J. Wysocki
    Link: http://lkml.kernel.org/r/20150517151934.2393e8f8@notabene.brown
    Signed-off-by: Thomas Gleixner

    NeilBrown
     

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
     

01 Sep, 2014

7 commits

  • Currently we suspend wakeup interrupts by lazy disabling them and
    check later whether the interrupt has fired, but that's not sufficient
    for suspend to idle as there is no way to check that once we
    transitioned into the CPU idle state.

    So we change the mechanism in the following way:

    1) Leave the wakeup interrupts enabled across suspend

    2) Add a check to irq_may_run() which is called at the beginning of
    each flow handler whether the interrupt is an armed wakeup source.

    This check is basically free as it just extends the existing check
    for IRQD_IRQ_INPROGRESS. So no new conditional in the hot path.

    If the IRQD_WAKEUP_ARMED flag is set, then the interrupt is
    disabled, marked as pending/suspended and the pm core is notified
    about the wakeup event.

    Signed-off-by: Thomas Gleixner
    [ rjw: syscore.c and put irq_pm_check_wakeup() into pm.c ]
    Signed-off-by: Rafael J. Wysocki

    Thomas Gleixner
     
  • This allows us to utilize this information in the irq_may_run() check
    without adding another conditional to the fast path.

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Rafael J. Wysocki

    Thomas Gleixner
     
  • We can synchronize the suspended interrupts right away. No need for an
    extra loop.

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Rafael J. Wysocki

    Thomas Gleixner
     
  • There is no reason why we should delay the masking of interrupts whose
    interrupt chip requests MASK_ON_SUSPEND to the point where we check
    the wakeup interrupts. We can do it right at the point where we mark
    the interrupt as suspended.

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Rafael J. Wysocki

    Thomas Gleixner
     
  • Use the accounting fields which got introduced for snity checking for
    the various PM options.

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Rafael J. Wysocki

    Thomas Gleixner
     
  • Account the IRQF_NO_SUSPEND and IRQF_RESUME_EARLY actions on shared
    interrupt lines and yell loudly if there is a mismatch.

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Rafael J. Wysocki

    Thomas Gleixner
     
  • No functional change. Preparatory patch for cleaning up the suspend
    abort functionality. Update the comments while at it.

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Rafael J. Wysocki

    Thomas Gleixner
     

26 Nov, 2013

1 commit

  • When the system enters suspend, it disables all interrupts in
    suspend_device_irqs(), including the interrupts marked EARLY_RESUME.

    On the resume side things are different. The EARLY_RESUME interrupts
    are reenabled in sys_core_ops->resume and the non EARLY_RESUME
    interrupts are reenabled in the normal system resume path.

    When suspend_noirq() failed or suspend is aborted for any other
    reason, we might omit the resume side call to sys_core_ops->resume()
    and therefor the interrupts marked EARLY_RESUME are not reenabled and
    stay disabled forever.

    To solve this, enable all irqs unconditionally in irq_resume()
    regardless whether interrupts marked EARLY_RESUMEhave been already
    enabled or not.

    This might try to reenable already enabled interrupts in the non
    failure case, but the only affected platform is XEN and it has been
    confirmed that it does not cause any side effects.

    [ tglx: Massaged changelog. ]

    Signed-off-by: Laxman Dewangan
    Acked-by-and-tested-by: Konrad Rzeszutek Wilk
    Acked-by: Heiko Stuebner
    Reviewed-by: Pavel Machek
    Cc:
    Cc:
    Cc:
    Cc:
    Cc: stable@vger.kernel.org
    Link: http://lkml.kernel.org/r/1385388587-16442-1-git-send-email-ldewangan@nvidia.com
    Signed-off-by: Thomas Gleixner

    Laxman Dewangan
     

05 May, 2012

1 commit

  • If an wakeup interrupt has been disabled before the suspend code
    disables all interrupts then we have to ignore the pending flag.

    Otherwise we would abort suspend over and over as nothing clears the
    pending flag because the interrupt is disabled.

    Signed-off-by: Thomas Gleixner
    Cc: NeilBrown

    Thomas Gleixner
     

17 Oct, 2011

1 commit

  • This adds a mechanism to resume selected IRQs during syscore_resume
    instead of dpm_resume_noirq.

    Under Xen we need to resume IRQs associated with IPIs early enough
    that the resched IPI is unmasked and we can therefore schedule
    ourselves out of the stop_machine where the suspend/resume takes
    place.

    This issue was introduced by 676dc3cf5bc3 "xen: Use IRQF_FORCE_RESUME".

    Signed-off-by: Ian Campbell
    Cc: Rafael J. Wysocki
    Cc: Jeremy Fitzhardinge
    Cc: xen-devel
    Cc: Konrad Rzeszutek Wilk
    Link: http://lkml.kernel.org/r/1318713254.11016.52.camel@dagon.hellion.org.uk
    Cc: stable@kernel.org (at least to 2.6.32.y)
    Signed-off-by: Thomas Gleixner

    Ian Campbell
     

12 Mar, 2011

1 commit

  • On suspend we disable all interrupts in the core code, but this does
    not mask the interrupt line in the default implementation as we use a
    lazy disable approach. That means we mark the interrupt disabled, but
    leave the hardware unmasked. That's an optimization because we avoid
    the hardware access for the common case where no interrupt happens
    after we marked it disabled. If an interrupt happens, then the
    interrupt flow handler masks the line at the hardware level and marks
    it pending.

    Suspend makes use of this delayed disable as it "disables" all
    interrupts when preparing the suspend transition. Right before the
    system goes into hardware suspend state it checks whether one of the
    interrupts which is marked as a wakeup interrupt came in after
    disabling it.

    Most interrupt chips have a separate register which selects the
    interrupts which can wake up the system from suspend, so we don't have
    to mask any on the non wakeup interrupts.

    But now we have to deal with brilliant designed hardware which lacks
    such a wakeup configuration facility. For such hardware it's necessary
    to mask all non wakeup interrupts before going into suspend in order
    to avoid the wakeup from random interrupts.

    Rather than working around this in the affected interrupt chip
    implementations we can solve this elegant in the core code itself.

    Add a flag IRQCHIP_MASK_ON_SUSPEND which can be set by the irq chip
    implementation to indicate, that the interrupts which are not selected
    as wakeup sources must be masked in the suspend path. Mask them in the
    loop which checks the wakeup interrupts pending flag.

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Abhijeet Dharmapurikar
    LKML-Reference:

    Thomas Gleixner
     

19 Feb, 2011

4 commits


08 Feb, 2011

1 commit


15 Dec, 2009

1 commit


05 Jul, 2009

1 commit


31 Mar, 2009

1 commit

  • Introduce helper functions allowing us to prevent device drivers from
    getting any interrupts (without disabling interrupts on the CPU)
    during suspend (or hibernation) and to make them start to receive
    interrupts again during the subsequent resume. These functions make it
    possible to keep timer interrupts enabled while the "late" suspend and
    "early" resume callbacks provided by device drivers are being
    executed. In turn, this allows device drivers' "late" suspend and
    "early" resume callbacks to sleep, execute ACPI callbacks etc.

    The functions introduced here will be used to rework the handling of
    interrupts during suspend (hibernation) and resume. Namely,
    interrupts will only be disabled on the CPU right before suspending
    sysdevs, while device drivers will be prevented from receiving
    interrupts, with the help of the new helper function, before their
    "late" suspend callbacks run (and analogously during resume).

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Ingo Molnar

    Rafael J. Wysocki