mm: initialize lowmem virq when boot-time scrubbing is disabled
authorBoris Ostrovsky <boris.ostrovsky@oracle.com>
Fri, 1 Sep 2017 09:04:47 +0000 (11:04 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 1 Sep 2017 09:04:47 +0000 (11:04 +0200)
scrub_heap_pages() does early return if boot-time scrubbing is
disabled, neglecting to initialize lowmem VIRQ.

Because setup_low_mem_virq() doesn't logically belong in
scrub_heap_pages() we put them both into the newly added
heap_init_late().

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/arch/arm/setup.c
xen/arch/x86/setup.c
xen/common/page_alloc.c
xen/include/xen/mm.h

index 3b34855668717bcf60c2390ebc2023020586e697..92f173be0c232ff57564cb843c38f4bdaafefe84 100644 (file)
@@ -861,8 +861,7 @@ void __init start_xen(unsigned long boot_phys_offset,
     if ( construct_dom0(dom0) != 0)
             panic("Could not set up DOM0 guest OS");
 
-    /* Scrub RAM that is still free and so may go to an unprivileged domain. */
-    scrub_heap_pages();
+    heap_init_late();
 
     init_constructors();
 
index ec9628796607833c3feb244c96a6d131eb4ee97c..bc466e8a8ec14d0979e083ce91615e07f11d43bb 100644 (file)
@@ -1662,8 +1662,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
         cr4_pv32_mask |= X86_CR4_SMAP;
     }
 
-    /* Scrub RAM that is still free and so may go to an unprivileged domain. */
-    scrub_heap_pages();
+    heap_init_late();
 
     init_trace_bufs();
 
index 9fa62d26bacce136f00f452dd72408c8df9ba81d..43f5a388b4c9f36c371292080a83dfc902ef5eba 100644 (file)
@@ -1839,7 +1839,7 @@ static int __init find_non_smt(unsigned int node, cpumask_t *dest)
  * Scrub all unallocated pages in all heap zones. This function uses all
  * online cpu's to scrub the memory in parallel.
  */
-void __init scrub_heap_pages(void)
+static void __init scrub_heap_pages(void)
 {
     cpumask_t node_cpus, all_worker_cpus;
     unsigned int i, j;
@@ -1849,9 +1849,6 @@ void __init scrub_heap_pages(void)
     int last_distance, best_node;
     int cpus;
 
-    if ( !opt_bootscrub )
-        return;
-
     cpumask_clear(&all_worker_cpus);
     /* Scrub block size. */
     chunk_size = opt_bootscrub_chunk >> PAGE_SHIFT;
@@ -1970,12 +1967,19 @@ void __init scrub_heap_pages(void)
 #ifdef CONFIG_SCRUB_DEBUG
     boot_scrub_done = true;
 #endif
+}
 
-    /* Now that the heap is initialized, run checks and set bounds
-     * for the low mem virq algorithm. */
+void __init heap_init_late(void)
+{
+    /*
+     * Now that the heap is initialized set bounds
+     * for the low mem virq algorithm.
+     */
     setup_low_mem_virq();
-}
 
+    if ( opt_bootscrub )
+        scrub_heap_pages();
+}
 
 
 /*************************
index ddc3fb3c2831cbcecfd8ccbe3fdb1fc3de990780..c2f5a089ec25cd165ca8b0446498e811b3ab3820 100644 (file)
@@ -199,7 +199,7 @@ int offline_page(unsigned long mfn, int broken, uint32_t *status);
 int query_page_offline(unsigned long mfn, uint32_t *status);
 unsigned long total_free_pages(void);
 
-void scrub_heap_pages(void);
+void heap_init_late(void);
 
 int assign_pages(
     struct domain *d,