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

Re: [Xen-devel] [PATCH 10/18] arm/altp2m: Renamed and extended p2m_alloc_table.



Hello Sergej,

On 04/07/16 12:45, Sergej Proskurin wrote:
+int p2m_table_init(struct domain *d)
+{
+    int i = 0;
+    int rc = -ENOMEM;
+    struct p2m_domain *p2m = p2m_get_hostp2m(d);
+
+    spin_lock(&p2m->lock);
+
+    rc = p2m_alloc_table(p2m);
+    if ( rc != 0 )
+        goto out;
+
+    d->arch.vttbr = d->arch.p2m.vttbr.vttbr;
+
+    /*
+     * Make sure that all TLBs corresponding to the new VMID are flushed
+     * before using it.
       */
      flush_tlb_domain(d);

      spin_unlock(&p2m->lock);

-    return 0;
+    if ( hvm_altp2m_supported() )
+    {
+        /* Init alternate p2m data */
+        for ( i = 0; i < MAX_ALTP2M; i++ )
+        {
+            d->arch.altp2m_vttbr[i] = INVALID_MFN;
+            rc = p2m_alloc_table(d->arch.altp2m_p2m[i]);

Why do we need to allocate all the altp2m root page tables at the creation of the domain? This is wasting up to 80KB (2-root page for 10 altp2m) per domain even if it may not be used at all by the domain.

+            if ( rc != 0 )
+                goto out;
+        }
+
+        d->arch.altp2m_active = 0;
+    }
+
+out:
+    return rc;
  }

  #define MAX_VMID 256
diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h
index 783db5c..451b097 100644
--- a/xen/include/asm-arm/p2m.h
+++ b/xen/include/asm-arm/p2m.h
@@ -171,7 +171,7 @@ int relinquish_p2m_mapping(struct domain *d);
   *
   * Returns 0 for success or -errno.
   */
-int p2m_alloc_table(struct domain *d);
+int p2m_table_init(struct domain *d);

  /* Context switch */
  void p2m_save_state(struct vcpu *p);


Regards,

--
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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