LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Andrey Borzenkov <arvidjaar@mail.ru>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: "Lebedev, Vladimir P" <vladimir.p.lebedev@intel.com>,
"Karasyov, Konstantin A" <konstantin.a.karasyov@intel.com>,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-pm@lists.osdl.org
Subject: Re: 2.6.19: ACPI reports AC not present after resume from STD
Date: Sun, 25 Feb 2007 02:26:31 +0300 [thread overview]
Message-ID: <200702250226.34877.arvidjaar@mail.ru> (raw)
In-Reply-To: <200702242046.20216.rjw@sisk.pl>
[-- Attachment #1.1: Type: text/plain, Size: 1642 bytes --]
On Суббота 24 февраля 2007, Rafael J. Wysocki wrote:
> Hi,
>
> On Saturday, 24 February 2007 10:55, Andrey Borzenkov wrote:
> > On Вторник 13 февраля 2007, Andrey Borzenkov wrote:
> > > On Четверг 07 декабря 2006, Lebedev, Vladimir P wrote:
> > > > Please register new bug, attach acpidump and dmesg.
> > >
> > > http://bugzilla.kernel.org/show_bug.cgi?id=7995
> > >
> > > regards
> >
> > Well, this starts looking like ACPI is not at fault.
> >
> > When reporting AC state ACPI just reads contents of system memory (I
> > presume it gets updated by BIOS/ACPI when AC state changes). It looks
> > like this memory area is restored during resume from STD. I updated
> > mentioned bug report with more detailed description. Now if someone could
> > suggest a way to catch if specific physical address gets saved/restored
> > this would finally explain it.
>
> First, if you want the reserved memory areas to be left alone by swsusp,
> you need to mark them as 'nosave'. On x86_64 this is done by the function
> e820_mark_nosave_range() in arch/x86_64/kernel/e820.c that can be ported to
> i386 with no problems. However, we haven't found that very useful, so far,
> since no one has ever reported any problems with the current approach,
> which is to save and restore them.
>
Well, the following proof of concept patch fixes this issue for me. Please
notice that original version of e820_mark_nosave_range() could fail to
exclude some areas due to alignment issues (exactly what happened to me on
first try) so it still can explain your problem too.
-andrey
[-- Attachment #1.2: nosave_reserved_memory --]
[-- Type: text/x-diff, Size: 4428 bytes --]
Mark e820 reserved memory areas as nosave for suspend/resume
From: Andrey Borzenkov <<arvidjaar@mail.ru>>
This fixes bug http://bugzilla.kernel.org/show_bug.cgi?id=7995. From
lkml:
=============
> When reporting AC state ACPI just reads contents of system memory (I
> presume
> it gets updated by BIOS/ACPI when AC state changes). It looks like this
> memory area is restored during resume from STD. I updated mentioned bug
> report with more detailed description. Now if someone could suggest a way
> to
> catch if specific physical address gets saved/restored this would finally
> explain it.
First, if you want the reserved memory areas to be left alone by swsusp,
you need to mark them as 'nosave'. On x86_64 this is done by the function
e820_mark_nosave_range() in arch/x86_64/kernel/e820.c that can be ported to
i386 with no problems. However, we haven't found that very useful, so far,
since no one has ever reported any problems with the current approach,
which is to save and restore them.
=============
The patch adapts x84_64 version to mark as nosave all consequitive
areas. Otherwise in my case the region in question covered only partial
page and was excluded from nosave:
BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
BIOS-e820: 00000000000e0000 - 00000000000eee00 (reserved)
BIOS-e820: 00000000000eee00 - 00000000000ef000 (ACPI NVS)
BIOS-e820: 00000000000ef000 - 0000000000100000 (reserved)
BIOS-e820: 0000000000100000 - 000000001ef60000 (usable)
BIOS-e820: 000000001ef60000 - 000000001ef70000 (ACPI data)
BIOS-e820: 000000001ef70000 - 0000000020000000 (reserved)
BIOS-e820: 00000000fff80000 - 0000000100000000 (reserved)
The region in question starts at ee800.
---
arch/i386/kernel/e820.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
arch/i386/kernel/setup.c | 1 +
include/asm-i386/e820.h | 1 +
3 files changed, 47 insertions(+), 0 deletions(-)
diff --git a/arch/i386/kernel/e820.c b/arch/i386/kernel/e820.c
index f391abc..7c00ec7 100644
--- a/arch/i386/kernel/e820.c
+++ b/arch/i386/kernel/e820.c
@@ -311,6 +311,51 @@ static int __init request_standard_resources(void)
subsys_initcall(request_standard_resources);
+/* Mark pages corresponding to given pfn range as nosave */
+static void __init
+e820_mark_nosave_range(unsigned long start, unsigned long end)
+{
+ unsigned long pfn, max_pfn = PFN_DOWN(end);
+
+ if (start >= end)
+ return;
+
+ printk("Nosave address range: %016lx - %016lx\n", start, end);
+ for (pfn = PFN_UP(start); pfn < max_pfn; pfn++)
+ if (pfn_valid(pfn))
+ SetPageNosave(pfn_to_page(pfn));
+}
+
+/*
+ * Find the ranges of physical addresses that do not correspond to
+ * e820 RAM areas and mark the corresponding pages as nosave for software
+ * suspend and suspend to RAM.
+ *
+ * This assumes entries are sorted and all consequitive entries are
+ * excluded together with gaps.
+ */
+void __init e820_mark_nosave_regions(void)
+{
+ int i;
+ unsigned long pstart = 0L;
+ unsigned long pend = 0L;
+
+ for (i = 0; i < e820.nr_map; i++) {
+ struct e820entry *ei = &e820.map[i];
+
+ if (ei->type != E820_RAM) {
+ if (!pstart)
+ pstart = ei->addr;
+ if (pend < ei->addr + ei->size)
+ pend = ei->addr + ei->size;
+ } else {
+ e820_mark_nosave_range(pstart, pend);
+ pstart = pend = 0L;
+ }
+ }
+ e820_mark_nosave_range(pstart, pend);
+}
+
void __init add_memory_region(unsigned long long start,
unsigned long long size, int type)
{
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
index 4b31ad7..4f43e46 100644
--- a/arch/i386/kernel/setup.c
+++ b/arch/i386/kernel/setup.c
@@ -640,6 +640,7 @@ void __init setup_arch(char **cmdline_p)
#endif
e820_register_memory();
+ e820_mark_nosave_regions();
#ifdef CONFIG_VT
#if defined(CONFIG_VGA_CONSOLE)
diff --git a/include/asm-i386/e820.h b/include/asm-i386/e820.h
index c5b8fc6..80e49bc 100644
--- a/include/asm-i386/e820.h
+++ b/include/asm-i386/e820.h
@@ -43,6 +43,7 @@ extern void register_bootmem_low_pages(unsigned long max_low_pfn);
extern void e820_register_memory(void);
extern void limit_regions(unsigned long long size);
extern void print_memory_map(char *who);
+extern void e820_mark_nosave_regions(void);
#endif/*!__ASSEMBLY__*/
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2007-02-24 23:26 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <8E389A5F2FEABA4CB1DEC35A25CB39CE82FE9F@mssmsx411>
[not found] ` <200702132116.05404.arvidjaar@mail.ru>
[not found] ` <200702241255.02073.arvidjaar@mail.ru>
2007-02-24 19:46 ` Rafael J. Wysocki
2007-02-24 23:26 ` Andrey Borzenkov [this message]
2007-02-25 10:17 ` Rafael J. Wysocki
[not found] ` <200702251337.08914.arvidjaar@mail.ru>
2007-02-25 10:51 ` Rafael J. Wysocki
2007-02-25 17:14 ` Andrey Borzenkov
2007-02-25 18:58 ` Rafael J. Wysocki
[not found] ` <200702262335.47874.arvidjaar@mail.ru>
2007-02-26 21:23 ` Rafael J. Wysocki
2007-03-05 22:07 ` Rafael J. Wysocki
2007-03-08 7:51 ` Andrey Borzenkov
2007-05-19 18:03 ` Andrey Borzenkov
2006-12-03 12:25 Andrey Borzenkov
2006-12-03 13:11 ` Pavel Machek
2006-12-03 13:52 ` Andrey Borzenkov
2006-12-03 14:35 ` Alexey Starikovskiy
2006-12-03 16:00 ` Andrey Borzenkov
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=200702250226.34877.arvidjaar@mail.ru \
--to=arvidjaar@mail.ru \
--cc=konstantin.a.karasyov@intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.osdl.org \
--cc=rjw@sisk.pl \
--cc=vladimir.p.lebedev@intel.com \
--subject='Re: 2.6.19: ACPI reports AC not present after resume from STD' \
/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
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).