From cb3e7d624c3ff34a300587929c82af7364cf5c09 Mon Sep 17 00:00:00 2001 From: Mario Limonciello Date: Wed, 24 Aug 2022 20:36:30 -0500 Subject: PM: wakeup: Add extra debugging statement for multiple active IRQs Since commit cb1f65c1e1424 ("PM: s2idle: ACPI: Fix wakeup interrupts handling") was introduced the kernel can now handle multiple simultaneous interrupts during wakeup. Ths uncovered some existing subtle firmware bugs where multiple IRQs are unintentionally active. To help with fixing those bugs add an extra message when PM debugging is enabled that can show the individual IRQs triggered as if a variety are fired they'll potentially be lost as /sys/power/pm_wakeup_irq only contains the first one that triggered the wakeup after resume is complete but all may be needed to demonstrate the whole picture. Link: https://bugzilla.kernel.org/show_bug.cgi?id=215770 Signed-off-by: Mario Limonciello [ rjw: Added empty line after if () ] Signed-off-by: Rafael J. Wysocki --- drivers/base/power/wakeup.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/base/power') diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c index e3befa2c1b66..7cc0c0cf8eaa 100644 --- a/drivers/base/power/wakeup.c +++ b/drivers/base/power/wakeup.c @@ -944,6 +944,8 @@ void pm_system_irq_wakeup(unsigned int irq_number) else irq_number = 0; + pm_pr_dbg("Triggering wakeup from IRQ %d\n", irq_number); + raw_spin_unlock_irqrestore(&wakeup_irq_lock, flags); if (irq_number) -- cgit v1.2.3 From e66332a4bc89e3219baaabc7bb549d17a2c42ce9 Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" Date: Thu, 22 Sep 2022 20:04:40 +0200 Subject: PM: runtime: Return -EINPROGRESS from rpm_resume() in the RPM_NOWAIT case The prospective callers of rpm_resume() passing RPM_NOWAIT to it may be confused when it returns 0 without actually resuming the device which may happen if the device is suspending at the given time and it will only resume when the suspend in progress has completed. To avoid that confusion, return -EINPROGRESS from rpm_resume() in that case. Since none of the current callers passing RPM_NOWAIT to rpm_resume() check its return value, this change has no functional impact. Signed-off-by: Rafael J. Wysocki Acked-by: Alan Stern Reviewed-by: Douglas Anderson Reviewed-by: Ulf Hansson --- drivers/base/power/runtime.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'drivers/base/power') diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index 997be3ac20a7..b52049098d4e 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c @@ -792,10 +792,13 @@ static int rpm_resume(struct device *dev, int rpmflags) DEFINE_WAIT(wait); if (rpmflags & (RPM_ASYNC | RPM_NOWAIT)) { - if (dev->power.runtime_status == RPM_SUSPENDING) + if (dev->power.runtime_status == RPM_SUSPENDING) { dev->power.deferred_resume = true; - else + if (rpmflags & RPM_NOWAIT) + retval = -EINPROGRESS; + } else { retval = -EINPROGRESS; + } goto out; } -- cgit v1.2.3