|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen staging] dom_cow is needed for mem-sharing only
commit 79d91e178a1a46864d0779c1985ff7476ce2d6ab
Author: Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Wed Jul 17 15:34:23 2019 +0200
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Jul 17 15:34:23 2019 +0200
dom_cow is needed for mem-sharing only
A couple of adjustments are needed to code checking for dom_cow, but
since there are pretty few it is probably better to adjust those than
to set up and keep around a never used domain.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Acked-by: Julien Grall <julien.grall@xxxxxxx>
---
xen/arch/x86/mm.c | 4 ++--
xen/arch/x86/mm/p2m.c | 6 ++++--
xen/common/domain.c | 4 ++++
xen/common/grant_table.c | 2 +-
xen/include/xen/mm.h | 7 ++++++-
5 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 138662e777..3566c9ea2f 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -966,8 +966,8 @@ get_page_from_l1e(
return flip;
}
- if ( unlikely( (real_pg_owner != pg_owner) &&
- (real_pg_owner != dom_cow) ) )
+ if ( unlikely((real_pg_owner != pg_owner) &&
+ (!dom_cow || (real_pg_owner != dom_cow))) )
{
/*
* Let privileged domains transfer the right to map their target
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 883352da7d..fef97c82f6 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -568,7 +568,8 @@ struct page_info *p2m_get_page_from_gfn(
}
else if ( !get_page(page, p2m->domain) &&
/* Page could be shared */
- (!p2m_is_shared(*t) || !get_page(page, dom_cow)) )
+ (!dom_cow || !p2m_is_shared(*t) ||
+ !get_page(page, dom_cow)) )
page = NULL;
}
p2m_read_unlock(p2m);
@@ -941,7 +942,8 @@ guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t
mfn,
/* Then, look for m->p mappings for this range and deal with them */
for ( i = 0; i < (1UL << page_order); i++ )
{
- if ( page_get_owner(mfn_to_page(mfn_add(mfn, i))) == dom_cow )
+ if ( dom_cow &&
+ page_get_owner(mfn_to_page(mfn_add(mfn, i))) == dom_cow )
{
/* This is no way to add a shared page to your physmap! */
gdprintk(XENLOG_ERR, "Adding shared mfn %lx directly to dom%d
physmap not allowed.\n",
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 2308588052..8a5fa8662b 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -74,7 +74,9 @@ integer_param("hardware_dom", hardware_domid);
/* Private domain structs for DOMID_XEN, DOMID_IO, etc. */
struct domain *__read_mostly dom_xen;
struct domain *__read_mostly dom_io;
+#ifdef CONFIG_HAS_MEM_SHARING
struct domain *__read_mostly dom_cow;
+#endif
struct vcpu *idle_vcpu[NR_CPUS] __read_mostly;
@@ -547,6 +549,7 @@ void __init setup_system_domains(void)
if ( IS_ERR(dom_io) )
panic("Failed to create d[IO]: %ld\n", PTR_ERR(dom_io));
+#ifdef CONFIG_HAS_MEM_SHARING
/*
* Initialise our COW domain.
* This domain owns sharable pages.
@@ -554,6 +557,7 @@ void __init setup_system_domains(void)
dom_cow = domain_create(DOMID_COW, NULL, false);
if ( IS_ERR(dom_cow) )
panic("Failed to create d[COW]: %ld\n", PTR_ERR(dom_cow));
+#endif
}
void domain_update_node_affinity(struct domain *d)
diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index f0ca10a7fa..b6b45c21e1 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -1085,7 +1085,7 @@ map_grant_ref(
host_map_created = true;
}
}
- else if ( owner == rd || owner == dom_cow )
+ else if ( owner == rd || (dom_cow && owner == dom_cow) )
{
if ( (op->flags & GNTMAP_device_map) && !(op->flags & GNTMAP_readonly)
)
{
diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
index cfea38f801..47c8412b3a 100644
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -274,7 +274,12 @@ struct npfec {
#endif
/* Private domain structs for DOMID_XEN, DOMID_IO, etc. */
-extern struct domain *dom_xen, *dom_io, *dom_cow;
+extern struct domain *dom_xen, *dom_io;
+#ifdef CONFIG_HAS_MEM_SHARING
+extern struct domain *dom_cow;
+#else
+# define dom_cow NULL
+#endif
#define page_list_entry list_head
--
generated by git-patchbot for /home/xen/git/xen.git#staging
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |