Skip to content

Commit c064b7c

Browse files
tmlindgregkh
authored andcommitted
PM / wakeirq: Fix unbalanced IRQ enable for wakeirq
[ Upstream commit 6972805 ] If a device is runtime PM suspended when we enter suspend and has a dedicated wake IRQ, we can get the following warning: WARNING: CPU: 0 PID: 108 at kernel/irq/manage.c:526 enable_irq+0x40/0x94 [ 102.087860] Unbalanced enable for IRQ 147 ... (enable_irq) from [<c06117a8>] (dev_pm_arm_wake_irq+0x4c/0x60) (dev_pm_arm_wake_irq) from [<c0618360>] (device_wakeup_arm_wake_irqs+0x58/0x9c) (device_wakeup_arm_wake_irqs) from [<c0615948>] (dpm_suspend_noirq+0x10/0x48) (dpm_suspend_noirq) from [<c01ac7ac>] (suspend_devices_and_enter+0x30c/0xf14) (suspend_devices_and_enter) from [<c01adf20>] (enter_state+0xad4/0xbd8) (enter_state) from [<c01ad3ec>] (pm_suspend+0x38/0x98) (pm_suspend) from [<c01ab3e8>] (state_store+0x68/0xc8) This is because the dedicated wake IRQ for the device may have been already enabled earlier by dev_pm_enable_wake_irq_check(). Fix the issue by checking for runtime PM suspended status. This issue can be easily reproduced by setting serial console log level to zero, letting the serial console idle, and suspend the system from an ssh terminal. On resume, dmesg will have the warning above. The reason why I have not run into this issue earlier has been that I typically run my PM test cases from on a serial console instead over ssh. Fixes: c843455 (PM / wakeirq: Enable dedicated wakeirq for suspend) Signed-off-by: Tony Lindgren <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent afa0ce0 commit c064b7c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/base/power/wakeirq.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,8 @@ void dev_pm_arm_wake_irq(struct wake_irq *wirq)
323323
return;
324324

325325
if (device_may_wakeup(wirq->dev)) {
326-
if (wirq->status & WAKE_IRQ_DEDICATED_ALLOCATED)
326+
if (wirq->status & WAKE_IRQ_DEDICATED_ALLOCATED &&
327+
!pm_runtime_status_suspended(wirq->dev))
327328
enable_irq(wirq->irq);
328329

329330
enable_irq_wake(wirq->irq);
@@ -345,7 +346,8 @@ void dev_pm_disarm_wake_irq(struct wake_irq *wirq)
345346
if (device_may_wakeup(wirq->dev)) {
346347
disable_irq_wake(wirq->irq);
347348

348-
if (wirq->status & WAKE_IRQ_DEDICATED_ALLOCATED)
349+
if (wirq->status & WAKE_IRQ_DEDICATED_ALLOCATED &&
350+
!pm_runtime_status_suspended(wirq->dev))
349351
disable_irq_nosync(wirq->irq);
350352
}
351353
}

0 commit comments

Comments
 (0)