Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp982493imm; Wed, 6 Jun 2018 08:44:58 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLhBTuSri5wgnZU8nL30818pW58hU9S7bMnwlkmTbunncGZNmITnQmSRwW+T951b0eae/KG X-Received: by 2002:a65:5143:: with SMTP id g3-v6mr2969573pgq.190.1528299898118; Wed, 06 Jun 2018 08:44:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528299898; cv=none; d=google.com; s=arc-20160816; b=aXzAl6sy9UeH1xxmaOBFdoFaNlvnlU/onDyrOgPL5FNJJowIdTVLqALaCl89ecEN5a HtWOllKDVuAorx3bA7+WPW2AcvHKNtaihn0RVikve4U2p0qVyaKjZoAjY4CiBbmsJqIg oeJVNt2q+HmSOEUCch3vRgo2lploOFo72Y6npDta25XP5b6yg3W7njyRRB/fGs3TCFoH 10AaTyIssl4Hz3/y/G+GrkTXtCuphuJgdXU67rVaPcNrRWkn/HnzizTegqabbxgYc/T2 RnEtU+6vH/+UnzCFxuH8x1duFBihPPCWx46tAaTnECkJZuupF5AX61L5d1Vqk245VHsf yxug== 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=n5h9Z1pQKjstC8yziXXq9yP4cSrro4enbyPUWOUoMoA=; b=jf0lEhrJXlEuNMz5e/P6o7CTsFWsDuiw9dUaIoo7ih5mO4qqIgmUwVDBmjS89eoNol tSoMO3171qeHRUk2Xeu8d7hlg9uU60V4AhRCbxMZC6BjKDKrgruZPcs9c/KOUNDuDL6q krH67gtec7Ppm0WPvdy1HOdVSJC+TYxP1fOm9c6xBGxupNbrPFZ7j4WsantpKeuHimUc QGVsD62zV0wUzzCHxLTjVUZI56eLq0wapVUS6V2lZFgCGBdrCC1vaARXCTOjTGOlEVj6 1b9G+Ln4lI87vlJawcn2l8Gic7F5ig9KESoKWjS/DQDLMoJ0bvgeG6KQXi3+uy2kvGr1 hvXw== 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 z3-v6si51028858plb.246.2018.06.06.08.44.43; Wed, 06 Jun 2018 08:44:58 -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 S1752789AbeFFPoS (ORCPT + 99 others); Wed, 6 Jun 2018 11:44:18 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:42246 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752067AbeFFPoQ (ORCPT ); Wed, 6 Jun 2018 11:44:16 -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 3DE5B15B2; Wed, 6 Jun 2018 08:44:16 -0700 (PDT) Received: from edgewater-inn.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 100063F25D; Wed, 6 Jun 2018 08:44:16 -0700 (PDT) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id 0A8CB1AE53AB; Wed, 6 Jun 2018 16:44:48 +0100 (BST) Date: Wed, 6 Jun 2018 16:44:48 +0100 From: Will Deacon To: Chintan Pandya Cc: catalin.marinas@arm.com, mark.rutland@arm.com, akpm@linux-foundation.org, toshi.kani@hpe.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v13 3/3] arm64: Implement page table free interfaces Message-ID: <20180606154447.GG6631@arm.com> References: <1528268481-19299-1-git-send-email-cpandya@codeaurora.org> <1528268481-19299-4-git-send-email-cpandya@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1528268481-19299-4-git-send-email-cpandya@codeaurora.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 06, 2018 at 12:31:21PM +0530, Chintan Pandya wrote: > arm64 requires break-before-make. Originally, before > setting up new pmd/pud entry for huge mapping, in few > cases, the modifying pmd/pud entry was still valid > and pointing to next level page table as we only > clear off leaf PTE in unmap leg. > > a) This was resulting into stale entry in TLBs (as few > TLBs also cache intermediate mapping for performance > reasons) > b) Also, modifying pmd/pud was the only reference to > next level page table and it was getting lost without > freeing it. So, page leaks were happening. > > Implement pud_free_pmd_page() and pmd_free_pte_page() to > enforce BBM and also free the leaking page tables. > > Implementation requires, > 1) Clearing off the current pud/pmd entry > 2) Invalidation of TLB > 3) Freeing of the un-used next level page tables > > Signed-off-by: Chintan Pandya > --- > arch/arm64/mm/mmu.c | 48 ++++++++++++++++++++++++++++++++++++++++++++---- > 1 file changed, 44 insertions(+), 4 deletions(-) Thanks, I think this looks really good now: Reviewed-by: Will Deacon Will