WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] reboot after "scrubbing free ram"

Thanks the useful info.
Could you please try the appended patch (just to rule out a similar
issue we found recently)?


diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index 947f42a..66637bd 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -283,6 +283,8 @@ unsigned long __init_refok init_memory_mapping(unsigned 
long start,
        if (!after_bootmem && !start) {
                pud_t *pud;
                pmd_t *pmd;
+               unsigned long addr;
+               u64 size, memblock_addr;
 
                mmu_cr4_features = read_cr4();
 
@@ -291,11 +293,18 @@ unsigned long __init_refok init_memory_mapping(unsigned 
long start,
                 * located on different 2M pages. cleanup_highmap(), however,
                 * can only consider _end when it runs, so destroy any
                 * mappings beyond _brk_end here.
+                * Respect memblock reserved regions.
                 */
                pud = pud_offset(pgd_offset_k(_brk_end), _brk_end);
                pmd = pmd_offset(pud, _brk_end - 1);
-               while (++pmd <= pmd_offset(pud, (unsigned long)_end - 1))
-                       pmd_clear(pmd);
+               addr = (_brk_end + PMD_SIZE - 1) & PMD_MASK;
+               while (++pmd <= pmd_offset(pud, (unsigned long)_end - 1)) {
+                       memblock_addr = 
memblock_x86_find_in_range_size(__pa(addr),
+                                       &size, PMD_SIZE);
+                       if (memblock_addr == (u64) __pa(addr) && size >= 
PMD_SIZE)
+                               pmd_clear(pmd);
+                       addr += PMD_SIZE;
+               }
        }
 #endif
        __flush_tlb_all();


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel