From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: xen-devel@lists.xen.org
Cc: sstabellini@kernel.org, wei.liu2@citrix.com,
George.Dunlap@eu.citrix.com, andrew.cooper3@citrix.com,
ian.jackson@eu.citrix.com, tim@xen.org,
Julien Grall <julien.grall@arm.com>,
jbeulich@suse.com, Boris Ostrovsky <boris.ostrovsky@oracle.com>
Subject: [PATCH v2 1/4] mm: Initialize lowmem virq when boot-time scrubbing is disabled
Date: Thu, 31 Aug 2017 09:16:11 -0400 [thread overview]
Message-ID: <1504185374-7581-2-git-send-email-boris.ostrovsky@oracle.com> (raw)
In-Reply-To: <1504185374-7581-1-git-send-email-boris.ostrovsky@oracle.com>
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>
---
CC: Julien Grall <julien.grall@arm.com>
---
Changes in v2:
* Dropped unnecessary opt_bootscrub test in scrub_heap_pages()
* Restored comment for setup_low_mem_virq().
xen/arch/arm/setup.c | 3 +--
xen/arch/x86/setup.c | 3 +--
xen/common/page_alloc.c | 18 +++++++++++-------
xen/include/xen/mm.h | 2 +-
4 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 3b34855..92f173b 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -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();
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index ec96287..bc466e8 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -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();
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 9fa62d2..43f5a38 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -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();
+}
/*************************
diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
index ddc3fb3..c2f5a08 100644
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -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,
--
1.8.3.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-08-31 13:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-31 13:16 [PATCH v2 0/4] Scrubbing updates Boris Ostrovsky
2017-08-31 13:16 ` Boris Ostrovsky [this message]
2017-08-31 13:16 ` [PATCH v2 2/4] mm: Change boot_scrub_done definition Boris Ostrovsky
2017-08-31 13:16 ` [PATCH v2 3/4] mm: Don't poison a page if scrub_debug is off Boris Ostrovsky
2017-08-31 13:16 ` [PATCH v2 4/4] mm: Don't request scrubbing until dom0 is running Boris Ostrovsky
2017-08-31 15:00 ` Wei Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1504185374-7581-2-git-send-email-boris.ostrovsky@oracle.com \
--to=boris.ostrovsky@oracle.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=julien.grall@arm.com \
--cc=sstabellini@kernel.org \
--cc=tim@xen.org \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).