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

[Xen-devel] [PATCH v4 13/16] xen/arm: Shatter large pages when using mem_acces



When using mem_acccess+mem_event, the coarsest granularity is required
in the pagetables, therefore we shatter each large page (1GB/2MB) as we
apply the permission changes.

Signed-off-by: Tamas K Lengyel <tklengyel@xxxxxxxxxxxxx>
---
 xen/arch/arm/p2m.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index c723f9a..35ca6c1 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -1178,7 +1178,16 @@ static int p2m_set_entry(struct domain *d, paddr_t 
paddr, p2m_access_t p2ma)
         goto out;
 
     if ( !p2m_table(*pte) )
-        goto done;
+    {
+        /* This is a mapping of a 1GB page, shatter it */
+        rc = p2m_create_table(d, pte, FIRST_SHIFT - PAGE_SHIFT, 1);
+        if ( rc < 0 )
+            goto out;
+
+        p2m->stats.shattered[1]++;
+        p2m->stats.mappings[1]--;
+        p2m->stats.mappings[2] += LPAE_ENTRIES;
+    }
 
     second = map_domain_page(pte->p2m.base);
     if ( !second )
@@ -1189,7 +1198,16 @@ static int p2m_set_entry(struct domain *d, paddr_t 
paddr, p2m_access_t p2ma)
         goto out;
 
     if ( !p2m_table(*pte) )
-        goto done;
+    {
+        /* This is a mapping of 2MB page, shatter it */
+        rc = p2m_create_table(d, pte, SECOND_SHIFT - PAGE_SHIFT, 1);
+        if ( rc < 0 )
+            goto out;
+
+        p2m->stats.shattered[2]++;
+        p2m->stats.mappings[2]--;
+        p2m->stats.mappings[3] += LPAE_ENTRIES;
+    }
 
     third = map_domain_page(pte->p2m.base);
     if ( !third )
@@ -1203,7 +1221,6 @@ static int p2m_set_entry(struct domain *d, paddr_t paddr, 
p2m_access_t p2ma)
     if ( !p2m_table(*pte) )
         pte->bits = 0;
 
-done:
     if ( p2m_valid(*pte) )
     {
         ASSERT(pte->p2m.type != p2m_invalid);
-- 
2.1.0


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


 


Rackspace

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