[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v3 12/15] 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 | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index e8f5671..0d447e2 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -1132,12 +1132,30 @@ static bool_t p2m_set_entry(struct domain *d, paddr_t paddr, p2m_access_t p2ma) pte = &first[first_table_offset(paddr)]; 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 err; + + p2m->stats.shattered[1]++; + p2m->stats.mappings[1]--; + p2m->stats.mappings[2] += LPAE_ENTRIES; + } second = map_domain_page(pte->p2m.base); pte = &second[second_table_offset(paddr)]; 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 err; + + p2m->stats.shattered[2]++; + p2m->stats.mappings[2]--; + p2m->stats.mappings[3] += LPAE_ENTRIES; + } third = map_domain_page(pte->p2m.base); pte = &third[third_table_offset(paddr)]; @@ -1148,7 +1166,6 @@ static bool_t 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); @@ -1159,11 +1176,11 @@ done: rc = 1; } +err: if (third) unmap_domain_page(third); if (second) unmap_domain_page(second); if (first) unmap_domain_page(first); -err: return rc; } -- 2.1.0.rc1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |