From patchwork Tue Jun 10 09:57:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 31615 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f200.google.com (mail-ig0-f200.google.com [209.85.213.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3CEC62054B for ; Tue, 10 Jun 2014 09:59:55 +0000 (UTC) Received: by mail-ig0-f200.google.com with SMTP id l13sf16849997iga.3 for ; Tue, 10 Jun 2014 02:59:54 -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:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:list-archive:content-type:content-transfer-encoding; bh=y9baNCRl5VpXsg/6ZUnlVRjerVNhZxZlLB4ELiOmv5Q=; b=nIZpqLziBcw3e0Fzw/uJQsbzzMmu3HFehNVYW6xP5fUnn2dQzqd2xZ0xODILStXysl p0gPlaxX903fDx5SZ364XNLh8oft59lJyS+frDPX2wesl/MHINO8xIUF6qxYGmO+9rXm xoptMimpYSbdCHxYv+NKmWnz+I9ffNkPZxycvXimD1x037X5NceGdyj7ZkN9RqFCulpU zP5IFW/UUSPQwRE6rlBn5i65Dwpnk/QJkWJaFkdk/6/OitRKA8eXEJ0j4j9meWefPCqu LGBfNqbl6Q/SCc5TSUcl9kIvhFntQ/XjdWpQvYq1Y39DZEG1+gVOokkHGY132zBDk55Q 2LjA== X-Gm-Message-State: ALoCoQkst8lAgHu8nI8g0oBQvQDAo2zpfTrEpjDLrzIm/1JMNuPDiujsVl2ICKBZP5XCM1UTlUJL X-Received: by 10.42.36.10 with SMTP id s10mr6302158icd.5.1402394394673; Tue, 10 Jun 2014 02:59:54 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.38.133 with SMTP id t5ls1965270qgt.43.gmail; Tue, 10 Jun 2014 02:59:54 -0700 (PDT) X-Received: by 10.220.114.70 with SMTP id d6mr18229565vcq.5.1402394394540; Tue, 10 Jun 2014 02:59:54 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id j8si11635571vcr.60.2014.06.10.02.59.54 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Jun 2014 02:59:54 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id id10so5804805vcb.38 for ; Tue, 10 Jun 2014 02:59:54 -0700 (PDT) X-Received: by 10.58.120.195 with SMTP id le3mr11005886veb.7.1402394394461; Tue, 10 Jun 2014 02:59:54 -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.221.54.6 with SMTP id vs6csp212639vcb; Tue, 10 Jun 2014 02:59:54 -0700 (PDT) X-Received: by 10.221.63.195 with SMTP id xf3mr13926693vcb.36.1402394394011; Tue, 10 Jun 2014 02:59:54 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id i8si11653195vco.4.2014.06.10.02.59.53 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 10 Jun 2014 02:59:54 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) 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 1WuIog-0007hH-8C; Tue, 10 Jun 2014 09:58:06 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WuIof-0007gW-6G for xen-devel@lists.xen.org; Tue, 10 Jun 2014 09:58:05 +0000 Received: from [85.158.139.211:23672] by server-11.bemta-5.messagelabs.com id 20/F4-01425-BA6D6935; Tue, 10 Jun 2014 09:58:03 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-5.tower-206.messagelabs.com!1402394280!9063329!2 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 6778 invoked from network); 10 Jun 2014 09:58:02 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-5.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 10 Jun 2014 09:58:02 -0000 X-IronPort-AV: E=Sophos; i="4.98,1008,1392163200"; d="scan'208"; a="141868037" Received: from accessns.citrite.net (HELO FTLPEX01CL01.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 10 Jun 2014 09:57:59 +0000 Received: from norwich.cam.xci-test.com (10.80.248.129) by smtprelay.citrix.com (10.13.107.78) with Microsoft SMTP Server id 14.3.181.6; Tue, 10 Jun 2014 05:57:59 -0400 Received: from marilith-n13-p0.uk.xensource.com ([10.80.229.115] helo=marilith-n13.uk.xensource.com.) by norwich.cam.xci-test.com with esmtp (Exim 4.72) (envelope-from ) id 1WuIoZ-000207-9a; Tue, 10 Jun 2014 09:57:59 +0000 From: Ian Campbell To: Date: Tue, 10 Jun 2014 10:57:55 +0100 Message-ID: <1402394278-9850-3-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1402394127.29980.52.camel@kazak.uk.xensource.com> References: <1402394127.29980.52.camel@kazak.uk.xensource.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: julien.grall@linaro.org, tim@xen.org, Ian Campbell , stefano.stabellini@eu.citrix.com Subject: [Xen-devel] [PATCH 3/6] xen: arm: only put_page for p2m operations which require it. 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: , 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: ian.campbell@citrix.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) 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: In particular do not do it for CACHEFLUSH. INSERT, RELINQUISH and REMOVE should all put the page (if the current pte is valid). ALLOCATE doesn't need to since it asserts the current PTE must be invalid. Signed-off-by: Ian Campbell --- xen/arch/arm/p2m.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 9960e17..830a9f9 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -299,6 +299,23 @@ enum p2m_operation { CACHEFLUSH, }; +static void p2m_put_page(const lpae_t pte) +{ + /* TODO: Handle other p2m types + * + * It's safe to do the put_page here because page_alloc will + * flush the TLBs if the page is reallocated before the end of + * this loop. + */ + if ( p2m_is_foreign(pte.p2m.type) ) + { + unsigned long mfn = pte.p2m.base; + + ASSERT(mfn_valid(mfn)); + put_page(mfn_to_page(mfn)); + } +} + static int apply_p2m_changes(struct domain *d, enum p2m_operation op, paddr_t start_gpaddr, @@ -436,6 +453,8 @@ static int apply_p2m_changes(struct domain *d, break; case INSERT: { + if ( pte.p2m.valid ) + p2m_put_page(pte); pte = mfn_to_p2m_entry(maddr >> PAGE_SHIFT, mattr, t); p2m_write_pte(&third[third_table_offset(addr)], pte, flush_pt); @@ -451,6 +470,8 @@ static int apply_p2m_changes(struct domain *d, break; } + p2m_put_page(pte); + count += 0x10; memset(&pte, 0x00, sizeof(pte));