]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Merge branch 'stable/e820-3.2.rebased' into uek2-merge
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Wed, 19 Oct 2011 20:12:04 +0000 (16:12 -0400)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Wed, 19 Oct 2011 20:12:04 +0000 (16:12 -0400)
* stable/e820-3.2.rebased:
  xen: release all pages within 1-1 p2m mappings
  xen: allow extra memory to be in multiple regions
  xen: allow balloon driver to use more than one memory region
  xen/balloon: simplify test for the end of usable RAM
  xen/balloon: account for pages released during memory setup
  xen/e820: if there is no dom0_mem=, don't tweak extra_pages.
  Revert "xen/e820: if there is no dom0_mem=, don't tweak extra_pages."
  xen/e820: if there is no dom0_mem=, don't tweak extra_pages.
  xen: use maximum reservation to limit amount of usable RAM
  xen: Fix misleading WARN message at xen_release_chunk
  xen: Fix printk() format in xen/setup.c

Conflicts:
arch/x86/xen/setup.c

1  2 
arch/x86/xen/setup.c
drivers/xen/balloon.c

index 09688eb4a899b8bd64e28b4dd4142e851dbc70bb,8c9d9ec483f9ae0c20c5fd31e8f6525e90a7c7fa..68fe36b5788eecb0dee08b5e1e0abaf090cb7aae
@@@ -140,62 -166,31 +166,31 @@@ static unsigned long __init xen_set_ide
        return released;
  }
  
- static unsigned long __init xen_set_identity(const struct e820entry *list,
-                                            ssize_t map_size)
 -static unsigned long __init xen_get_max_pages(void)
 -{
 -      unsigned long max_pages = MAX_DOMAIN_PAGES;
 -      domid_t domid = DOMID_SELF;
 -      int ret;
 -
 -      ret = HYPERVISOR_memory_op(XENMEM_maximum_reservation, &domid);
 -      if (ret > 0)
 -              max_pages = ret;
 -      return min(max_pages, MAX_DOMAIN_PAGES);
 -}
 -
+ static void xen_align_and_add_e820_region(u64 start, u64 size, int type)
  {
-       phys_addr_t last = xen_initial_domain() ? 0 : ISA_END_ADDRESS;
-       phys_addr_t start_pci = last;
-       const struct e820entry *entry;
-       unsigned long identity = 0;
-       int i;
-       for (i = 0, entry = list; i < map_size; i++, entry++) {
-               phys_addr_t start = entry->addr;
-               phys_addr_t end = start + entry->size;
+       u64 end = start + size;
  
-               if (start < last)
-                       start = last;
-               if (end <= start)
-                       continue;
-               /* Skip over the 1MB region. */
-               if (last > end)
-                       continue;
-               if ((entry->type == E820_RAM) || (entry->type == E820_UNUSABLE)) {
-                       if (start > start_pci)
-                               identity += set_phys_range_identity(
-                                               PFN_UP(start_pci), PFN_DOWN(start));
-                       /* Without saving 'last' we would gooble RAM too
-                        * at the end of the loop. */
-                       last = end;
-                       start_pci = end;
-                       continue;
-               }
-               start_pci = min(start, start_pci);
-               last = end;
+       /* Align RAM regions to page boundaries. */
+       if (type == E820_RAM) {
+               start = PAGE_ALIGN(start);
+               end &= ~((u64)PAGE_SIZE - 1);
        }
-       if (last > start_pci)
-               identity += set_phys_range_identity(
-                                       PFN_UP(start_pci), PFN_DOWN(last));
-       return identity;
+       e820_add_region(start, end - start, type);
  }
  
 +static unsigned long __init xen_get_max_pages(void)
 +{
 +      unsigned long max_pages = MAX_DOMAIN_PAGES;
 +      domid_t domid = DOMID_SELF;
 +      int ret;
 +
 +      ret = HYPERVISOR_memory_op(XENMEM_maximum_reservation, &domid);
 +      if (ret > 0)
 +              max_pages = ret;
 +      return min(max_pages, MAX_DOMAIN_PAGES);
 +}
 +
  /**
   * machine_specific_memory_setup - Hook for machine specific memory setup.
   **/
index cba8bebb7fe891e96683b9a41de304937fa29289,c8473ee8bcf9577d9b2a7de07dcb635ba5c445b0..d01944e871cae9e2b1d2de5e1de8ee7ea01cd0b5
@@@ -578,33 -471,14 +601,22 @@@ static int __init balloon_init(void
        balloon_stats.retry_count = 1;
        balloon_stats.max_retry_count = RETRY_UNLIMITED;
  
 +#ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG
 +      balloon_stats.hotplug_pages = 0;
 +      balloon_stats.balloon_hotplug = 0;
 +
 +      set_online_page_callback(&xen_online_page);
 +      register_memory_notifier(&xen_memory_nb);
 +#endif
 +
        /*
-        * Initialise the balloon with excess memory space.  We need
-        * to make sure we don't add memory which doesn't exist or
-        * logically exist.  The E820 map can be trimmed to be smaller
-        * than the amount of physical memory due to the mem= command
-        * line parameter.  And if this is a 32-bit non-HIGHMEM kernel
-        * on a system with memory which requires highmem to access,
-        * don't try to use it.
+        * Initialize the balloon with pages from the extra memory
+        * regions (see arch/x86/xen/setup.c).
         */
-       extra_pfn_end = min(min(max_pfn, e820_end_of_ram_pfn()),
-                           (unsigned long)PFN_DOWN(xen_extra_mem_start + xen_extra_mem_size));
-       for (pfn = PFN_UP(xen_extra_mem_start);
-            pfn < extra_pfn_end;
-            pfn++) {
-               page = pfn_to_page(pfn);
-               /* totalram_pages and totalhigh_pages do not include the boot-time
-                  balloon extension, so don't subtract from it. */
-               __balloon_append(page);
-       }
+       for (i = 0; i < XEN_EXTRA_MEM_MAX_REGIONS; i++)
+               if (xen_extra_mem[i].size)
+                       balloon_add_region(PFN_UP(xen_extra_mem[i].start),
+                                          PFN_DOWN(xen_extra_mem[i].size));
  
        return 0;
  }