Message ID | 20230414080418.110236-1-arnd@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp212055vqo; Fri, 14 Apr 2023 01:09:52 -0700 (PDT) X-Google-Smtp-Source: AKy350br8z8ZVjoGTa5tCVpkJYYdZG78OxAglGYkmODWvfEeALYkOxskRAucaIT4bjs/UhF3bwRi X-Received: by 2002:a17:902:dac1:b0:1a6:5fe1:63be with SMTP id q1-20020a170902dac100b001a65fe163bemr2237261plx.47.1681459792127; Fri, 14 Apr 2023 01:09:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681459792; cv=none; d=google.com; s=arc-20160816; b=luaWozZS/oNgcpKjeu4Mx7pZBMq29uUetMg+lrR+G9M/920ZPuLtNfnQCULodbv7lS wfqRgyV5SAIUcGbB2HcoKZlvFXGP0sKvdlYcg6BfxcHPPOLy9EGCtGRqCRIxffz522tq OUoQC2klAMiz+Ku9d3q7wvQCj7ut27iOy8BZ0vUqkOLzT8kFnAq0VJAjoDqS72q9Fje3 UFrsL8NMarnKtu3w5l23A9jmlVvckAOTLsYSzeA2z2PDi2sWUc39CPh/PR84xorBOuQc LJ/2bcbpKkA2ecoXetI8MLiycoylvn6D3QGb/bVYoMc5gPQlHpR3aLWeJg08T/POCBLT hvEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Z0C1S8SsT3Uw9LinJ9/MGefYZ3piKnFQ+GmLg+miyUc=; b=cVd7qvu/5B8kOmPkPbbKR+Xiiv4/FzG14InTbis7UWmR3MhWWnX6PDjAaU+OL1K54m tXxOMXdEwemggOk/lD1xfPGwbFrVEjnSkVmIZkLBtxcDeUMldSE42f8vad5krG2eV55B PWy2X6mJ2MIQwSCKqU7w0HntOgLBglm+zylMRVReaqHjWiuDwSK1dZarWJ/Fnx+VOfQG +YvAHouQ/80uC6mwM6GVApi6NBFQZu+YbplMHt9xZtiObLD89ZZ7inDYnW1jUPejOOQ2 vLsqcAHbNdbWgNMqSwCHdv0o9q2qw5zXu+Z9lmLywE/aH8y0vVISWgqF3f5FFuK42chq glRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=e6CSSlSy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h1-20020a170902f7c100b001a060012dfcsi3977150plw.114.2023.04.14.01.09.39; Fri, 14 Apr 2023 01:09:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=e6CSSlSy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229805AbjDNIE3 (ORCPT <rfc822;leviz.kernel.dev@gmail.com> + 99 others); Fri, 14 Apr 2023 04:04:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229625AbjDNIE1 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 14 Apr 2023 04:04:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77E811FF3 for <linux-kernel@vger.kernel.org>; Fri, 14 Apr 2023 01:04:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0B20061610 for <linux-kernel@vger.kernel.org>; Fri, 14 Apr 2023 08:04:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1904C433D2; Fri, 14 Apr 2023 08:04:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681459465; bh=kIJ6lK/Lc6cAvvvb9aZuILfOuK0T9xQHpTLzt8A9dFI=; h=From:To:Cc:Subject:Date:From; b=e6CSSlSynnb8/8SQwximjDYsEgO3iB37cizeXObEuBX6UeZi8PxJbes/BFDKFHl1r J845+gmamcoMiwEHZXspDymX/EUrJ1c0x2LpLkUaRUwb6c4sSDKK9Lu9lzza8abojD RuKF8Ji5sBj5MXlRir50HWDq3CKnkFPF18u8iPwydZ2QdJMV1Oc4gP38WMyZgvAFAw bSzc8eH4UpRLtxV1eCsP8mnq61xV61x6SEdQd8P0WPIzpHETQ62DyT0FuRhFfBlMA8 VFn8ZB8lzhZGvQZooZ11s139afw6PGuEVJO6I/2qXWP+S+ACcTnOg0CGC4JK84r2mZ 5BgtQeI+xEWQQ== From: Arnd Bergmann <arnd@kernel.org> To: Vineet Gupta <vgupta@kernel.org>, Andrew Morton <akpm@linux-foundation.org>, Mike Rapoport <rppt@kernel.org>, Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, David Hildenbrand <david@redhat.com>, Vlastimil Babka <vbabka@suse.cz> Cc: Arnd Bergmann <arnd@arndb.de>, llvm@lists.linux.dev, Tom Rix <trix@redhat.com>, "Liam R. Howlett" <Liam.Howlett@Oracle.com>, "Matthew Wilcox (Oracle)" <willy@infradead.org>, Suren Baghdasaryan <surenb@google.com>, Naoya Horiguchi <naoya.horiguchi@nec.com>, linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH] mm: make arch_has_descending_max_zone_pfns() static Date: Fri, 14 Apr 2023 10:03:53 +0200 Message-Id: <20230414080418.110236-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763138382814571292?= X-GMAIL-MSGID: =?utf-8?q?1763138382814571292?= |
Series |
mm: make arch_has_descending_max_zone_pfns() static
|
|
Commit Message
Arnd Bergmann
April 14, 2023, 8:03 a.m. UTC
From: Arnd Bergmann <arnd@arndb.de> clang produces a build failure on x86 for some randconfig builds after a change that moves around code to mm/mm_init.c: Cannot find symbol for section 2: .text. mm/mm_init.o: failed I have not been able to figure out why this happens, but the __weak annotation on arch_has_descending_max_zone_pfns() is the trigger here. Removing the weak function in favor of an open-coded Kconfig option check avoids the problem and becomes clearer as well as better to optimize by the compiler. Fixes: 9420f89db2dd ("mm: move most of core MM initialization to mm/mm_init.c") Cc: llvm@lists.linux.dev Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- arch/arc/mm/init.c | 5 ----- include/linux/mm.h | 1 - mm/mm_init.c | 4 ++-- 3 files changed, 2 insertions(+), 8 deletions(-)
Comments
Hello, kernel test robot noticed "kernel_BUG_at_lib/list_debug.c" on: commit: c31fe5eb2ec68f6d2331fabc924e0030cc6bb2b3 ("[PATCH] mm: make arch_has_descending_max_zone_pfns() static") url: https://github.com/intel-lab-lkp/linux/commits/Arnd-Bergmann/mm-make-arch_has_descending_max_zone_pfns-static/20230414-160608 base: https://git.kernel.org/cgit/linux/kernel/git/akpm/mm.git mm-everything patch link: https://lore.kernel.org/all/20230414080418.110236-1-arnd@kernel.org/ patch subject: [PATCH] mm: make arch_has_descending_max_zone_pfns() static in testcase: boot compiler: gcc-11 test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G (please refer to attached dmesg/kmsg for entire log/backtrace) +------------------------------------------+------------+------------+ | | 32ed3874f2 | c31fe5eb2e | +------------------------------------------+------------+------------+ | boot_successes | 10 | 0 | | boot_failures | 0 | 6 | | kernel_BUG_at_lib/list_debug.c | 0 | 6 | | invalid_opcode:#[##] | 0 | 6 | | EIP:__list_add_valid | 0 | 6 | | Kernel_panic-not_syncing:Fatal_exception | 0 | 6 | +------------------------------------------+------------+------------+ If you fix the issue, kindly add following tag | Reported-by: kernel test robot <oliver.sang@intel.com> | Link: https://lore.kernel.org/oe-lkp/202304151422.5e4d380b-oliver.sang@intel.com [ 0.004000][ T0] ------------[ cut here ]------------ [ 0.004000][ T0] kernel BUG at lib/list_debug.c:33! [ 0.004000][ T0] invalid opcode: 0000 [#1] SMP [ 0.004000][ T0] CPU: 0 PID: 0 Comm: swapper Not tainted 6.3.0-rc5-00613-gc31fe5eb2ec6 #42 [ 0.004000][ T0] EIP: __list_add_valid (??:?) [ 0.004000][ T0] Code: 56 51 68 78 b0 4c c2 e8 39 c7 de ff 0f 0b b8 f4 60 a4 c2 eb 1c 39 d3 74 04 39 f3 75 19 51 50 53 68 ca b0 4c c2 e8 1b c7 de ff <0f> 0b b8 e8 60 a4 c2 e8 be 71 06 00 8d 65 f8 b0 01 5b 5e 5d 31 d2 All code ======== 0: 56 push %rsi 1: 51 push %rcx 2: 68 78 b0 4c c2 pushq $0xffffffffc24cb078 7: e8 39 c7 de ff callq 0xffffffffffdec745 c: 0f 0b ud2 e: b8 f4 60 a4 c2 mov $0xc2a460f4,%eax 13: eb 1c jmp 0x31 15: 39 d3 cmp %edx,%ebx 17: 74 04 je 0x1d 19: 39 f3 cmp %esi,%ebx 1b: 75 19 jne 0x36 1d: 51 push %rcx 1e: 50 push %rax 1f: 53 push %rbx 20: 68 ca b0 4c c2 pushq $0xffffffffc24cb0ca 25: e8 1b c7 de ff callq 0xffffffffffdec745 2a:* 0f 0b ud2 <-- trapping instruction 2c: b8 e8 60 a4 c2 mov $0xc2a460e8,%eax 31: e8 be 71 06 00 callq 0x671f4 36: 8d 65 f8 lea -0x8(%rbp),%esp 39: b0 01 mov $0x1,%al 3b: 5b pop %rbx 3c: 5e pop %rsi 3d: 5d pop %rbp 3e: 31 d2 xor %edx,%edx Code starting with the faulting instruction =========================================== 0: 0f 0b ud2 2: b8 e8 60 a4 c2 mov $0xc2a460e8,%eax 7: e8 be 71 06 00 callq 0x671ca c: 8d 65 f8 lea -0x8(%rbp),%esp f: b0 01 mov $0x1,%al 11: 5b pop %rbx 12: 5e pop %rsi 13: 5d pop %rbp 14: 31 d2 xor %edx,%edx [ 0.004000][ T0] EAX: 00000040 EBX: ec373004 ECX: 00000000 EDX: 00000000 [ 0.004000][ T0] ESI: c2ba2b20 EDI: ec373004 EBP: c2689e94 ESP: c2689e7c [ 0.004000][ T0] DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068 EFLAGS: 00210046 [ 0.004000][ T0] CR0: 80050033 CR2: 00000000 CR3: 02c7d000 CR4: 00040690 [ 0.004000][ T0] DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000 [ 0.004000][ T0] DR6: fffe0ff0 DR7: 00000400 [ 0.004000][ T0] Call Trace: [ 0.004000][ T0] list_add_tail (uncore.c:?) [ 0.004000][ T0] __free_one_page (page_alloc.c:?) [ 0.004000][ T0] __free_pages_ok (page_alloc.c:?) [ 0.004000][ T0] __free_pages_core (??:?) [ 0.004000][ T0] memblock_free_pages (??:?) [ 0.004000][ T0] memblock_free_all (??:?) [ 0.004000][ T0] mem_init (??:?) [ 0.004000][ T0] mm_core_init (??:?) [ 0.004000][ T0] ? cpu_init (??:?) [ 0.004000][ T0] start_kernel (??:?) [ 0.004000][ T0] i386_start_kernel (??:?) [ 0.004000][ T0] startup_32_smp (??:?) [ 0.004000][ T0] Modules linked in: [ 0.004000][ T0] ---[ end trace 0000000000000000 ]--- [ 0.004000][ T0] EIP: __list_add_valid (??:?) [ 0.004000][ T0] Code: 56 51 68 78 b0 4c c2 e8 39 c7 de ff 0f 0b b8 f4 60 a4 c2 eb 1c 39 d3 74 04 39 f3 75 19 51 50 53 68 ca b0 4c c2 e8 1b c7 de ff <0f> 0b b8 e8 60 a4 c2 e8 be 71 06 00 8d 65 f8 b0 01 5b 5e 5d 31 d2 All code ======== 0: 56 push %rsi 1: 51 push %rcx 2: 68 78 b0 4c c2 pushq $0xffffffffc24cb078 7: e8 39 c7 de ff callq 0xffffffffffdec745 c: 0f 0b ud2 e: b8 f4 60 a4 c2 mov $0xc2a460f4,%eax 13: eb 1c jmp 0x31 15: 39 d3 cmp %edx,%ebx 17: 74 04 je 0x1d 19: 39 f3 cmp %esi,%ebx 1b: 75 19 jne 0x36 1d: 51 push %rcx 1e: 50 push %rax 1f: 53 push %rbx 20: 68 ca b0 4c c2 pushq $0xffffffffc24cb0ca 25: e8 1b c7 de ff callq 0xffffffffffdec745 2a:* 0f 0b ud2 <-- trapping instruction 2c: b8 e8 60 a4 c2 mov $0xc2a460e8,%eax 31: e8 be 71 06 00 callq 0x671f4 36: 8d 65 f8 lea -0x8(%rbp),%esp 39: b0 01 mov $0x1,%al 3b: 5b pop %rbx 3c: 5e pop %rsi 3d: 5d pop %rbp 3e: 31 d2 xor %edx,%edx Code starting with the faulting instruction =========================================== 0: 0f 0b ud2 2: b8 e8 60 a4 c2 mov $0xc2a460e8,%eax 7: e8 be 71 06 00 callq 0x671ca c: 8d 65 f8 lea -0x8(%rbp),%esp f: b0 01 mov $0x1,%al 11: 5b pop %rbx 12: 5e pop %rsi 13: 5d pop %rbp 14: 31 d2 xor %edx,%edx To reproduce: # build kernel cd linux cp config-6.3.0-rc5-00613-gc31fe5eb2ec6 .config make HOSTCC=gcc-11 CC=gcc-11 ARCH=i386 olddefconfig prepare modules_prepare bzImage modules make HOSTCC=gcc-11 CC=gcc-11 ARCH=i386 INSTALL_MOD_PATH=<mod-install-dir> modules_install cd <mod-install-dir> find lib/ | cpio -o -H newc --quiet | gzip > modules.cgz git clone https://github.com/intel/lkp-tests.git cd lkp-tests bin/lkp qemu -k <bzImage> -m modules.cgz job-script # job-script is attached in this email # if come across any failure that blocks the test, # please remove ~/.lkp and /lkp dir to run from a clean state.
On Sat, Apr 15, 2023, at 08:42, kernel test robot wrote: > Hello, > > kernel test robot noticed "kernel_BUG_at_lib/list_debug.c" on: > > commit: c31fe5eb2ec68f6d2331fabc924e0030cc6bb2b3 ("[PATCH] mm: make > arch_has_descending_max_zone_pfns() static") Thanks for the report, that was a logic error on my end, the fix is: --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -1756,7 +1756,7 @@ static void __init free_area_init_memoryless_node(int nid) */ static bool arch_has_descending_max_zone_pfns(void) { - return !IS_ENABLED(CONFIG_ARC_HAS_PAE40); + return IS_ENABLED(CONFIG_ARC) && !IS_ENABLED(CONFIG_ARC_HAS_PAE40); } /** I'll send a replacement v2 that has this folded in. Arnd
diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c index ce4e939a7f07..2b89b6c53801 100644 --- a/arch/arc/mm/init.c +++ b/arch/arc/mm/init.c @@ -74,11 +74,6 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size) base, TO_MB(size), !in_use ? "Not used":""); } -bool arch_has_descending_max_zone_pfns(void) -{ - return !IS_ENABLED(CONFIG_ARC_HAS_PAE40); -} - /* * First memory setup routine called from setup_arch() * 1. setup swapper's mm @init_mm diff --git a/include/linux/mm.h b/include/linux/mm.h index ada57b11bb5a..a13cc121841d 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3061,7 +3061,6 @@ extern void setup_per_cpu_pageset(void); extern int min_free_kbytes; extern int watermark_boost_factor; extern int watermark_scale_factor; -extern bool arch_has_descending_max_zone_pfns(void); /* nommu.c */ extern atomic_long_t mmap_pages_allocated; diff --git a/mm/mm_init.c b/mm/mm_init.c index 35302b7bca83..f6165747fd3e 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -1754,9 +1754,9 @@ static void __init free_area_init_memoryless_node(int nid) * Some architectures, e.g. ARC may have ZONE_HIGHMEM below ZONE_NORMAL. For * such cases we allow max_zone_pfn sorted in the descending order */ -bool __weak arch_has_descending_max_zone_pfns(void) +static bool arch_has_descending_max_zone_pfns(void) { - return false; + return !IS_ENABLED(CONFIG_ARC_HAS_PAE40); } /**