]> xenbits.xensource.com Git - xen.git/commitdiff
x86: consider modules when cutting off memory
authorJan Beulich <jbeulich@suse.com>
Mon, 18 Nov 2013 12:57:20 +0000 (13:57 +0100)
committerJan Beulich <jbeulich@suse.com>
Mon, 18 Nov 2013 12:57:20 +0000 (13:57 +0100)
The code in question runs after module ranges got already removed from
the E820 table, so when determining the new maximum page/PDX we need to
explicitly take them into account.

Furthermore we need to round up the ending addresses here, in order to
fully cover eventual partial trailing pages.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen/arch/x86/setup.c

index 5bf4ee0b2def1eb8ca4d21b6b876283cfdbf7a71..e33c34be52768054d04b63309d61f3d344940cd2 100644 (file)
@@ -1013,9 +1013,17 @@ void __init __start_xen(unsigned long mbi_p)
                     ASSERT(j);
                 }
                 map_e = boot_e820.map[j].addr + boot_e820.map[j].size;
-                if ( (map_e >> PAGE_SHIFT) < max_page )
+                for ( j = 0; j < mbi->mods_count; ++j )
                 {
-                    max_page = map_e >> PAGE_SHIFT;
+                    uint64_t end = pfn_to_paddr(mod[j].mod_start) +
+                                   mod[j].mod_end;
+
+                    if ( map_e < end )
+                        map_e = end;
+                }
+                if ( PFN_UP(map_e) < max_page )
+                {
+                    max_page = PFN_UP(map_e);
                     max_pdx = pfn_to_pdx(max_page - 1) + 1;
                 }
                 printk(XENLOG_WARNING "Ignoring inaccessible memory range"