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

[Xen-changelog] [xen master] xen/arm: p2m: apply_p2m_changes: Only load domain P2M when we flush TLBs



commit c93e9e412440e1acaace9a4c2ec2c3c2a55ba0af
Author:     Julien Grall <julien.grall@xxxxxxxxxx>
AuthorDate: Tue Apr 22 14:14:18 2014 +0100
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Fri May 2 13:14:10 2014 +0100

    xen/arm: p2m: apply_p2m_changes: Only load domain P2M when we flush TLBs
    
    apply_p2m_changes needs to switch to another VTTBR temporarily to avoid
    flush every TLBs.
    
    As it's only needed there, we can restrict the scope where the VTTBR of this
    domain is loaded.
    
    Signed-off-by: Julien Grall <julien.grall@xxxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 xen/arch/arm/p2m.c |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 0730da4..603c097 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -296,9 +296,6 @@ static int apply_p2m_changes(struct domain *d,
 
     spin_lock(&p2m->lock);
 
-    if ( d != current->domain )
-        p2m_load_VTTBR(d);
-
     addr = start_gpaddr;
     while ( addr < end_gpaddr )
     {
@@ -454,12 +451,17 @@ static int apply_p2m_changes(struct domain *d,
 
     if ( flush )
     {
-        /* At the beginning of the function, Xen is updating VTTBR
-         * with the domain where the mappings are created. In this
-         * case it's only necessary to flush TLBs on every CPUs with
-         * the current VMID (our domain).
+        /* Update the VTTBR if necessary with the domain where mappings
+         * are created. In this case it's only necessary to flush TLBs
+         * on every CPUs with the current VMID (our domain).
          */
+        if ( d != current->domain )
+            p2m_load_VTTBR(d);
+
         flush_tlb();
+
+        if ( d != current->domain )
+            p2m_load_VTTBR(current->domain);
     }
 
     if ( op == ALLOCATE || op == INSERT )
@@ -478,9 +480,6 @@ out:
     if (second) unmap_domain_page(second);
     if (first) unmap_domain_page(first);
 
-    if ( d != current->domain )
-        p2m_load_VTTBR(current->domain);
-
     spin_unlock(&p2m->lock);
 
     return rc;
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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