From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tamas K Lengyel Subject: [PATCH v4 13/16] xen/arm: Shatter large pages when using mem_acces Date: Fri, 5 Sep 2014 10:58:41 +0200 Message-ID: <1409907524-12509-14-git-send-email-tklengyel@sec.in.tum.de> References: <1409907524-12509-1-git-send-email-tklengyel@sec.in.tum.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1409907524-12509-1-git-send-email-tklengyel@sec.in.tum.de> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: ian.campbell@citrix.com, tim@xen.org, julien.grall@linaro.org, ian.jackson@eu.citrix.com, stefano.stabellini@citrix.com, andres@lagarcavilla.org, jbeulich@suse.com, dgdegra@tycho.nsa.gov, Tamas K Lengyel List-Id: xen-devel@lists.xenproject.org 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 --- 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