All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Pavel Machek <pavel@suse.cz>
Cc: Andi Kleen <ak@suse.de>,
	kernel list <linux-kernel@vger.kernel.org>,
	paul.devriendt@amd.com,
	Nigel Cunningham <ncunningham@cyclades.com>
Subject: Re: BIOS overwritten during resume (was: Re: Asus L5D resume on battery power)
Date: Sun, 6 Mar 2005 18:29:59 +0100	[thread overview]
Message-ID: <200503061830.00574.rjw@sisk.pl> (raw)
In-Reply-To: <20050304234149.GD2647@elf.ucw.cz>

On Saturday, 5 of March 2005 00:41, Pavel Machek wrote:
> Hi!
> 
> > > Actually, take a look at Nigel's patch. He simply uses PageNosave
> > > instead of PageLocked -- that is cleaner.
> > 
> > Yes.  I thought about using PG_nosave in the begining, but there's a
> > 
> > BUG_ON(PageReserved(page) && PageNosave(page));
> > 
> > in swsusp.c:saveable() that I just didn't want to trigger.  It seems to me,
> > though, that we don't need it any more, do we?
> 
> No, we can just kill it. It was "if something unexpected happens, bail
> out soon".

OK

The following is what I'm comfortable with.  I didn't took the Nigel's patch
literally, because we do one thing differently (ie nosave pfns) and it contained
some changes that I thought were unnecessary.  The i386 part is untested.

Greets,
Rafael


Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>

diff -Nrup linux-2.6.11/arch/i386/mm/init.c linux-2.6.11-a/arch/i386/mm/init.c
--- linux-2.6.11/arch/i386/mm/init.c	2005-03-02 08:38:17.000000000 +0100
+++ linux-2.6.11-a/arch/i386/mm/init.c	2005-03-06 18:16:34.000000000 +0100
@@ -272,12 +272,15 @@ void __init one_highpage_init(struct pag
 {
 	if (page_is_ram(pfn) && !(bad_ppro && page_kills_ppro(pfn))) {
 		ClearPageReserved(page);
+		ClearPageNosave(page);
 		set_bit(PG_highmem, &page->flags);
 		set_page_count(page, 1);
 		__free_page(page);
 		totalhigh_pages++;
-	} else
+	} else {
 		SetPageReserved(page);
+		SetPageNosave(page);
+	}
 }
 
 #ifndef CONFIG_DISCONTIGMEM
@@ -602,11 +605,17 @@ void __init mem_init(void)
 
 	reservedpages = 0;
 	for (tmp = 0; tmp < max_low_pfn; tmp++)
-		/*
-		 * Only count reserved RAM pages
-		 */
-		if (page_is_ram(tmp) && PageReserved(pfn_to_page(tmp)))
-			reservedpages++;
+		if (!page_is_ram(tmp))
+			/*
+			 * Non-RAM pages are always nosave
+			 */
+			SetPageNosave(pfn_to_page(tmp));
+		else
+			/*
+			 * Count reserved RAM pages
+			 */
+			if (PageReserved(pfn_to_page(tmp)))
+				reservedpages++;
 
 	set_highmem_pages_init(bad_ppro);
 
@@ -705,6 +714,7 @@ void free_initmem(void)
 	addr = (unsigned long)(&__init_begin);
 	for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) {
 		ClearPageReserved(virt_to_page(addr));
+		ClearPageNosave(virt_to_page(addr));
 		set_page_count(virt_to_page(addr), 1);
 		memset((void *)addr, 0xcc, PAGE_SIZE);
 		free_page(addr);
@@ -720,6 +730,7 @@ void free_initrd_mem(unsigned long start
 		printk (KERN_INFO "Freeing initrd memory: %ldk freed\n", (end - start) >> 10);
 	for (; start < end; start += PAGE_SIZE) {
 		ClearPageReserved(virt_to_page(start));
+		ClearPageNosave(virt_to_page(start));
 		set_page_count(virt_to_page(start), 1);
 		free_page(start);
 		totalram_pages++;
diff -Nrup linux-2.6.11/arch/x86_64/mm/init.c linux-2.6.11-a/arch/x86_64/mm/init.c
--- linux-2.6.11/arch/x86_64/mm/init.c	2005-03-02 08:37:49.000000000 +0100
+++ linux-2.6.11-a/arch/x86_64/mm/init.c	2005-03-06 18:16:34.000000000 +0100
@@ -438,11 +438,17 @@ void __init mem_init(void)
 	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))
+			/*
+			 * Non-RAM pages are always nosave
+			 */
+			SetPageNosave(pfn_to_page(tmp));
+		else
+			/*
+			 * Count reserved RAM pages
+			 */
+			if (PageReserved(pfn_to_page(tmp)))
+				reservedpages++;
 #endif
 
 	after_bootmem = 1;
@@ -488,6 +494,7 @@ void free_initmem(void)
 	addr = (unsigned long)(&__init_begin);
 	for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) {
 		ClearPageReserved(virt_to_page(addr));
+		ClearPageNosave(virt_to_page(addr));
 		set_page_count(virt_to_page(addr), 1);
 		memset((void *)(addr & ~(PAGE_SIZE-1)), 0xcc, PAGE_SIZE); 
 		free_page(addr);
@@ -505,6 +512,7 @@ void free_initrd_mem(unsigned long start
 	printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10);
 	for (; start < end; start += PAGE_SIZE) {
 		ClearPageReserved(virt_to_page(start));
+		ClearPageNosave(virt_to_page(start));
 		set_page_count(virt_to_page(start), 1);
 		free_page(start);
 		totalram_pages++;
diff -Nrup linux-2.6.11/kernel/power/swsusp.c linux-2.6.11-a/kernel/power/swsusp.c
--- linux-2.6.11/kernel/power/swsusp.c	2005-03-02 08:37:50.000000000 +0100
+++ linux-2.6.11-a/kernel/power/swsusp.c	2005-03-06 18:16:34.000000000 +0100
@@ -532,9 +532,9 @@ static int saveable(struct zone * zone, 
 		return 0;
 
 	page = pfn_to_page(pfn);
-	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;

-- 
- 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"

  parent reply	other threads:[~2005-03-06 17:28 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-25 21:37 Asus L5D resume on battery power Rafael J. Wysocki
     [not found] ` <20050227170253.GH1441@elf.ucw.cz>
     [not found]   ` <200502271919.45767.rjw@sisk.pl>
     [not found]     ` <200503022250.12823.rjw@sisk.pl>
2005-03-02 22:05       ` BIOS overwritten during resume (was: Re: Asus L5D resume on battery power) Pavel Machek
2005-03-02 23:47         ` Rafael J. Wysocki
2005-03-02 23:54           ` Pavel Machek
2005-03-03  8:02             ` Rafael J. Wysocki
2005-03-04 11:04               ` Pavel Machek
2005-03-04 13:15                 ` Rafael J. Wysocki
2005-03-04 14:44                   ` Nigel Cunningham
2005-03-04 20:11                   ` Pavel Machek
2005-03-04 23:26                     ` Rafael J. Wysocki
2005-03-04 23:37                       ` Nigel Cunningham
2005-03-05  0:51                         ` Bernard Blackham
2005-03-04 23:41                       ` Pavel Machek
2005-03-05  1:10                         ` Nigel Cunningham
2005-03-05  9:08                           ` Rafael J. Wysocki
2005-03-06 17:29                         ` Rafael J. Wysocki [this message]
2005-03-06 19:41                           ` Pavel Machek
2005-03-06 21:53                             ` Rafael J. Wysocki
2005-03-04 14:21                 ` Nigel Cunningham
2005-03-05 18:43                   ` Rafael J. Wysocki

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=200503061830.00574.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=ak@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ncunningham@cyclades.com \
    --cc=paul.devriendt@amd.com \
    --cc=pavel@suse.cz \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.