Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp5418306pxu; Thu, 22 Oct 2020 01:32:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZjOefaCyBKPBYEk1kQZyLt4jwOIb6CgojUjP3RUn5hVtzElJs9MIhfJof2rdMt8ohrvuR X-Received: by 2002:a17:906:1314:: with SMTP id w20mr1168130ejb.279.1603355528469; Thu, 22 Oct 2020 01:32:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603355528; cv=none; d=google.com; s=arc-20160816; b=pTGs83x6Co2kuyZ71mMRIjuOtG+qWErmm7tJhTEwRT6zSI92tZloCLfXj6g5ZoQEh9 bFkyuIR2LvncSRCH8NL9RjU2si1juIxB+KcrkM5Z90dv7sxmjAKHW7DrPQzy4bRsVtVc hZ8sGi2Kj75qXMXtStsDoTHQwAKECjo9FrtWmBPga+sF3Rtj0UYv+WnLtLThOBEZmLKg u1s/dTbu5otNXyXesjX18bBk1Zv+5yKf7/VrKh9m6H4zmXxh8EEB0NsNUaBZr0tz0G7j Uqg1DaibOyZliZIp9/ew9dKTw69iqGBMdzyxxo/fpuL3RMOcitoLyQb7zRhGOSF6DzmW sCrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=73Kve3eCD9lFW3ilOeR8Q08ZRzYRtk6HhqwKqUbeckQ=; b=NzBismcYsFGtXLuihIeIomiCY92TXxlQWqgny4gVL+4yd8w94G0jOj6eBZtMZv19CK DGnGwL1bSDgD4HtRikHqOE/dxxU1OtQlyjpX1ruJUAoKfxN/RFxNpY/pRYa8WIJxIRV5 ORHErXiaFg4M1BcworW5FPTrmEbPig5M8ahPQSdgCRjHEM//YjLnqRMiz6W80rX3CeY3 g/hqHTRp9xGtd6Y6LR0KYaSvYH591T00CCmTprMt3U/k6GKLf8UX335JewylTOjluWJY nWwQ2A5V942/5dw/tpHHDIaP7Fduxuw4MBjoVR9Rwl0y8tssVBqGT7XZRdR76IsnL8EM RvZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=SltHHrVl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q16si445557ejr.545.2020.10.22.01.31.46; Thu, 22 Oct 2020 01:32:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=SltHHrVl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2507983AbgJVFiz (ORCPT + 99 others); Thu, 22 Oct 2020 01:38:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2444515AbgJVFiy (ORCPT ); Thu, 22 Oct 2020 01:38:54 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFDC3C0613CE for ; Wed, 21 Oct 2020 22:38:52 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id k18so522631wmj.5 for ; Wed, 21 Oct 2020 22:38:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=73Kve3eCD9lFW3ilOeR8Q08ZRzYRtk6HhqwKqUbeckQ=; b=SltHHrVlBKjJCfSt8WOzpbmWAyyApuzoEfOWBWk7w1rI4ddOMh3Jq3VYGO6SDozaCi qbhKgg+BGotFSLTM3VTwCagdIHZtGQZ0qJfb8YTKuuAMgpSQTOKj52jRrdmipBKo10IT 7+IQukUEWnptNNCdytAifO1CErMOIHDbTXJXhjMOjlqbGSzttrbK689GXJYOm0n7wUPN 7n6M2HFMlorVQqLiU+y1EPf5WjXsACSieJ6qr3wGLpT7RaSZwdP9ITxTxW9sN/3RQF5B 9WwtjZBkREl4Z202ODJZ5nh5u9I1Vuq9TnHTOFjI2bl56AiCSh02aUn6m6OBM5pfFhVi C3KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=73Kve3eCD9lFW3ilOeR8Q08ZRzYRtk6HhqwKqUbeckQ=; b=sGVtRpraTfw1o6Q0/xOrVOGVQ+nw1RLv3UH7II7lMRdM2pU3tY/UXLdSzxqkV3bBbv 4X0q+5VWJWJhui0oxnL6eDRkB9Wj3YwRnnNcyksXP2xCrk89nv0JcLYkj/wfWQJYC9EW a9mkRn86Ti4NGPvkfyM1uwMrb63JbCb1E33BZkojtce7ZpBlcaRH3SeV8ILxXIxWt54W tE1+bP8zUxl3ayJdyJ54Z9luRS6f0PxSJjpirLcqmMiqaJzu9hoNCubWFLtRJsABL+rE Exx0M+pSEcngOqrd+k6J2zUsfXbnFe1iGMOOABjZFYIT0STJFFJbCbPDqkLOKsSLcsY/ 7P9Q== X-Gm-Message-State: AOAM530dWatXBLBNe386Fhe5Kn5pu4v58vdTnUZRp2gZLwaet/oW7Neg rbLpB0hEKL8wa9FwURG9MZt3bs6Z6swwhv0o8YQVZg== X-Received: by 2002:a7b:c92c:: with SMTP id h12mr834132wml.134.1603345131488; Wed, 21 Oct 2020 22:38:51 -0700 (PDT) MIME-Version: 1.0 References: <20201006001752.248564-1-atish.patra@wdc.com> <20201006001752.248564-5-atish.patra@wdc.com> In-Reply-To: <20201006001752.248564-5-atish.patra@wdc.com> From: Anup Patel Date: Thu, 22 Oct 2020 11:08:39 +0530 Message-ID: Subject: Re: [PATCH v4 4/5] riscv: Add support pte_protnone and pmd_protnone if CONFIG_NUMA_BALANCING To: Atish Patra Cc: "linux-kernel@vger.kernel.org List" , Greentime Hu , Albert Ou , Andrew Morton , Anshuman Khandual , Arnd Bergmann , Catalin Marinas , David Hildenbrand , Greg Kroah-Hartman , Jia He , Jonathan Cameron , Kefeng Wang , linux-arch@vger.kernel.org, linux-riscv , Mike Rapoport , Nicolas Saenz Julienne , Palmer Dabbelt , Paul Walmsley , "Rafael J. Wysocki" , Steven Price , Will Deacon , Zong Li , linux-arm-kernel Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 6, 2020 at 5:48 AM Atish Patra wrote: > > From: Greentime Hu > > These two functions are used to distinguish between PROT_NONENUMA > protections and hinting fault protections. > > Signed-off-by: Greentime Hu > --- > arch/riscv/include/asm/pgtable.h | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h > index 515b42f98d34..2751110675e6 100644 > --- a/arch/riscv/include/asm/pgtable.h > +++ b/arch/riscv/include/asm/pgtable.h > @@ -183,6 +183,11 @@ static inline unsigned long pmd_page_vaddr(pmd_t pmd) > return (unsigned long)pfn_to_virt(pmd_val(pmd) >> _PAGE_PFN_SHIFT); > } > > +static inline pte_t pmd_pte(pmd_t pmd) > +{ > + return __pte(pmd_val(pmd)); > +} > + > /* Yields the page frame number (PFN) of a page table entry */ > static inline unsigned long pte_pfn(pte_t pte) > { > @@ -286,6 +291,21 @@ static inline pte_t pte_mkhuge(pte_t pte) > return pte; > } > > +#ifdef CONFIG_NUMA_BALANCING > +/* > + * See the comment in include/asm-generic/pgtable.h > + */ > +static inline int pte_protnone(pte_t pte) > +{ > + return (pte_val(pte) & (_PAGE_PRESENT | _PAGE_PROT_NONE)) == _PAGE_PROT_NONE; > +} > + > +static inline int pmd_protnone(pmd_t pmd) > +{ > + return pte_protnone(pmd_pte(pmd)); > +} > +#endif > + > /* Modify page protection bits */ > static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) > { > -- > 2.25.1 > Looks good to me. Reviewed-by: Anup Patel Regards, Anup