mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: ACPI Devel Maling List <linux-acpi@vger.kernel.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux PM list <linux-pm@vger.kernel.org>,
	Lv Zheng <lv.zheng@intel.com>,
	Robert Moore <robert.moore@intel.com>
Subject: Re: [PATCH] ACPI / sleep: Drain outstanding events after disabling multiple GPEs
Date: Sat, 15 Nov 2014 02:37:49 +0100	[thread overview]
Message-ID: <1704297.D90U7pFiof@vostro.rjw.lan> (raw)
In-Reply-To: <2087711.53EgqR6vL6@vostro.rjw.lan>

On Saturday, November 15, 2014 02:30:51 AM Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> After multiple GPEs have been disabled at the low level in one go,
> like when acpi_disable_all_gpes() is called, we should always drain
> all of the outstanding events from them, or the ACPICA's GPE handling
> code may re-enable one of them as a result of a race condition.

Scratch the last part.

We simply need to drain them to prevent the GPE handling code from
being executed in parallel with whatever happens after the GPEs have
been disabled.

> For this reason, call acpi_os_wait_events_complete() after
> acpi_enable_all_wakeup_gpes() and acpi_disable_all_gpes() in
> acpi_freeze_prepare() and acpi_power_off_prepare(), respectively.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>  drivers/acpi/sleep.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> Index: linux-pm/drivers/acpi/sleep.c
> ===================================================================
> --- linux-pm.orig/drivers/acpi/sleep.c
> +++ linux-pm/drivers/acpi/sleep.c
> @@ -630,6 +630,7 @@ static int acpi_freeze_begin(void)
>  static int acpi_freeze_prepare(void)
>  {
>  	acpi_enable_all_wakeup_gpes();
> +	acpi_os_wait_events_complete();
>  	enable_irq_wake(acpi_gbl_FADT.sci_interrupt);
>  	return 0;
>  }
> @@ -825,6 +826,7 @@ static void acpi_power_off_prepare(void)
>  	/* Prepare to power off the system */
>  	acpi_sleep_prepare(ACPI_STATE_S5);
>  	acpi_disable_all_gpes();
> +	acpi_os_wait_events_complete();
>  }
>  
>  static void acpi_power_off(void)
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

      reply	other threads:[~2014-11-15  1:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-15  1:30 Rafael J. Wysocki
2014-11-15  1:37 ` Rafael J. Wysocki [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1704297.D90U7pFiof@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lv.zheng@intel.com \
    --cc=robert.moore@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®