lkml.org 
[lkml]   [2005]   [Mar]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: BIOS overwritten during resume (was: Re: Asus L5D resume on battery power)
Date
Hi,

On Friday, 4 of March 2005 12:04, Pavel Machek wrote:
> Hi!
>
> > > IIRC kernel code/data is marked as PageReserved(), that's why we need
> > > to save that :(. Not sure what to do with data e820 marked as
> > > reserved...
> >
> > Perhaps we need another page flag, like PG_readonly, and mark the pages
> > reserved by the e820 as PG_reserved | PG_readonly (the same for the areas
> > that are not returned by e820 at all). Would that be acceptable?
>
> This flags are little in the short supply, but being able to tell
> kernel code from memory hole seems like "must have", so yes, that
> looks ok.
>
> You could get subtle and reuse some other pageflag. I do not think
> PG_reserved can have PG_locked... So using for example PG_locked for
> this purpose should be okay.

The following patch does this. It is only for x86-64 without
CONFIG_DISCONTIGMEM, but it has no effect in other cases.


--- linux-2.6.11-rc5-mm1/arch/x86_64/mm/init.c 2005-03-04 12:19:29.000000000 +0100
+++ new/arch/x86_64/mm/init.c 2005-03-04 13:53:08.000000000 +0100
@@ -438,11 +438,14 @@
totalram_pages += free_all_bootmem();

for (tmp = 0; tmp < end_pfn; tmp++)
- /*
- * Only count reserved RAM pages
- */
- if (page_is_ram(tmp) && PageReserved(pfn_to_page(tmp)))
- reservedpages++;
+ if (!page_is_ram(tmp))
+ SetPageLocked(pfn_to_page(tmp));
+ else
+ /*
+ * Count reserved RAM pages
+ */
+ if (PageReserved(pfn_to_page(tmp)))
+ reservedpages++;
#endif

after_bootmem = 1;
--- linux-2.6.11-rc5-mm1/kernel/power/swsusp.c 2005-03-04 13:54:50.000000000 +0100
+++ new/kernel/power/swsusp.c 2005-03-04 13:57:37.000000000 +0100
@@ -531,9 +531,15 @@
BUG_ON(PageReserved(page) && PageNosave(page));
if (PageNosave(page))
return 0;
- if (PageReserved(page) && pfn_is_nosave(pfn)) {
- pr_debug("[nosave pfn 0x%lx]", pfn);
- return 0;
+ if (PageReserved(page)) {
+ if (pfn_is_nosave(pfn)) {
+ pr_debug("[nosave pfn 0x%lx]\n", pfn);
+ return 0;
+ }
+ if (PageLocked(page)) {
+ pr_debug("[locked pfn 0x%lx]\n", pfn);
+ return 0;
+ }
}
if (PageNosaveFree(page))
return 0;

I thought it would be more complicated. :-)

Greets,
Rafael


--
- Would you tell me, please, which way I ought to go from here?
- That depends a good deal on where you want to get to.
-- Lewis Carroll "Alice's Adventures in Wonderland"
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:10    [W:0.075 / U:0.896 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site