Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp662171pxb; Thu, 5 Nov 2020 09:37:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJzoLoL33czmB9iLy1JbPHaZaNxxHDF4/o0i4wGIjjmGbL+K3J+zxF0C/AdhkbFd75v1jYTd X-Received: by 2002:a17:906:3087:: with SMTP id 7mr3374327ejv.375.1604597874631; Thu, 05 Nov 2020 09:37:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604597874; cv=none; d=google.com; s=arc-20160816; b=k+bMvzkYB9zkTYYG4oDNqff+MjSGrv9hRpbI4wgm9pXp14GL3fdyvC45kYXqvz8qbq hO2jyBqO9y8PjOpD3v08TVtdnFLEr2IqCVedWFzrvu7SUhIzknesq4WlGJ8EG0a2YOvm bFiqEniqAKrzzHpSxXRrWZEVOyxOr1r+DTtXjj2zPjKXjAvA1Jv+2SxPd6GWGxCBSaz+ ZbSGIlkCiOYdLfQOcSZpeSAILCicqDRkghqK8QXOlBpcdDbYmPmnu8F0W7IWnh+0q71E 0o7TcD6EdVSFDg/PzlEbRiuUEEInpCjzFl8evqShThKgod2RZQtnC0MQfClkp54+ltro Oapw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature; bh=smObYvB7UrNcMPo3P/gpfiQDzpAY2JnzU7bqWocm15Q=; b=VpJN3bpjDb2XoQ4bAMHZ9WPng/Iwj1EZ9fndYAwiXpZzQlWxvHNBv+wDi+P7WBR6QG LB0KaGPra5WV0JPLOzBpId70NR0SWGD3hTP9OmeeUpzNVr7570byfBWThuF8Rud2Nf3q TtXxv645Q4+Ze0phTXhTXZOjaQK76hLodoUuS5RX/08xTEtphGvr2APeheVwTVtZrYmT We/58QblckQqcGhT/2yf+5f64Y8zOJYmaQ1FqKTi2DrK7oON9fuMuo5Hgt2LuyLezWkC miXedbmJG0ASO0LYrsmSgZeZadWJuwKdqyzijS/q3L57SdjKp9o0A+FDwOrdmkwQgnJh r75Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dabbelt-com.20150623.gappssmtp.com header.s=20150623 header.b="TjFj1/11"; 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 fy25si1592181ejb.455.2020.11.05.09.37.31; Thu, 05 Nov 2020 09:37:54 -0800 (PST) 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=@dabbelt-com.20150623.gappssmtp.com header.s=20150623 header.b="TjFj1/11"; 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 S1731779AbgKEReO (ORCPT + 99 others); Thu, 5 Nov 2020 12:34:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731710AbgKEReE (ORCPT ); Thu, 5 Nov 2020 12:34:04 -0500 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E769C0613D2 for ; Thu, 5 Nov 2020 09:34:04 -0800 (PST) Received: by mail-pl1-x644.google.com with SMTP id u2so1104571pls.10 for ; Thu, 05 Nov 2020 09:34:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20150623.gappssmtp.com; s=20150623; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=smObYvB7UrNcMPo3P/gpfiQDzpAY2JnzU7bqWocm15Q=; b=TjFj1/11pI29VIxZ1hX/0ytTD/fL3xmC/oL//nL63LWvJR5eahIyyvYJPYizEzEYbW +ZIL6Cuyh8F/whBD+ZbeZf4kMz8/xJOxHoG7r7oTfm7+TAWnnZ2GLA1Y1wcnVNxfz+j7 z38KrSTxH7D4GKklTAbc+uTZDAs4B1P+6fWBT+USAe0xjB6giWYn4015KsT4/jFSSGiA Goa3O+kEbmKS6i/5UIsMV9JJiYbVtn+RhThQ4jKQOsMog2t3c3Hcq6qq0WxorJZQLk1Y RRsFPzzQlbeWAKHMGx1iePrEx52qWxy3gYNE97jw6b7Fo4yz1vEShr9rbZ5rqR35+W6q 150A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=smObYvB7UrNcMPo3P/gpfiQDzpAY2JnzU7bqWocm15Q=; b=oVaOoZML30TtuPAs4qWeNVzzGrbS5rJamLOqQhhe99z17PlLLBJwP+jAeUV1NiQOiS mNbv60MpSm1o0fOfcyyhP0onArMvx82wzgiY5JqRRzQXGlaKFPekvFF56MDj4NiQXciW uOaBpI5Moy0nfzI3uYwaf/5fVeuuHGl0txaBD/DCIar5GaBu5/aSjN/u3EPOgcVkYlCj e2x/m5+XZVxSq65US1U4FRyuMG2LpW7LCU/+Xguo3/gdWV2zyoJgg29Il+xQ1/Eaj70I 83BNfBd0LGLEd/2fDIUQZq/LBYJPk82WUmLi1rd60BtgQPoFEFkROHYSzCFiGa1N8GMg d/ZQ== X-Gm-Message-State: AOAM533R0HFveM1mi+YHt0wMkERolxiAheHN74ltc7E0qJJNwMur5FDJ P7gUqRedfYDIlMc/x4iYbL0IS4gLulagYQ== X-Received: by 2002:a17:902:8f88:b029:d6:d62c:e437 with SMTP id z8-20020a1709028f88b02900d6d62ce437mr3221904plo.73.1604597643292; Thu, 05 Nov 2020 09:34:03 -0800 (PST) Received: from localhost (76-210-143-223.lightspeed.sntcca.sbcglobal.net. [76.210.143.223]) by smtp.gmail.com with ESMTPSA id h184sm3022962pfe.161.2020.11.05.09.34.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Nov 2020 09:34:02 -0800 (PST) Date: Thu, 05 Nov 2020 09:34:02 -0800 (PST) X-Google-Original-Date: Wed, 04 Nov 2020 14:28:21 PST (-0800) Subject: Re: [PATCH v4 4/5] riscv: Add support pte_protnone and pmd_protnone if CONFIG_NUMA_BALANCING In-Reply-To: <20201006001752.248564-5-atish.patra@wdc.com> CC: linux-kernel@vger.kernel.org, greentime.hu@sifive.com, aou@eecs.berkeley.edu, akpm@linux-foundation.org, anshuman.khandual@arm.com, anup@brainfault.org, Arnd Bergmann , Atish Patra , catalin.marinas@arm.com, david@redhat.com, Greg KH , justin.he@arm.com, Jonathan.Cameron@huawei.com, wangkefeng.wang@huawei.com, linux-arch@vger.kernel.org, linux-riscv@lists.infradead.org, rppt@kernel.org, nsaenzjulienne@suse.de, Paul Walmsley , rafael@kernel.org, steven.price@arm.com, will@kernel.org, zong.li@sifive.com, linux-arm-kernel@lists.infradead.org From: Palmer Dabbelt To: Atish Patra Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 05 Oct 2020 17:17:51 PDT (-0700), 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) > { Reviewed-by: Palmer Dabbelt