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.3 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 C8C79C5DF60 for ; Fri, 8 Nov 2019 04:27:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 571CC2178F for ; Fri, 8 Nov 2019 04:27:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 571CC2178F 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 A89906B0005; Thu, 7 Nov 2019 23:27:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A39D16B0006; Thu, 7 Nov 2019 23:27:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 977286B0007; Thu, 7 Nov 2019 23:27:03 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0231.hostedemail.com [216.40.44.231]) by kanga.kvack.org (Postfix) with ESMTP id 820DE6B0005 for ; Thu, 7 Nov 2019 23:27:03 -0500 (EST) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id E2521181AEF15 for ; Fri, 8 Nov 2019 04:27:02 +0000 (UTC) X-FDA: 76131825084.24.screw08_2054845da5745 X-HE-Tag: screw08_2054845da5745 X-Filterd-Recvd-Size: 7591 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Fri, 8 Nov 2019 04:27:02 +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 EFEA630E; Thu, 7 Nov 2019 20:27:00 -0800 (PST) Received: from [10.163.1.237] (unknown [10.163.1.237]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0B3AF3F6C4; Thu, 7 Nov 2019 20:26:43 -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: Fri, 8 Nov 2019 09:57:18 +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/08/2019 12:35 AM, Vineet Gupta wrote: > On 11/6/19 8:44 PM, Anshuman Khandual wrote: >> >>> >>>> */ >>>> -#ifdef CONFIG_TRANSPARENT_HUGEPAGE >>>> +#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE >>>> #include >>>> #endif >>> 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 enable= s generic Kconfig >>> code to allow visibility of CONFIG_TRANSPARENT_HUGEPAGE w/o every arc= h needing to >>> do a me too. >>> >>> I think you need to use CONFIG_TRANSPARENT_HUGEPAGE to guard appropri= ate tests. I >>> understand that it only >> We can probably replace CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE wrapper = with >> CONFIG_TRANSPARENT_HUGEPAGE. But CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE= _PUD >> explicitly depends on CONFIG_TRANSPARENT_HUGEPAGE as a prerequisite. C= ould >> you please confirm if the following change on this test will work on A= RC >> 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= , pgprot_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= , pgprot_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 > Fails to build for THP case since >=20 > CONFIG_TRANSPARENT_HUGEPAGE=3Dy > CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD=3Dn >=20 > ../mm/debug_vm_pgtable.c:112:20: error: redefinition of =E2=80=98pmd_ba= sic_tests=E2=80=99 >=20 Hmm, really ? With arm64 defconfig we have the same default combination where it builds. CONFIG_TRANSPARENT_HUGEPAGE=3Dy CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=3Dy CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD=3Dn /* It should not even appea= r */ With the above change, we have now #ifdef CONFIG_TRANSPARENT_HUGEPAGE static void __init pmd_basic_tests(unsigned long pfn, pgprot_t prot) { ---- ---- } #ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD static void __init pud_basic_tests(unsigned long pfn, pgprot_t prot) { ---- ---- } #else /* !CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD */ static void __init pud_basic_tests(unsigned long pfn, pgprot_t prot) { } #endif #else /* !CONFIG_TRANSPARENT_HUGEPAGE */ 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 When !CONFIG_TRANSPARENT_HUGEPAGE - Dummy definitions for pmd_basic_tests() and pud_basic_tests() When CONFIG_TRANSPARENT_HUGEPAGE and !CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPA= GE_PUD - Actual pmd_basic_tests() and dummy pud_basic_tests() When CONFIG_TRANSPARENT_HUGEPAGE and CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAG= E_PUD - Actual pmd_basic_tests() and pud_basic_tests() Tested this on arm64 which does not have CONFIG_HAVE_ARCH_TRANSPARENT_HUG= EPAGE_PUD for THP and !THP and on x86 which has CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPA= GE_PUD for THP and !THP which basically covered all combination for these config= s. Is there something I am still missing in plain sight :) - Anshuman