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 EB8E2C5DF60 for ; Thu, 7 Nov 2019 08:32:19 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (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 A10DB21D79 for ; Thu, 7 Nov 2019 08:32:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A10DB21D79 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 477xTs4WlRzF6Ct for ; Thu, 7 Nov 2019 19:32:17 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=arm.com (client-ip=217.140.110.172; helo=foss.arm.com; envelope-from=anshuman.khandual@arm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lists.ozlabs.org (Postfix) with ESMTP id 477xDp3v3pzF5mv for ; Thu, 7 Nov 2019 19:20:56 +1100 (AEDT) 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 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: 8bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , "linux-ia64@vger.kernel.org" , "linux-sh@vger.kernel.org" , Peter Zijlstra , James Hogan , Heiko Carstens , Michal Hocko , Dave Hansen , Paul Mackerras , "sparclinux@vger.kernel.org" , Dan Williams , "linux-s390@vger.kernel.org" , Jason Gunthorpe , "x86@kernel.org" , Russell King - ARM Linux , Matthew Wilcox , Steven Price , Tetsuo Handa , Gerald Schaefer , "linux-snps-arc@lists.infradead.org" , "linux-arm-kernel@lists.infradead.org" , Ingo Molnar , Kees Cook , Masahiro Yamada , Mark Brown , "Kirill A . Shutemov" , Thomas Gleixner , Vlastimil Babka , Sri Krishna chowdary , Ard Biesheuvel , Greg Kroah-Hartman , "linux-mips@vger.kernel.org" , Ralf Baechle , "linux-kernel@vger.kernel.org" , Paul Burton , Mike Rapoport , Martin Schwidefsky , "linuxppc-dev@lists.ozlabs.org" , "David S. Miller" Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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, nonetheless) when >> the platform subscribes to THP irrespective of whether THP is enabled or not. > > For ARC it was only introduced/needed when I added THP support so it is dependent > in some way. Right, it is dependent. > >> 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_TRANSPARENT_HUGEPAGE. >> >> #ifdef CONFIG_TRANSPARENT_HUGEPAGE >> #include >> #endif >> >> IIUC, CONFIG_TRANSPARENT_HUGEPAGE should only encapsulate PMD page table helpers >> which are expected from generic THP code (pmd_trans_huge, pmdp_set_access_flags >> etc) but not the basic PMD helpers like pmd_pfn, pmd_mkyoung, pmd_mkdirty, >> pmd_mkclean etc. > > ARC only has 2 levels of paging, so these don't make any sense in general 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 bit difficult to get some of these required helpers right (compile and run) on different platforms. > >> Hence wondering will it be possible to accommodate following >> code change on arc platform (not even compiled) in order to fix the problem ? > > I'm open to making changes in ARC code but lets do the right thing. > >> */ >> -#ifdef CONFIG_TRANSPARENT_HUGEPAGE >> +#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE >> #include >> #endif > > This in wrong.  CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE is a just a glue toggle, > used only in Kconfig files (and not in any "C" code).  It enables generic Kconfig > code to allow visibility of CONFIG_TRANSPARENT_HUGEPAGE w/o every arch needing to > do a me too. > > I think you need to use CONFIG_TRANSPARENT_HUGEPAGE to guard appropriate 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. Could 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, pgprot_t prot) WARN_ON(pte_write(pte_wrprotect(pte))); } -#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 = 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 #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 static void __init p4d_basic_tests(unsigned long pfn, pgprot_t prot) { > -Vineet >