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=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 19B95C5DF60 for ; Thu, 7 Nov 2019 04:44:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C3E502187F for ; Thu, 7 Nov 2019 04:44:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C3E502187F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4555A6B000A; Wed, 6 Nov 2019 23:44:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 435BA6B000C; Wed, 6 Nov 2019 23:44:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 342DA6B000D; Wed, 6 Nov 2019 23:44:21 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0244.hostedemail.com [216.40.44.244]) by kanga.kvack.org (Postfix) with ESMTP id 20A8E6B000A for ; Wed, 6 Nov 2019 23:44:21 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id AEF9C2C9D for ; Thu, 7 Nov 2019 04:44:20 +0000 (UTC) X-FDA: 76128239880.26.name60_7d1a0f069040b X-HE-Tag: name60_7d1a0f069040b X-Filterd-Recvd-Size: 7156 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf15.hostedemail.com (Postfix) with ESMTP for ; Thu, 7 Nov 2019 04:44:19 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 867FF7A7; Wed, 6 Nov 2019 20:44:18 -0800 (PST) Received: from [10.163.1.1] (unknown [10.163.1.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C69DD3F71A; Wed, 6 Nov 2019 20:43:56 -0800 (PST) Subject: Re: [PATCH V8] mm/debug: Add tests validating architecture page table helpers To: Vineet Gupta , "linux-mm@kvack.org" , Andrew Morton Cc: Vlastimil Babka , Greg Kroah-Hartman , Thomas Gleixner , Mike Rapoport , Jason Gunthorpe , Dan Williams , Peter Zijlstra , Michal Hocko , Mark Rutland , Mark Brown , Steven Price , Ard Biesheuvel , Masahiro Yamada , Kees Cook , Tetsuo Handa , Matthew Wilcox , Sri Krishna chowdary , Dave Hansen , Russell King - ARM Linux , Michael Ellerman , Paul Mackerras , Martin Schwidefsky , Heiko Carstens , "David S. Miller" , James Hogan , Paul Burton , Ralf Baechle , "Kirill A . Shutemov" , Gerald Schaefer , Christophe Leroy , Ingo Molnar , "linux-snps-arc@lists.infradead.org" , "linux-mips@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-ia64@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-s390@vger.kernel.org" , "linux-sh@vger.kernel.org" , "sparclinux@vger.kernel.org" , "x86@kernel.org" , "linux-kernel@vger.kernel.org" References: <1572240562-23630-1-git-send-email-anshuman.khandual@arm.com> From: Anshuman Khandual Message-ID: Date: Thu, 7 Nov 2019 10:14:30 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 11/06/2019 11:37 PM, Vineet Gupta wrote: > On 11/5/19 7:03 PM, Anshuman Khandual wrote: >> But should not pfn_pmd() be encapsulated inside HAVE_ARCH_TRANSPARENT_= HUGEPAGE >> at the minimum (but I would say it should be available always, nonethe= less) when >> the platform subscribes to THP irrespective of whether THP is enabled = or not. >=20 > For ARC it was only introduced/needed when I added THP support so it is= dependent > in some way. Right, it is dependent. >=20 >> I could see in the file (arch/arc/include/asm/pgtable.h) that fetching= pfn_pmd() >> and all other basic PMD definitions is conditional on CONFIG_TRANSPARE= NT_HUGEPAGE. >> >> #ifdef CONFIG_TRANSPARENT_HUGEPAGE >> #include >> #endif >> >> IIUC, CONFIG_TRANSPARENT_HUGEPAGE should only encapsulate PMD page tab= le helpers >> which are expected from generic THP code (pmd_trans_huge, pmdp_set_acc= ess_flags >> etc) but not the basic PMD helpers like pmd_pfn, pmd_mkyoung, pmd_mkdi= rty, >> pmd_mkclean etc.=20 >=20 > ARC only has 2 levels of paging, so these don't make any sense in gener= al and > needed only for THP case. > I case of arch/arm you see it is only defined in pgtable-3level.h There is no uniformity for all these across architectures. It has been bi= t difficult to get some of these required helpers right (compile and run) o= n different platforms. >=20 >> Hence wondering will it be possible to accommodate following >> code change on arc platform (not even compiled) in order to fix the pr= oblem ? >=20 > I'm open to making changes in ARC code but lets do the right thing. >=20 >> */ >> -#ifdef CONFIG_TRANSPARENT_HUGEPAGE >> +#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE >> #include >> #endif >=20 > This in wrong.=C2=A0 CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE is a just a = glue toggle, > used only in Kconfig files (and not in any "C" code).=C2=A0 It enables = generic Kconfig > code to allow visibility of CONFIG_TRANSPARENT_HUGEPAGE w/o every arch = needing to > do a me too. >=20 > I think you need to use CONFIG_TRANSPARENT_HUGEPAGE to guard appropriat= e tests. I > understand that it only We can probably replace CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE wrapper wit= h CONFIG_TRANSPARENT_HUGEPAGE. But CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PU= D explicitly depends on CONFIG_TRANSPARENT_HUGEPAGE as a prerequisite. Coul= d you please confirm if the following change on this test will work on ARC platform for both THP and !THP cases ? Thank you. diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c index 621ac09..99ebc7c 100644 --- a/mm/debug_vm_pgtable.c +++ b/mm/debug_vm_pgtable.c @@ -67,7 +67,7 @@ static void __init pte_basic_tests(unsigned long pfn, p= gprot_t prot) WARN_ON(pte_write(pte_wrprotect(pte))); } =20 -#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE +#ifdef CONFIG_TRANSPARENT_HUGEPAGE static void __init pmd_basic_tests(unsigned long pfn, pgprot_t prot) { pmd_t pmd =3D pfn_pmd(pfn, prot); @@ -85,9 +85,6 @@ static void __init pmd_basic_tests(unsigned long pfn, p= gprot_t prot) */ WARN_ON(!pmd_bad(pmd_mkhuge(pmd))); } -#else -static void __init pmd_basic_tests(unsigned long pfn, pgprot_t prot) { } -#endif =20 #ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD static void __init pud_basic_tests(unsigned long pfn, pgprot_t prot) @@ -112,6 +109,10 @@ static void __init pud_basic_tests(unsigned long pfn= , pgprot_t prot) #else static void __init pud_basic_tests(unsigned long pfn, pgprot_t prot) { } #endif +#else +static void __init pmd_basic_tests(unsigned long pfn, pgprot_t prot) { } +static void __init pud_basic_tests(unsigned long pfn, pgprot_t prot) { } +#endif =20 static void __init p4d_basic_tests(unsigned long pfn, pgprot_t prot) { > -Vineet >=20