From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Len Brown <lenb@kernel.org>
Cc: linux-pm@lists.linux-foundation.org,
ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
Matthew Garrett <mjg59@srcf.ucam.org>
Subject: Re: [linux-pm] [PATCH 1/5] ACPI / Sleep: Do not allocate memory for saving NVS in advance
Date: Tue, 6 Jul 2010 20:12:34 +0200 [thread overview]
Message-ID: <201007062012.34965.rjw@sisk.pl> (raw)
In-Reply-To: <201007020011.22118.rjw@sisk.pl>
On Friday, July 02, 2010, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw@sisk.pl>
>
> We only can try to allocate memory for saving the NVS region if it
> is known that the target system sleep state is valid. Otherwise
> we will leak memory if suspend_nvs_alloc() is successful and the
> target state is invalid, because suspend_nvs_free() will not be
> called in that case.
>
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Well, the $subject patch doesn't cover a real problem where the suspending
of devices fails (or suspend is tested in the "devices" mode) and
acpi_pm_finish() is not called at all. So, the appended patch should be used
instead.
Rafael
---
From: Rafael J. Wysocki <rjw@sisk.pl>
Subject: ACPI / Sleep: Free NVS copy if suspending of devices fails
If suspending of devices fails or system suspend is tested in the
"devices" mode, the memory allocated for storing a copy of the ACPI
NVS area will not be freed, because acpi_pm_finish() is not called
in that case. Fix this by moving the suspend_nvs_free() call to
acpi_pm_end().
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
drivers/acpi/sleep.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
Index: linux-2.6/drivers/acpi/sleep.c
===================================================================
--- linux-2.6.orig/drivers/acpi/sleep.c
+++ linux-2.6/drivers/acpi/sleep.c
@@ -145,7 +145,6 @@ static void acpi_pm_finish(void)
{
u32 acpi_state = acpi_target_sleep_state;
- suspend_nvs_free();
acpi_ec_unblock_transactions();
if (acpi_state == ACPI_STATE_S0)
@@ -167,6 +166,7 @@ static void acpi_pm_finish(void)
*/
static void acpi_pm_end(void)
{
+ suspend_nvs_free();
/*
* This is necessary in case acpi_pm_finish() is not called during a
* failing transition to a sleep state.
next prev parent reply other threads:[~2010-07-06 18:13 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-01 22:10 [PATCH 0/5] ACPI / PM: Fixes and simplifications Rafael J. Wysocki
2010-07-01 22:11 ` [PATCH 1/5] ACPI / Sleep: Do not allocate memory for saving NVS in advance Rafael J. Wysocki
2010-07-06 18:12 ` Rafael J. Wysocki [this message]
2010-07-07 2:16 ` Len Brown
2010-07-01 22:12 ` [PATCH 2/5] ACPI / Sleep: Rework enabling wakeup devices Rafael J. Wysocki
2010-07-07 2:16 ` Len Brown
2010-07-01 22:13 ` [PATCH 3/5] ACPI / Wakeup: Simplify enabling of " Rafael J. Wysocki
2010-07-06 23:17 ` [linux-pm] " Rafael J. Wysocki
2010-07-07 2:13 ` Len Brown
2010-07-01 22:14 ` [PATCH 4/5] ACPI / Sleep: Consolidate suspend and hibernation routines Rafael J. Wysocki
2010-07-07 2:14 ` Len Brown
2010-07-01 22:14 ` [PATCH 5/5] ACPI / Sleep: Drop acpi_suspend_finish() Rafael J. Wysocki
2010-07-07 2:14 ` Len Brown
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=201007062012.34965.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=mjg59@srcf.ucam.org \
/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;
as well as URLs for NNTP newsgroup(s).