Skip to contentSkip to conversation

Hibernation: Do not try to mark invalid PFNs as nosave

PATCH In review Rafael J. Wysocki 2 participants 3 messages Aug 2, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Hibernation: Do not try to mark invalid PFNs as nosave

[Please consider as 2.6.23 material.]
---
From: Rafael J. Wysocki <[email protected]>

On some systems some PFNs reported by the early initialization code as 'nosave' may be invalid. If we try to set the corresponding bits in the hibernation bitmap, BUG_ON() in memory_bm_find_bit() will be triggered and the system won't be able to boot (cf. https://bugzilla.novell.com/show_bug.cgi?id=296242).

Prevent this from happening by verifying if the 'nosave' PFNs are valid in mark_nosave_pages().

---
 kernel/power/snapshot.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/power/snapshot.c +2 -1
Index: linux-2.6/kernel/power/snapshot.c
===================================================================
@@ -709,7 +709,8 @@ static void mark_nosave_pages(struct mem
 				region->end_pfn << PAGE_SHIFT);
 
 		for (pfn = region->start_pfn; pfn < region->end_pfn; pfn++)
-			memory_bm_set_bit(bm, pfn);
+			if (pfn_valid(pfn))
+				memory_bm_set_bit(bm, pfn);
 	}
 }
 
#1 lore raw

Hi!

Quoted 9 lines

[Please consider as 2.6.23 material.]
---
From: Rafael J. Wysocki <[email protected]>

On some systems some PFNs reported by the early initialization code as 'nosave' may be invalid. If we try to set the corresponding bits in the hibernation bitmap, BUG_ON() in memory_bm_find_bit() will be triggered and the system won't be able to boot (cf. https://bugzilla.novell.com/show_bug.cgi?id=296242).

Quoted 4 lines

Prevent this from happening by verifying if the 'nosave' PFNs are valid in mark_nosave_pages().

ACK.

Quoted 10 lines
kernel/power/snapshot.c +2 -1
@@ -709,7 +709,8 @@ static void mark_nosave_pages(struct mem
 				region->end_pfn << PAGE_SHIFT);
 
 		for (pfn = region->start_pfn; pfn < region->end_pfn; pfn++)
-			memory_bm_set_bit(bm, pfn);
+			if (pfn_valid(pfn))
+				memory_bm_set_bit(bm, pfn);
 	}
 }
 
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#2 lore raw
In reply to Rafael J. Wysocki

Hi!

Quoted 9 lines

[Please consider as 2.6.23 material.]
---
From: Rafael J. Wysocki <[email protected]>

On some systems some PFNs reported by the early initialization code as 'nosave' may be invalid. If we try to set the corresponding bits in the hibernation bitmap, BUG_ON() in memory_bm_find_bit() will be triggered and the system won't be able to boot (cf. https://bugzilla.novell.com/show_bug.cgi?id=296242).

Quoted 4 lines

Prevent this from happening by verifying if the 'nosave' PFNs are valid in mark_nosave_pages().

ACK.

Quoted 10 lines
kernel/power/snapshot.c +2 -1
@@ -709,7 +709,8 @@ static void mark_nosave_pages(struct mem
 				region->end_pfn << PAGE_SHIFT);
 
 		for (pfn = region->start_pfn; pfn < region->end_pfn; pfn++)
-			memory_bm_set_bit(bm, pfn);
+			if (pfn_valid(pfn))
+				memory_bm_set_bit(bm, pfn);
 	}
 }
 
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html