Received: by 10.213.65.68 with SMTP id h4csp1665938imn; Thu, 15 Mar 2018 06:20:10 -0700 (PDT) X-Google-Smtp-Source: AG47ELv5gGvoNzhJJjA+8o3mg9ixKQHo9CvCqM5tL0pDppoxR4oKMkzIptFy90smbB9T++mVYlTt X-Received: by 10.99.140.87 with SMTP id q23mr6737488pgn.258.1521120010311; Thu, 15 Mar 2018 06:20:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521120010; cv=none; d=google.com; s=arc-20160816; b=snEhf0a/TjcHKpJ3WRJjhhJesMTTZ2Zo375PmbC39klFZ+llJEYLbS5a/EWR59e2E/ 9Pnn/g87iMOphWjL+YX2anvTRbS5WmyR6t/Oo1jnx686NtTcdubYsUEk/lopTvYbEFst 1xFbabdyJsSlanZZrhLl+1/gtZQ7RvCB7CVa2aLbd2nmILhdgScEZrYnZbG3zDNw4bfb UZBJlD5LonUX2IIjNQ++gaM4vhXv3hCUantHxbfJDsLPYmIUVKlfmYPnOJ7SdBgU9bY2 BfTRLVWxnrO5o5S1/LVVpGsL6IB8nHFLZw1YVQmkykS2766FkKMcwevrSRsaQUA0sluJ YwLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=yZtSiYOTp28Ucf1tEXyTM9AbUXlXVkfCgRrVPbHcrtk=; b=R4ykwbEQUa7YdBcHNONeUFOc/OhXEBQEQUVvst2KwZmbh/gKgX8t70J+VOspCPUSWB cOqq4CdoRBHa2Hklz8VpYzi7S2J9PO/BCvPf/hRuvfePqUQYjrTVfZhVVklWuMTTJUg0 kdKq9F+ufh3jCEfVbsAV8KOpBv1sGRzQQAXxIBCkdhkD2/WPsKy7YFcxs2YXKErdK5OT pBt8fy7rPCa2zPsn4ZMw0psBU4BJ/wi5uN5UU/Kqq3Nuj9hPejSgYbkAEiRmv4Qac2lN TizmSlK/JXiXATfBNL3XILXP9UbSpcbeXZy3UmN6eG30OeCfBo2qWm7j0VlqIRyHi8V5 H8gg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t13si3446866pgp.450.2018.03.15.06.19.55; Thu, 15 Mar 2018 06:20:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751780AbeCONSx (ORCPT + 99 others); Thu, 15 Mar 2018 09:18:53 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:38732 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751437AbeCONSw (ORCPT ); Thu, 15 Mar 2018 09:18:52 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D15321529; Thu, 15 Mar 2018 06:18:51 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2B8533F777; Thu, 15 Mar 2018 06:18:49 -0700 (PDT) Date: Thu, 15 Mar 2018 13:18:46 +0000 From: Mark Rutland To: Chintan Pandya Cc: catalin.marinas@arm.com, will.deacon@arm.com, arnd@arndb.de, ard.biesheuvel@linaro.org, marc.zyngier@arm.com, james.morse@arm.com, kristina.martsenko@arm.com, takahiro.akashi@linaro.org, gregkh@linuxfoundation.org, tglx@linutronix.de, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, akpm@linux-foundation.org, toshi.kani@hpe.com Subject: Re: [PATCH v2 3/4] arm64: Implement page table free interfaces Message-ID: <20180315131846.sfpxg3xlpjii3nju@lakrids.cambridge.arm.com> References: <1521117906-20107-1-git-send-email-cpandya@codeaurora.org> <1521117906-20107-4-git-send-email-cpandya@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1521117906-20107-4-git-send-email-cpandya@codeaurora.org> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 15, 2018 at 06:15:05PM +0530, Chintan Pandya wrote: > Implement pud_free_pmd_page() and pmd_free_pte_page(). > > Make sure, that they are indeed a page table before > taking them to free. As mentioned on the prior patch, if the tables we're freeing contain valid entries, then we need additional TLB maintenance to ensure that all of these entries have been removed from TLBs. Either, we always invalidate the entire range, or we walk the tables and invalidate as we remove them. Thanks, Mark. > > Signed-off-by: Chintan Pandya > --- > arch/arm64/mm/mmu.c | 20 ++++++++++++++++++-- > 1 file changed, 18 insertions(+), 2 deletions(-) > > diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c > index 2dbb2c9..6f21a65 100644 > --- a/arch/arm64/mm/mmu.c > +++ b/arch/arm64/mm/mmu.c > @@ -32,6 +32,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -45,6 +46,7 @@ > #include > #include > #include > +#include > > #define NO_BLOCK_MAPPINGS BIT(0) > #define NO_CONT_MAPPINGS BIT(1) > @@ -975,10 +977,24 @@ int pmd_clear_huge(pmd_t *pmdp) > > int pud_free_pmd_page(pud_t *pud) > { > - return pud_none(*pud); > + pmd_t *pmd; > + int i; > + > + pmd = __va(pud_val(*pud)); > + if (pud_val(*pud) && !pud_huge(*pud)) { > + for (i = 0; i < PTRS_PER_PMD; i++) > + pmd_free_pte_page(&pmd[i]); > + > + free_page((unsigned long)pmd); > + } > + > + return 1; > } > > int pmd_free_pte_page(pmd_t *pmd) > { > - return pmd_none(*pmd); > + if (pmd_val(*pmd) && !pmd_huge(*pmd)) > + free_page((unsigned long)__va(pmd_val(*pmd))); > + > + return 1; > } > -- > Qualcomm India Private Limited, on behalf of Qualcomm Innovation > Center, Inc., is a member of Code Aurora Forum, a Linux Foundation > Collaborative Project >