Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp445556imm; Fri, 21 Sep 2018 02:56:58 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdbb4uGGsgQHkxAM+V0acJqFpU1C89VaJOj5fR1NQGk37ujtKzxlME/PVBuVZ1XtRKH36oLi X-Received: by 2002:a62:9894:: with SMTP id d20-v6mr45760122pfk.186.1537523818101; Fri, 21 Sep 2018 02:56:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537523818; cv=none; d=google.com; s=arc-20160816; b=EdOyLGolJ0OkpcvSJoJ2g2C84KMDhNWWta2DmKursHJxCrinxQuQLjeIq90M+W4K9e PaOby2KlVwZ58WJklJ3Ew19344+qzpzTf5RKCM04f+LG2PvzOHquvD7A9IcmdJmexT0N rOMc1zvG8Ygy29JJRp5uop7c8r+ISm4bFTt+i82BYIwZUxNlT0sBCbqNgL90s3ZweAkP MnQAxA7yPp+aydXEtso5obdsCaqJRNar/ZOVqiiBM+O2TC7Ya0skUEcLHheN4bEybCl9 zIrRQXpVdF+sI/MAEsfOasTk2DgTpquw/Y+AxQDZ48whkcxNAFNCkf4QtvZBegO95iYN XubA== 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; bh=07vyMoRW0zPLO35qCnHoW1nKxI31gbxagQLU+w8dcvw=; b=cuJ3OoqUcENmel3cTXliR6WH7h8ffzQU8bka/9h+wEaq+5rKQsz+lS9heALa8d8c80 7aHEtIVTURAupPL6BFrsVvoYiTvEkp7UFKgBku+beYZHL8AyEeXKsT+wJUDTMoOdxW3/ TTHTASmPy2MmfEtkIVoitHCVtPLOB8C4tPLRcI0vy4IOujP4IlfI+TirtJPXeIzWh4lI JDAXLU4vWvKgrKCcEfD9jVx8DPsogwmE5y/8/QMcv/K2Xe74vz2shSVY4jFTOBvGjo16 1//Uyu0ja726nGlCjdjb4G6qWiD04lquDpHdTzlGHeHBJpVpzp1/R9ybbV3TOl53XsT5 Apjg== 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 w133-v6si26477566pfd.313.2018.09.21.02.56.41; Fri, 21 Sep 2018 02:56: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 S2389559AbeIUPoS (ORCPT + 99 others); Fri, 21 Sep 2018 11:44:18 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:60048 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727391AbeIUPoR (ORCPT ); Fri, 21 Sep 2018 11:44:17 -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 ED44980D; Fri, 21 Sep 2018 02:56:11 -0700 (PDT) Received: from arrakis.emea.arm.com (arrakis.Emea.Arm.com [10.4.12.129]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8E8C93F5C0; Fri, 21 Sep 2018 02:56:10 -0700 (PDT) Date: Fri, 21 Sep 2018 10:56:07 +0100 From: Catalin Marinas To: Chintan Pandya Cc: mark.rutland@arm.com, toshi.kani@hpe.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v13 3/3] arm64: Implement page table free interfaces Message-ID: <20180921095607.GA166997@arrakis.emea.arm.com> References: <1528268481-19299-1-git-send-email-cpandya@codeaurora.org> <1528268481-19299-4-git-send-email-cpandya@codeaurora.org> <20180920172527.GB18934@arrakis.emea.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180920172527.GB18934@arrakis.emea.arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 20, 2018 at 06:25:29PM +0100, Catalin Marinas wrote: > On Wed, Jun 06, 2018 at 12:31:21PM +0530, Chintan Pandya wrote: > > diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c > > index 8ae5d7a..65f8627 100644 > > --- a/arch/arm64/mm/mmu.c > > +++ b/arch/arm64/mm/mmu.c > > @@ -45,6 +45,7 @@ > > #include > > #include > > #include > > +#include > > > > #define NO_BLOCK_MAPPINGS BIT(0) > > #define NO_CONT_MAPPINGS BIT(1) > > @@ -977,12 +978,51 @@ int pmd_clear_huge(pmd_t *pmdp) > > return 1; > > } > > > > -int pud_free_pmd_page(pud_t *pud, unsigned long addr) > > +int pmd_free_pte_page(pmd_t *pmdp, unsigned long addr) > > { > > - return pud_none(*pud); > > + pte_t *table; > > + pmd_t pmd; > > + > > + pmd = READ_ONCE(*pmdp); > > + > > + /* No-op for empty entry and WARN_ON for valid entry */ > > + if (!pmd_present(pmd) || !pmd_table(pmd)) { > > + VM_WARN_ON(!pmd_table(pmd)); > > + return 1; > > + } > > What's this VM_WARN_ON supposed to do here? If the pmd is 0, we trigger > it all the time. Did you actually mean something like: > > VM_WARN_ON(!pmd_none(pmd)); > > or pmd_present(pmd)? > > Since the comment mentions empty entry, I'd rather make it explicit: > > if (pmd_none(pmd) || !pmd_table(pmd)) > VM_WARN_ON(!pmd_none(pmd)); > return 1; > } Ignore this, fixed in -rc4 (fac880c7d074 "arm64: fix erroneous warnings in page freeing functions"). -- Catalin