Received: by 10.213.65.68 with SMTP id h4csp1251904imn; Sun, 18 Mar 2018 21:44:01 -0700 (PDT) X-Google-Smtp-Source: AG47ELtzAUI6i4UyqWzLa0jlU7G8Nw/c9cLYTGN5x080ZWbqxqN1FLgy82lXTr1DTmUaYsECvrZd X-Received: by 2002:a17:902:4643:: with SMTP id o61-v6mr11189093pld.103.1521434641040; Sun, 18 Mar 2018 21:44:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521434641; cv=none; d=google.com; s=arc-20160816; b=kLpwGgeQlAAqSvA9euKaP6jFAXOL5EZVBktiPJHFSW8QtP/nR16t/KprVM6yv+LAnp u3oSBcwnuctg8/D9ZOH5Qc5w/fjmMisZWb2ZgWnTu7a9UamNdeDOPzdaatgaQw8kgWUy zLeiEbM5O/ToZt13IPUUETFDoHc2rSfZ6SItJHa1alBaC1752YyTAPbfprJ2VIZB+qBV Kh6MQPEA/hqdepSashCDh/Pxh8aUFs9e20vJO1wPg/3fAk+3+ylRKLaRqSPOUecXHAQZ EvoHmxvFyzp/IyCJQQ7tHdiVcGf8HjpWE4FyHXNmpv/Gzd6F9/tcYAR1ViqX4yksjY4r /naQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature:dkim-signature:arc-authentication-results; bh=BLbqFzeK8gG7x764LxLMazvvriubanubCVrlSE8z0Ks=; b=L9l+04a9sy69IXxNRKQFDuqNAmbbrP8BQQDntYPdC3uinjSy8mzV5HjrftHs4GIKhZ G3LwEWvuJFNKwJPAr4lPdhVGUeAxd80gdowCeixN3BePNsZNJkWNoDQc+5au6NMC4yTb 8TWB4ob3gRiF/tfa0gwgA2jPU99RhOE3tnA3GQh54a0NhNBvVq27xiXfKxtH+IkpWeIi w84NTimnNbZq8x0TOg/TH7tIPKdlVyOSTX8RnUyHMdqTwcXDSQ1XMrvt8MjYJteqCBLP WK4YbFJOW2LUwGrszTsmntNuE0zVm2qctso5xi97OzFYpSsgEpcPfDTX0HwvOLhWBjfr kLbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=UMvHXL3+; dkim=pass header.i=@codeaurora.org header.s=default header.b=Fm+2jpmn; 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 z4si527498pfb.192.2018.03.18.21.43.46; Sun, 18 Mar 2018 21:44:00 -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; dkim=pass header.i=@codeaurora.org header.s=default header.b=UMvHXL3+; dkim=pass header.i=@codeaurora.org header.s=default header.b=Fm+2jpmn; 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 S1755260AbeCSE32 (ORCPT + 99 others); Mon, 19 Mar 2018 00:29:28 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:49952 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754511AbeCSE3Y (ORCPT ); Mon, 19 Mar 2018 00:29:24 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id E54446055B; Mon, 19 Mar 2018 04:29:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521433763; bh=9SMar1cKRfBt2A8YGoK2QOjbtXwk3hs/0fMj1XrHH24=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=UMvHXL3+q7U9d5kJxjU5V+u8UzgRSVIMLJU3xxr9jDxC54bWXZ1J+bzhK3Y1o/niQ xTEQWivnAKwyh7Ci6i61mSlsFsE5xOWPsEz7cxKtuMa6D8u41u3oOAMXjPOMkEXoOW GoMbckjGSHVDl+SJbfAL97v+q40YfClxVZY4V7u8= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from [192.168.2.11] (unknown [183.83.202.249]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: cpandya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 4F8FD6055B; Mon, 19 Mar 2018 04:29:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521433762; bh=9SMar1cKRfBt2A8YGoK2QOjbtXwk3hs/0fMj1XrHH24=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=Fm+2jpmnpVMWcsFjHwHpbhGWadMLPsv+aDNPdtXpaN2BNWGn1DL8l+tXWDTDdpe71 wJlXMpLjMRDirAaA2nhm7RkXEhi63HciKHMgpJo4tYIKjsDsAl5Di8ZlFc6rOqeE+L b8oYDBtLtnEYgXwgK9ifDKf4hqmMP0K91aM5OEBk= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 4F8FD6055B Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=cpandya@codeaurora.org Subject: Re: [PATCH v2 3/4] arm64: Implement page table free interfaces To: Mark Rutland 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 References: <1521117906-20107-1-git-send-email-cpandya@codeaurora.org> <1521117906-20107-4-git-send-email-cpandya@codeaurora.org> <20180315131846.sfpxg3xlpjii3nju@lakrids.cambridge.arm.com> From: Chintan Pandya Message-ID: Date: Mon, 19 Mar 2018 09:59:15 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180315131846.sfpxg3xlpjii3nju@lakrids.cambridge.arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/15/2018 6:48 PM, Mark Rutland wrote: > 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. Right. I'll send v3 and ensure this. Thinking like, we can invalidate page table in PMD case and invalidate range if it's pud. Will see if that also can be optimized. > > 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 >> Chintan -- Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project