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

[Xen-devel] [RFC PATCH 64/84] mapcache: initialise the mapcache even for the idle domain.



From: Hongyan Xia <hongyax@xxxxxxxxxx>

In situations like in irqs or domain creation, PMAP cannot be used or
the mapcache of that domain is simply not ready. We need to have a
mapcache in the idle domain to map pages to deal with these.

After this patch, map_domain_page() completely gets rid of the direct
map. The assertions ensure mappings only happen within PMAP or MAPCACHE
regions. As a result, map_xen_pagetable() gets rid of the direct map as
well.

Signed-off-by: Hongyan Xia <hongyax@xxxxxxxxxx>
---
 xen/arch/x86/mm.c     | 3 +++
 xen/common/schedule.c | 1 +
 2 files changed, 4 insertions(+)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 9619182f52..f30b5b3951 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5858,6 +5858,9 @@ int create_perdomain_mapping(struct domain *d, unsigned 
long va,
         l3tab = __map_domain_page(pg);
         clear_page(l3tab);
         d->arch.perdomain_l3_pg = pg;
+        if ( is_idle_domain(d) )
+            idle_pg_table[l4_table_offset(PERDOMAIN_VIRT_START)] =
+                    l4e_from_page(pg, __PAGE_HYPERVISOR_RW);
         if ( !nr )
         {
             unmap_domain_page(l3tab);
diff --git a/xen/common/schedule.c b/xen/common/schedule.c
index 7b71581756..e687be33a3 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -1814,6 +1814,7 @@ void __init scheduler_init(void)
     BUG_ON(nr_cpu_ids > ARRAY_SIZE(idle_vcpu));
     idle_domain->vcpu = idle_vcpu;
     idle_domain->max_vcpus = nr_cpu_ids;
+    mapcache_domain_init(idle_domain);
     if ( vcpu_create(idle_domain, 0, 0) == NULL )
         BUG();
     this_cpu(schedule_data).sched_priv = sched_alloc_pdata(&ops, 0);
-- 
2.17.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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