From patchwork Tue Apr 22 13:14:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 28796 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f72.google.com (mail-qg0-f72.google.com [209.85.192.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 57A08203AC for ; Tue, 22 Apr 2014 13:16:00 +0000 (UTC) Received: by mail-qg0-f72.google.com with SMTP id q108sf570141qgd.7 for ; Tue, 22 Apr 2014 06:16:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe:list-post :list-help:list-subscribe:mime-version:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :list-archive:content-type:content-transfer-encoding; bh=pYvHE0uh/yqx/PomAORuvB1I8dAj7ytrEqZVw/nF/8s=; b=XgcKR6nwQytcCNv9xFavzkpzu7iwJwdjcblxDiN7N31/saRAnB2cxghLhqBEk3WlA1 EClWofapqSkA+a/CDv8A7m+2+IcyJadQOybzwKcWQORaYWHYyarV3Da7sPDilMwPDm61 Uvr9wGDtvc7LAoPfW8ziYz0CmkKAAY7yksUFtQ8EMjP5fbULMs+tCtVc+0JkKG5I1iKR inXaS3+CSiaNjvFGuA5vDa6m/KQSLzasfZgkPf3//N8JrJtBigpvRivA/zEuUxO0x20K Qz1fp+Zna/QsmzLnrkE2ibdA/BzD0eUlCaUccfT49ZqpDlNq38JiTcC4R32gV3t63mNz Izug== X-Gm-Message-State: ALoCoQmV2IaTC8ZRAslS6AyYpejZa8FSIZMkPjun+KmoCueky0z8eBclE2iBUtT4PMzs1uoSCoI8 X-Received: by 10.236.142.212 with SMTP id i60mr18124955yhj.39.1398172560034; Tue, 22 Apr 2014 06:16:00 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.37.84 with SMTP id q78ls77406qgq.69.gmail; Tue, 22 Apr 2014 06:15:59 -0700 (PDT) X-Received: by 10.58.49.65 with SMTP id s1mr54502ven.48.1398172559916; Tue, 22 Apr 2014 06:15:59 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id vd8si6877169vdc.52.2014.04.22.06.15.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 22 Apr 2014 06:15:59 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.171 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.171; Received: by mail-vc0-f171.google.com with SMTP id lg15so2494906vcb.2 for ; Tue, 22 Apr 2014 06:15:59 -0700 (PDT) X-Received: by 10.58.39.129 with SMTP id p1mr27628vek.69.1398172559823; Tue, 22 Apr 2014 06:15:59 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp23821vcb; Tue, 22 Apr 2014 06:15:59 -0700 (PDT) X-Received: by 10.140.91.7 with SMTP id y7mr52350426qgd.3.1398172559314; Tue, 22 Apr 2014 06:15:59 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id v10si16821824qat.208.2014.04.22.06.15.58 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 22 Apr 2014 06:15:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xen.org designates 50.57.142.19 as permitted sender) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WcaXD-0005qJ-Ag; Tue, 22 Apr 2014 13:14:51 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WcaXB-0005p6-M5 for xen-devel@lists.xenproject.org; Tue, 22 Apr 2014 13:14:49 +0000 Received: from [85.158.137.68:59992] by server-17.bemta-3.messagelabs.com id F7/9E-22741-84B66535; Tue, 22 Apr 2014 13:14:48 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-3.tower-31.messagelabs.com!1398172487!8247218!1 X-Originating-IP: [74.125.83.44] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.11.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 727 invoked from network); 22 Apr 2014 13:14:47 -0000 Received: from mail-ee0-f44.google.com (HELO mail-ee0-f44.google.com) (74.125.83.44) by server-3.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 22 Apr 2014 13:14:47 -0000 Received: by mail-ee0-f44.google.com with SMTP id e49so4600352eek.17 for ; Tue, 22 Apr 2014 06:14:47 -0700 (PDT) X-Received: by 10.15.49.65 with SMTP id i41mr9395163eew.87.1398172487593; Tue, 22 Apr 2014 06:14:47 -0700 (PDT) Received: from belegaer.uk.xensource.com ([185.25.64.249]) by mx.google.com with ESMTPSA id 45sm112969867eeh.9.2014.04.22.06.14.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Apr 2014 06:14:46 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 22 Apr 2014 14:14:18 +0100 Message-Id: <1398172475-27873-5-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1398172475-27873-1-git-send-email-julien.grall@linaro.org> References: <1398172475-27873-1-git-send-email-julien.grall@linaro.org> Cc: stefano.stabellini@citrix.com, Julien Grall , tim@xen.org, ian.campbell@citrix.com Subject: [Xen-devel] [PATCH v4 04/21] xen/arm: p2m: apply_p2m_changes: Only load domain P2M when we flush TLBs X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org 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.171 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 Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: 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 Acked-by: Ian Campbell --- Changes in v4: - Patch added --- xen/arch/arm/p2m.c | 19 +++++++++---------- 1 file 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;