From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD261C43381 for ; Fri, 8 Mar 2019 08:38:12 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AFA0920811 for ; Fri, 8 Mar 2019 08:38:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="RjtknPgV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AFA0920811 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Message-Id:In-Reply-To:MIME-Version: References:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EXVBZiMP/m7oQIOtLaUFS7vF9ajmUHbdS7isBP1p+74=; b=RjtknPgVKTRy9p Eednb5qcxJiqxqwIyiDAA5Wjie7mYNGlDXwKBpeHX/R9bawaIsaqi+acEr2aSqAAvl3JR3mzzr64N aq+gDs4dV7uKEja7uRErgiCgx15eV9KfD0ETOcIGKc2hjmj8V9IMCbvRj7eS7JvripOLkSAMHYzZr X7uCBQCgroJAiAcVYgyS2rvE7WXOESMMMOjm1Hw7yOIatfNjYwe14+bEYX1o02TCqNkxUfrpAOJmV Sv63RqzNWMMNxI+6jwjl4v8jwwK96GKgDLpa/t4eUoT+6fn/bDuGy5/U/mETygiMLEYoqErjGunWV hIPQRDKJzCmVLaotBLHQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h2B13-0007sJ-IU; Fri, 08 Mar 2019 08:38:05 +0000 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5] helo=mx0a-001b2d01.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h2B0z-0007rk-VY for linux-arm-kernel@lists.infradead.org; Fri, 08 Mar 2019 08:38:03 +0000 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x288ZKl3001503 for ; Fri, 8 Mar 2019 03:37:59 -0500 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0b-001b2d01.pphosted.com with ESMTP id 2r3kqbude8-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 08 Mar 2019 03:37:59 -0500 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 8 Mar 2019 08:37:57 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 8 Mar 2019 08:37:50 -0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x288bnKj60686356 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 8 Mar 2019 08:37:49 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 281C15204F; Fri, 8 Mar 2019 08:37:49 +0000 (GMT) Received: from rapoport-lnx (unknown [9.148.204.28]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTPS id EF93D52052; Fri, 8 Mar 2019 08:37:46 +0000 (GMT) Date: Fri, 8 Mar 2019 10:37:45 +0200 From: Mike Rapoport To: Steven Price Subject: Re: [PATCH v4 04/19] powerpc: mm: Add p?d_large() definitions References: <20190306155031.4291-1-steven.price@arm.com> <20190306155031.4291-5-steven.price@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190306155031.4291-5-steven.price@arm.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-TM-AS-GCONF: 00 x-cbid: 19030808-0028-0000-0000-0000035189F9 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19030808-0029-0000-0000-0000240FFED7 Message-Id: <20190308083744.GA6592@rapoport-lnx> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-03-08_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903080062 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190308_003802_136382_B86E1BBB X-CRM114-Status: GOOD ( 31.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Peter Zijlstra , Benjamin Herrenschmidt , Dave Hansen , Will Deacon , linux-mm@kvack.org, Paul Mackerras , "H. Peter Anvin" , "Liang, Kan" , Michael Ellerman , x86@kernel.org, Ingo Molnar , Catalin Marinas , Arnd Bergmann , kvm-ppc@vger.kernel.org, =?iso-8859-1?B?Suly9G1l?= Glisse , Borislav Petkov , Andy Lutomirski , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , linux-kernel@vger.kernel.org, James Morse , linuxppc-dev@lists.ozlabs.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Mar 06, 2019 at 03:50:16PM +0000, Steven Price wrote: > walk_page_range() is going to be allowed to walk page tables other than > those of user space. For this it needs to know when it has reached a > 'leaf' entry in the page tables. This information is provided by the > p?d_large() functions/macros. > > For powerpc pmd_large() was already implemented, so hoist it out of the > CONFIG_TRANSPARENT_HUGEPAGE condition and implement the other levels. > > Also since we now have a pmd_large always implemented we can drop the > pmd_is_leaf() function. > > CC: Benjamin Herrenschmidt > CC: Paul Mackerras > CC: Michael Ellerman > CC: linuxppc-dev@lists.ozlabs.org > CC: kvm-ppc@vger.kernel.org > Signed-off-by: Steven Price > --- > arch/powerpc/include/asm/book3s/64/pgtable.h | 30 ++++++++++++++------ There is one more definition of pmd_large() in arch/powerpc/include/asm/pgtable.h > arch/powerpc/kvm/book3s_64_mmu_radix.c | 12 ++------ > 2 files changed, 24 insertions(+), 18 deletions(-) > > diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h > index c9bfe526ca9d..c4b29caf2a3b 100644 > --- a/arch/powerpc/include/asm/book3s/64/pgtable.h > +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h > @@ -907,6 +907,12 @@ static inline int pud_present(pud_t pud) > return (pud_raw(pud) & cpu_to_be64(_PAGE_PRESENT)); > } > > +#define pud_large pud_large > +static inline int pud_large(pud_t pud) > +{ > + return !!(pud_raw(pud) & cpu_to_be64(_PAGE_PTE)); > +} > + > extern struct page *pud_page(pud_t pud); > extern struct page *pmd_page(pmd_t pmd); > static inline pte_t pud_pte(pud_t pud) > @@ -954,6 +960,12 @@ static inline int pgd_present(pgd_t pgd) > return (pgd_raw(pgd) & cpu_to_be64(_PAGE_PRESENT)); > } > > +#define pgd_large pgd_large > +static inline int pgd_large(pgd_t pgd) > +{ > + return !!(pgd_raw(pgd) & cpu_to_be64(_PAGE_PTE)); > +} > + > static inline pte_t pgd_pte(pgd_t pgd) > { > return __pte_raw(pgd_raw(pgd)); > @@ -1107,6 +1119,15 @@ static inline bool pmd_access_permitted(pmd_t pmd, bool write) > return pte_access_permitted(pmd_pte(pmd), write); > } > > +#define pmd_large pmd_large > +/* > + * returns true for pmd migration entries, THP, devmap, hugetlb > + */ > +static inline int pmd_large(pmd_t pmd) > +{ > + return !!(pmd_raw(pmd) & cpu_to_be64(_PAGE_PTE)); > +} > + > #ifdef CONFIG_TRANSPARENT_HUGEPAGE > extern pmd_t pfn_pmd(unsigned long pfn, pgprot_t pgprot); > extern pmd_t mk_pmd(struct page *page, pgprot_t pgprot); > @@ -1133,15 +1154,6 @@ pmd_hugepage_update(struct mm_struct *mm, unsigned long addr, pmd_t *pmdp, > return hash__pmd_hugepage_update(mm, addr, pmdp, clr, set); > } > > -/* > - * returns true for pmd migration entries, THP, devmap, hugetlb > - * But compile time dependent on THP config > - */ > -static inline int pmd_large(pmd_t pmd) > -{ > - return !!(pmd_raw(pmd) & cpu_to_be64(_PAGE_PTE)); > -} > - > static inline pmd_t pmd_mknotpresent(pmd_t pmd) > { > return __pmd(pmd_val(pmd) & ~_PAGE_PRESENT); > diff --git a/arch/powerpc/kvm/book3s_64_mmu_radix.c b/arch/powerpc/kvm/book3s_64_mmu_radix.c > index 1b821c6efdef..040db20ac2ab 100644 > --- a/arch/powerpc/kvm/book3s_64_mmu_radix.c > +++ b/arch/powerpc/kvm/book3s_64_mmu_radix.c > @@ -363,12 +363,6 @@ static void kvmppc_pte_free(pte_t *ptep) > kmem_cache_free(kvm_pte_cache, ptep); > } > > -/* Like pmd_huge() and pmd_large(), but works regardless of config options */ > -static inline int pmd_is_leaf(pmd_t pmd) > -{ > - return !!(pmd_val(pmd) & _PAGE_PTE); > -} > - > static pmd_t *kvmppc_pmd_alloc(void) > { > return kmem_cache_alloc(kvm_pmd_cache, GFP_KERNEL); > @@ -455,7 +449,7 @@ static void kvmppc_unmap_free_pmd(struct kvm *kvm, pmd_t *pmd, bool full, > for (im = 0; im < PTRS_PER_PMD; ++im, ++p) { > if (!pmd_present(*p)) > continue; > - if (pmd_is_leaf(*p)) { > + if (pmd_large(*p)) { > if (full) { > pmd_clear(p); > } else { > @@ -588,7 +582,7 @@ int kvmppc_create_pte(struct kvm *kvm, pgd_t *pgtable, pte_t pte, > else if (level <= 1) > new_pmd = kvmppc_pmd_alloc(); > > - if (level == 0 && !(pmd && pmd_present(*pmd) && !pmd_is_leaf(*pmd))) > + if (level == 0 && !(pmd && pmd_present(*pmd) && !pmd_large(*pmd))) > new_ptep = kvmppc_pte_alloc(); > > /* Check if we might have been invalidated; let the guest retry if so */ > @@ -657,7 +651,7 @@ int kvmppc_create_pte(struct kvm *kvm, pgd_t *pgtable, pte_t pte, > new_pmd = NULL; > } > pmd = pmd_offset(pud, gpa); > - if (pmd_is_leaf(*pmd)) { > + if (pmd_large(*pmd)) { > unsigned long lgpa = gpa & PMD_MASK; > > /* Check if we raced and someone else has set the same thing */ > -- > 2.20.1 > -- Sincerely yours, Mike. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel