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=-11.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 A0065C388F9 for ; Wed, 4 Nov 2020 18:02:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1B46E206F4 for ; Wed, 4 Nov 2020 18:02:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1B46E206F4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 50C556B006C; Wed, 4 Nov 2020 13:02:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4E1286B006E; Wed, 4 Nov 2020 13:02:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3F7B06B0071; Wed, 4 Nov 2020 13:02:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0110.hostedemail.com [216.40.44.110]) by kanga.kvack.org (Postfix) with ESMTP id 124916B006C for ; Wed, 4 Nov 2020 13:02:26 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id AB8DE8249980 for ; Wed, 4 Nov 2020 18:02:25 +0000 (UTC) X-FDA: 77447505450.12.honey12_2c03859272c3 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id A2FE418012887 for ; Wed, 4 Nov 2020 18:02:24 +0000 (UTC) X-HE-Tag: honey12_2c03859272c3 X-Filterd-Recvd-Size: 6150 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf17.hostedemail.com (Postfix) with ESMTP for ; Wed, 4 Nov 2020 18:02:23 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 46661AC2F; Wed, 4 Nov 2020 18:02:22 +0000 (UTC) Subject: Re: [PATCH v4 3/4] arch, mm: restore dependency of __kernel_map_pages() of DEBUG_PAGEALLOC To: Mike Rapoport , Andrew Morton Cc: Albert Ou , Andy Lutomirski , Benjamin Herrenschmidt , Borislav Petkov , Catalin Marinas , Christian Borntraeger , Christoph Lameter , "David S. Miller" , Dave Hansen , David Hildenbrand , David Rientjes , "Edgecombe, Rick P" , "H. Peter Anvin" , Heiko Carstens , Ingo Molnar , Joonsoo Kim , "Kirill A . Shutemov" , "Kirill A. Shutemov" , Len Brown , Michael Ellerman , Mike Rapoport , Palmer Dabbelt , Paul Mackerras , Paul Walmsley , Pavel Machek , Pekka Enberg , Peter Zijlstra , "Rafael J. Wysocki" , Thomas Gleixner , Vasily Gorbik , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-pm@vger.kernel.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, sparclinux@vger.kernel.org, x86@kernel.org References: <20201103162057.22916-1-rppt@kernel.org> <20201103162057.22916-4-rppt@kernel.org> From: Vlastimil Babka Message-ID: Date: Wed, 4 Nov 2020 19:02:20 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20201103162057.22916-4-rppt@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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/3/20 5:20 PM, Mike Rapoport wrote: > From: Mike Rapoport Subject should have "on DEBUG_PAGEALLOC" ? > The design of DEBUG_PAGEALLOC presumes that __kernel_map_pages() must never > fail. With this assumption is wouldn't be safe to allow general usage of > this function. > > Moreover, some architectures that implement __kernel_map_pages() have this > function guarded by #ifdef DEBUG_PAGEALLOC and some refuse to map/unmap > pages when page allocation debugging is disabled at runtime. > > As all the users of __kernel_map_pages() were converted to use > debug_pagealloc_map_pages() it is safe to make it available only when > DEBUG_PAGEALLOC is set. > > Signed-off-by: Mike Rapoport > Acked-by: David Hildenbrand > Acked-by: Kirill A. Shutemov > --- > arch/Kconfig | 3 +++ > arch/arm64/Kconfig | 4 +--- > arch/arm64/mm/pageattr.c | 8 ++++++-- > arch/powerpc/Kconfig | 5 +---- > arch/riscv/Kconfig | 4 +--- > arch/riscv/include/asm/pgtable.h | 2 -- > arch/riscv/mm/pageattr.c | 2 ++ > arch/s390/Kconfig | 4 +--- > arch/sparc/Kconfig | 4 +--- > arch/x86/Kconfig | 4 +--- > arch/x86/mm/pat/set_memory.c | 2 ++ > include/linux/mm.h | 10 +++++++--- > 12 files changed, 26 insertions(+), 26 deletions(-) > > diff --git a/arch/Kconfig b/arch/Kconfig > index 56b6ccc0e32d..56d4752b6db6 100644 > --- a/arch/Kconfig > +++ b/arch/Kconfig > @@ -1028,6 +1028,9 @@ config HAVE_STATIC_CALL_INLINE > bool > depends on HAVE_STATIC_CALL > > +config ARCH_SUPPORTS_DEBUG_PAGEALLOC > + bool > + > source "kernel/gcov/Kconfig" > > source "scripts/gcc-plugins/Kconfig" > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig > index 1d466addb078..a932810cfd90 100644 > --- a/arch/arm64/Kconfig > +++ b/arch/arm64/Kconfig > @@ -71,6 +71,7 @@ config ARM64 > select ARCH_USE_QUEUED_RWLOCKS > select ARCH_USE_QUEUED_SPINLOCKS > select ARCH_USE_SYM_ANNOTATIONS > + select ARCH_SUPPORTS_DEBUG_PAGEALLOC > select ARCH_SUPPORTS_MEMORY_FAILURE > select ARCH_SUPPORTS_SHADOW_CALL_STACK if CC_HAVE_SHADOW_CALL_STACK > select ARCH_SUPPORTS_ATOMIC_RMW > @@ -1025,9 +1026,6 @@ config HOLES_IN_ZONE > > source "kernel/Kconfig.hz" > > -config ARCH_SUPPORTS_DEBUG_PAGEALLOC > - def_bool y > - > config ARCH_SPARSEMEM_ENABLE > def_bool y > select SPARSEMEM_VMEMMAP_ENABLE > diff --git a/arch/arm64/mm/pageattr.c b/arch/arm64/mm/pageattr.c > index 1b94f5b82654..439325532be1 100644 > --- a/arch/arm64/mm/pageattr.c > +++ b/arch/arm64/mm/pageattr.c > @@ -155,7 +155,7 @@ int set_direct_map_invalid_noflush(struct page *page) > .clear_mask = __pgprot(PTE_VALID), > }; > > - if (!rodata_full) > + if (!debug_pagealloc_enabled() && !rodata_full) > return 0; > > return apply_to_page_range(&init_mm, > @@ -170,7 +170,7 @@ int set_direct_map_default_noflush(struct page *page) > .clear_mask = __pgprot(PTE_RDONLY), > }; > > - if (!rodata_full) > + if (!debug_pagealloc_enabled() && !rodata_full) > return 0; > > return apply_to_page_range(&init_mm, I don't understand these two hunks. Previous patch calls this for hibernation when CONFIG_ARCH_HAS_SET_DIRECT_MAP, which is true for arm64. Why suddenly this starts to depend on debug_pagealloc_enabled()?