From patchwork Wed Dec 18 17:31:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 22627 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f197.google.com (mail-qc0-f197.google.com [209.85.216.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6CA9223FBE for ; Wed, 18 Dec 2013 17:31:19 +0000 (UTC) Received: by mail-qc0-f197.google.com with SMTP id r5sf13683237qcx.8 for ; Wed, 18 Dec 2013 09:31:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=FVxFC3ZIJQ2AaXvvsJUWtR0PUbH5IxxmVqz6BCZ7pSk=; b=W6RmDlbL/zY2Dg8jJsjzT4/5bqmZgoDipDQvfPnkxSGFDKLVhx5ZxS9NmjFZ67Vm5P Tgq03+gg1kSq/2BFauNvMXfxRIxt+nDQ+4mShmZ6Uknq78/qjg74YfHJi4ghGQeWcVMU cXbc7hEkz47iGmuXyryvSG0t/YR6lJ5isxbCS/Dz+oIMwETF4XcTBnghhbm9MzPMU6g1 NOXzCdvraYdWLQjw/ECAKd9rQMudIigXxlsmBl7+Dm+Ra8/vgW4qId3yyO+TcqS0hnjz ApQCXEWITWgfaLumxXPbGtnVjalhKuAmCZzrkAZc8PyYdO7/ZC2iL9qBIelS82cJvdDC ospw== X-Gm-Message-State: ALoCoQlfiuAbtERWqVkumfpdnfhL3HgmFe+4lYkTOdlSZnxHfK9pnhW9c/e0vYIGdhJj1PvfIk1H X-Received: by 10.59.5.68 with SMTP id ck4mr11691423ved.9.1387387879439; Wed, 18 Dec 2013 09:31:19 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.15.70 with SMTP id v6ls131444qec.47.gmail; Wed, 18 Dec 2013 09:31:19 -0800 (PST) X-Received: by 10.52.245.42 with SMTP id xl10mr7651051vdc.35.1387387879275; Wed, 18 Dec 2013 09:31:19 -0800 (PST) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id tj6si136044vcb.118.2013.12.18.09.31.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 18 Dec 2013 09:31:19 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id ht17so202740vcb.18 for ; Wed, 18 Dec 2013 09:31:19 -0800 (PST) X-Received: by 10.52.106.107 with SMTP id gt11mr11607817vdb.7.1387387879152; Wed, 18 Dec 2013 09:31:19 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp259509ved; Wed, 18 Dec 2013 09:31:18 -0800 (PST) X-Received: by 10.14.108.134 with SMTP id q6mr22351360eeg.96.1387387877998; Wed, 18 Dec 2013 09:31:17 -0800 (PST) Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com [74.125.83.54]) by mx.google.com with ESMTPS id e2si925685eeg.177.2013.12.18.09.31.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 18 Dec 2013 09:31:17 -0800 (PST) Received-SPF: neutral (google.com: 74.125.83.54 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=74.125.83.54; Received: by mail-ee0-f54.google.com with SMTP id e51so3119493eek.27 for ; Wed, 18 Dec 2013 09:31:17 -0800 (PST) X-Received: by 10.15.34.197 with SMTP id e45mr30274994eev.61.1387387877411; Wed, 18 Dec 2013 09:31:17 -0800 (PST) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id e3sm1872875eeg.11.2013.12.18.09.31.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2013 09:31:15 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Cc: patches@linaro.org, ian.campbell@citrix.com, tim@xen.org, stefano.stabellini@citrix.com, george.dunlap@citrix.com, Julien Grall Subject: [PATCH] xen/arm: p2m: Don't create new table when the mapping is removed Date: Wed, 18 Dec 2013 17:31:13 +0000 Message-Id: <1387387873-3269-1-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , When Xen is removing/relinquishing mapping, it will create second/third tables if they don't exist. Non-existent table means the address range was never mapped, so Xen can safely skip them. Signed-off-by: Julien Grall Acked-by: Stefano Stabellini --- Release: This is an improvement for Xen 4.4. It will save time during relinquish phase and avoid dummy allocation. The downside is the patch is modifying p2m loop which is used everywhere. --- xen/arch/arm/p2m.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index d24a6fc..9ef8819 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -246,10 +246,12 @@ static int create_p2m_entries(struct domain *d, cur_first_offset = ~0, cur_second_offset = ~0; unsigned long count = 0; + bool_t populate = (op == INSERT || op == ALLOCATE); spin_lock(&p2m->lock); - for(addr = start_gpaddr; addr < end_gpaddr; addr += PAGE_SIZE) + addr = start_gpaddr; + while ( addr < end_gpaddr ) { if ( cur_first_page != p2m_first_level_index(addr) ) { @@ -265,8 +267,15 @@ static int create_p2m_entries(struct domain *d, if ( !first[first_table_offset(addr)].p2m.valid ) { + if ( !populate ) + { + addr += FIRST_SIZE; + continue; + } + rc = p2m_create_table(d, &first[first_table_offset(addr)]); - if ( rc < 0 ) { + if ( rc < 0 ) + { printk("p2m_populate_ram: L1 failed\n"); goto out; } @@ -284,6 +293,12 @@ static int create_p2m_entries(struct domain *d, if ( !second[second_table_offset(addr)].p2m.valid ) { + if ( !populate ) + { + addr += SECOND_SIZE; + continue; + } + rc = p2m_create_table(d, &second[second_table_offset(addr)]); if ( rc < 0 ) { printk("p2m_populate_ram: L2 failed\n"); @@ -372,6 +387,9 @@ static int create_p2m_entries(struct domain *d, } count = 0; } + + /* Got the next page */ + addr += PAGE_SIZE; } if ( op == ALLOCATE || op == INSERT )