[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 2/3] x86/mem_sharing: add fork_complete field to mem_sharing_domain



The fork's physmap should only be populated with select special pages during
the setup of the fork. The rest of the fork's physmap should only be populated
as needed after the fork is complete. Add a field to specify when the fork is
complete so fork_page() can determine whether it's time to start adding entries
to the physmap.

Signed-off-by: Tamas K Lengyel <tamas.lengyel@xxxxxxxxx>
---
v2: replace previous patch that set parent to dom_cow as a placeholder
---
 xen/arch/x86/include/asm/hvm/domain.h | 1 +
 xen/arch/x86/mm/mem_sharing.c         | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/include/asm/hvm/domain.h 
b/xen/arch/x86/include/asm/hvm/domain.h
index 22a17c36c5..7078d041bd 100644
--- a/xen/arch/x86/include/asm/hvm/domain.h
+++ b/xen/arch/x86/include/asm/hvm/domain.h
@@ -32,6 +32,7 @@
 struct mem_sharing_domain
 {
     bool enabled;
+    bool fork_complete;
     bool block_interrupts;
     bool empty_p2m;
 
diff --git a/xen/arch/x86/mm/mem_sharing.c b/xen/arch/x86/mm/mem_sharing.c
index ef67285a98..bfde342a38 100644
--- a/xen/arch/x86/mm/mem_sharing.c
+++ b/xen/arch/x86/mm/mem_sharing.c
@@ -1555,7 +1555,7 @@ int mem_sharing_fork_page(struct domain *d, gfn_t gfn, 
bool unsharing)
     p2m_type_t p2mt;
     struct page_info *page;
 
-    if ( !mem_sharing_is_fork(d) )
+    if ( !d->arch.hvm.mem_sharing.fork_complete )
         return -ENOENT;
 
     if ( !unsharing )
@@ -1862,6 +1862,7 @@ static int fork(struct domain *cd, struct domain *d, 
uint16_t flags)
 
     if ( !(rc = copy_settings(cd, d, empty_p2m)) )
     {
+        cd->arch.hvm.mem_sharing.fork_complete = true;
         cd->arch.hvm.mem_sharing.block_interrupts = block_interrupts;
 
         if ( (cd->arch.hvm.mem_sharing.empty_p2m = empty_p2m) )
-- 
2.25.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.