linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] ACPI: s2idle: Log when enabling wakeup IRQ fails
@ 2023-03-13 14:47 Simon Gaiser
  2023-03-20 17:32 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Gaiser @ 2023-03-13 14:47 UTC (permalink / raw)
  To: Rafael J . Wysocki, Len Brown; +Cc: linux-acpi, linux-kernel, Simon Gaiser

enable_irq_wake() can fail. Previously acpi_s2idle_prepare() silently
ignored it's return code. Based on [1] we should try to continue even in
case of an error, so just log a warning for now.

Discovered when trying to go into s2idle under Xen. This leads to a
system that can't be woken, since xen-pirq currently doesn't support
setting wakeup IRQs [2]. With this you get at least some helpful log
message if you have access to console messages.

Link: https://lore.kernel.org/linux-acpi/20230313125344.2893-1-simon@invisiblethingslab.com/ # v1
Link: https://lore.kernel.org/linux-acpi/CAJZ5v0jahjt58nP6P5+xRdtD_ndYPvq4ecMVz6nfGu9tf5iaUw@mail.gmail.com/ # [1]
Link: https://lore.kernel.org/xen-devel/20230313134102.3157-1-simon@invisiblethingslab.com/ # [2]
Signed-off-by: Simon Gaiser <simon@invisiblethingslab.com>
---
v2:
 - Based on feedback switched to only logging a warning instead of
   returning an error.
---
 drivers/acpi/sleep.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index 4ca667251272..6b30dea94fae 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -714,7 +714,13 @@ int acpi_s2idle_begin(void)
 int acpi_s2idle_prepare(void)
 {
 	if (acpi_sci_irq_valid()) {
-		enable_irq_wake(acpi_sci_irq);
+		int error;
+
+		error = enable_irq_wake(acpi_sci_irq);
+		if (error)
+			pr_warn("Warning: Failed to enable wakeup from IRQ %d: %d\n",
+				acpi_sci_irq,
+				error);
 		acpi_ec_set_gpe_wake_mask(ACPI_GPE_ENABLE);
 	}
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] ACPI: s2idle: Log when enabling wakeup IRQ fails
  2023-03-13 14:47 [PATCH v2] ACPI: s2idle: Log when enabling wakeup IRQ fails Simon Gaiser
@ 2023-03-20 17:32 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2023-03-20 17:32 UTC (permalink / raw)
  To: Simon Gaiser; +Cc: Rafael J . Wysocki, Len Brown, linux-acpi, linux-kernel

On Mon, Mar 13, 2023 at 3:47 PM Simon Gaiser
<simon@invisiblethingslab.com> wrote:
>
> enable_irq_wake() can fail. Previously acpi_s2idle_prepare() silently
> ignored it's return code. Based on [1] we should try to continue even in
> case of an error, so just log a warning for now.
>
> Discovered when trying to go into s2idle under Xen. This leads to a
> system that can't be woken, since xen-pirq currently doesn't support
> setting wakeup IRQs [2]. With this you get at least some helpful log
> message if you have access to console messages.
>
> Link: https://lore.kernel.org/linux-acpi/20230313125344.2893-1-simon@invisiblethingslab.com/ # v1
> Link: https://lore.kernel.org/linux-acpi/CAJZ5v0jahjt58nP6P5+xRdtD_ndYPvq4ecMVz6nfGu9tf5iaUw@mail.gmail.com/ # [1]
> Link: https://lore.kernel.org/xen-devel/20230313134102.3157-1-simon@invisiblethingslab.com/ # [2]
> Signed-off-by: Simon Gaiser <simon@invisiblethingslab.com>
> ---
> v2:
>  - Based on feedback switched to only logging a warning instead of
>    returning an error.
> ---
>  drivers/acpi/sleep.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
> index 4ca667251272..6b30dea94fae 100644
> --- a/drivers/acpi/sleep.c
> +++ b/drivers/acpi/sleep.c
> @@ -714,7 +714,13 @@ int acpi_s2idle_begin(void)
>  int acpi_s2idle_prepare(void)
>  {
>         if (acpi_sci_irq_valid()) {
> -               enable_irq_wake(acpi_sci_irq);
> +               int error;
> +
> +               error = enable_irq_wake(acpi_sci_irq);
> +               if (error)
> +                       pr_warn("Warning: Failed to enable wakeup from IRQ %d: %d\n",
> +                               acpi_sci_irq,
> +                               error);
>                 acpi_ec_set_gpe_wake_mask(ACPI_GPE_ENABLE);
>         }
>
> --

Applied (with a minor white space adjustment) as 6.4 material, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-20 17:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-13 14:47 [PATCH v2] ACPI: s2idle: Log when enabling wakeup IRQ fails Simon Gaiser
2023-03-20 17:32 ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).