On Thursday 24 August 2006 00:08, Jon Escombe wrote:
> Jon Escombe wrote:
> >
> > Have dug a little deeper in to my resume problem, and found out that 
> > it's failing in snapshot.c / copy_data_pages(). BUG_ON(!pbe) is 
> > invoked on the 2nd iteration, when zone_pfn == 1.
> 
> Sorry, may have jumped the gun a little there. After a few more attempts 
> it's not so clear cut...
> 
> printk's scattered through the resume code are always getting to the 
> "for (zone_pfn = 0; zone_pfn < zone->spanned_pages; ++zone_pfn)" loop in 
> copy_data_pages() before the reboot. However, it's not always the same 
> iteration, and I don't think the BUG_ON in this loop can be the cause - 
> as at least once it's rebooted after this line.. Back to the drawing 
> board....

Could you please try the appended patch and see if it changes anything?

Rafael


---
 arch/i386/kernel/setup.c |   34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

Index: linux-2.6.18-rc2/arch/i386/kernel/setup.c
===================================================================
--- linux-2.6.18-rc2.orig/arch/i386/kernel/setup.c      2006-07-28 
10:27:44.000000000 +0200
+++ linux-2.6.18-rc2/arch/i386/kernel/setup.c   2006-07-28 10:51:33.000000000 
+0200
@@ -1301,14 +1301,33 @@ void __init remapped_pgdat_init(void)
        }
 }
 
+/* Mark pages corresponding to given address range as nosave */
+static void __init
+e820_mark_nosave_range(unsigned long start, unsigned long end)
+{
+       unsigned long pfn, max_pfn;
+
+       if (start >= end)
+               return;
+
+       printk("Nosave address range: %016lx - %016lx\n", start, end);
+       max_pfn = end >> PAGE_SHIFT;
+       for (pfn = start >> PAGE_SHIFT; pfn < max_pfn; pfn++)
+               if(pfn_valid(pfn))
+                       SetPageNosave(pfn_to_page(pfn));
+}
+
 /*
  * Request address space for all standard RAM and ROM resources
  * and also for regions reported as reserved by the e820.
+ *
+ * Mark memory gaps and the reserved regions as nosave.
  */
 static void __init
 legacy_init_iomem_resources(struct resource *code_resource, struct resource 
*data_resource)
 {
        int i;
+       unsigned long paddr;
 
        probe_roms();
        for (i = 0; i < e820.nr_map; i++) {
@@ -1344,6 +1363,21 @@ legacy_init_iomem_resources(struct resou
 #endif
                }
        }
+
+       paddr = (e820.map[0].addr + e820.map[0].size) & ~(PAGE_SIZE - 1);
+       for (i = 1; i < e820.nr_map; i++) {
+               struct e820entry *ei = &e820.map[i];
+               unsigned long base;
+
+               /* Check if we have any nosave pages here */
+               base = (ei->addr + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1);
+               if (paddr < ei->addr)
+                       e820_mark_nosave_range(paddr, base);
+
+               paddr = (ei->addr + ei->size) & ~(PAGE_SIZE - 1);
+               if (ei->type != E820_RAM)
+                       e820_mark_nosave_range(base, paddr);
+       }
 }
 
 /*

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Suspend-devel mailing list
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel

Reply via email to