Received: by 2002:a05:7412:f584:b0:e2:908c:2ebd with SMTP id eh4csp1091410rdb; Mon, 4 Sep 2023 02:46:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFCZhq/w65KEP1yOJZDIVOSLbRkwIemC2Dtnbb8Uh+5wQ4kkIV0UgR90FwhjiF6CV85xbf8 X-Received: by 2002:a17:903:1107:b0:1bf:25a1:9813 with SMTP id n7-20020a170903110700b001bf25a19813mr11454150plh.6.1693820818844; Mon, 04 Sep 2023 02:46:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693820818; cv=none; d=google.com; s=arc-20160816; b=yZ9pvclKKSNxZDZgd7oOU3Cm3W4jhou1T1k1qsbxZ52tyreqzE5HZiAxITfb1Jr0h3 lhzpeDcwDbWGl94AdfWSaBBg2aLlhfOICU33vpsmfIjSDLWjsQbYcc9ycUev8fEJYhUk DkHVxI+c7zOsJsPH7IfnXu+ikF9Huc8wsGXJ2K6TQSr+vkho3rCXntCVUsoRKAR6Ta7I F8AFoUPVrUxyESYgZbP3jCaSw488wUNlH6Ir6cRAXJ+/wThw19dc+NUNx9tKNDiNy2pX YvQRaJr+iifIGvSW+nd8O8lFoxGn0SH078H1rMElpsPdZLvrA3eHy/N7yYcyN9FXdg1p Sl8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=Mjag27263vg7Szc4TDun4JyLN9wN2IYZFU+YZP3JlL4=; fh=QB5l+U8i6U9uxbDa+jyvFM210CO/psM3ar22Nq9LlwY=; b=KDNMe3LQQdbRT8U+2BM2d8Ffn5H8+HhapKmolBEgXIu8B3hf2eB9eMXo5B7A5h8v+R 95wNPjOAEuEhh2C9hrSFY/k3wjAu784bnZNV6qSdRB7fh+5fO6ixfPZYPMfm+btT4Gxv m6elXgmq8qCcqFEcfPcZ8Y/JVx8E11ywvU6pYkCLryVbntlrq/f7YCN6MIGYmCQyG3JD 3t+0a8kaGWlbarpmpozTZ0+KAcWY3df3qIsy1I6dysBg7xJfTfn+85X4AbiC3t56Axzn Lx1YWf20eSbI3l1xX2VxnRUgnQsu+8gV7hgWSzfyF1/G8kix31BpsS8xmo6nhkhSrfDK Dldw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n2-20020a170902d2c200b001c1e4f9c63esi4162419plc.491.2023.09.04.02.46.46; Mon, 04 Sep 2023 02:46:58 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244715AbjICVL0 (ORCPT + 99 others); Sun, 3 Sep 2023 17:11:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229523AbjICVL0 (ORCPT ); Sun, 3 Sep 2023 17:11:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE2A8E5; Sun, 3 Sep 2023 14:11:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6CF706115C; Sun, 3 Sep 2023 21:11:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 582DDC433C8; Sun, 3 Sep 2023 21:11:17 +0000 (UTC) Date: Sun, 3 Sep 2023 23:11:12 +0200 From: Helge Deller To: Guenter Roeck , Linus Torvalds , linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org Cc: Andrew Morton , Greg Kroah-Hartman , "Rafael J. Wysocki" , linux-parisc@vger.kernel.org, Borislav Petkov , Peter Zijlstra Subject: Re: [PATCH] lockdep: Fix static memory detection even more Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=no 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: X-Mailing-List: linux-kernel@vger.kernel.org * Guenter Roeck : > Hi, > > On Sat, Aug 12, 2023 at 05:48:52PM +0200, Helge Deller wrote: > > On the parisc architecture, lockdep reports for all static objects which > > are in the __initdata section (e.g. "setup_done" in devtmpfs, > > "kthreadd_done" in init/main.c) this warning: > > > > INFO: trying to register non-static key. > > > > The warning itself is wrong, because those objects are in the __initdata > > section, but the section itself is on parisc outside of range from > > _stext to _end, which is why the static_obj() functions returns a wrong > > answer. > > > > While fixing this issue, I noticed that the whole existing check can > > be simplified a lot. > > Instead of checking against the _stext and _end symbols (which include > > code areas too) just check for the .data and .bss segments (since we check a > > data object). This can be done with the existing is_kernel_core_data() > > macro. > > > > In addition objects in the __initdata section can be checked with > > init_section_contains(). > > > > This partly reverts and simplifies commit bac59d18c701 ("x86/setup: Fix static > > memory detection"). > > > > Tested on x86-64 and parisc. > > > > Signed-off-by: Helge Deller > > Fixes: bac59d18c701 ("x86/setup: Fix static memory detection") > > On loongarch, this patch results in the following backtrace. > > EFI stub: Loaded initrd from LINUX_EFI_INITRD_MEDIA_GUID device path > EFI stub: Exiting boot services > [ 0.000000] INFO: trying to register non-static key. > [ 0.000000] The code is fine but needs lockdep annotation, or maybe > [ 0.000000] you didn't initialize this object before use? > [ 0.000000] turning off the locking correctness validator. > [ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 6.5.0+ #1 > [ 0.000000] Stack : 0000000000000000 0000000000000000 9000000000223d6c 9000000001df0000 > [ 0.000000] 9000000001df39a0 9000000001df39a8 0000000000000000 0000000000000000 > [ 0.000000] 9000000001df39a8 0000000000000001 0000000000000000 900000000154b910 > [ 0.000000] fffffffffffffffe 9000000001df39a8 0000000000000000 0000000000000000 > [ 0.000000] 0000000000000001 0000000000000003 0000000000000010 0000000000000030 > [ 0.000000] 0000000000000063 0000000000000001 0000000000000000 0000000000000000 > [ 0.000000] 0000000000000000 0000000000000000 9000000001c60650 9000000001e12000 > [ 0.000000] 0000000000000000 9000000001560bc0 0000000000000000 9000000002ee6000 > [ 0.000000] 0000000000000000 0000000000000000 9000000000223d84 0000000000000000 > [ 0.000000] 00000000000000b0 0000000000000004 0000000000000000 0000000000000800 > [ 0.000000] ... > [ 0.000000] Call Trace: > [ 0.000000] [<9000000000223d84>] show_stack+0x5c/0x180 > [ 0.000000] [<900000000153e0b4>] dump_stack_lvl+0x88/0xd0 > [ 0.000000] [<90000000002bc548>] register_lock_class+0x768/0x770 > [ 0.000000] [<90000000002bc710>] __lock_acquire+0xb0/0x2a18 > [ 0.000000] [<90000000002bba1c>] lock_acquire+0x11c/0x328 > [ 0.000000] [<9000000000b34a60>] __debug_object_init+0x60/0x244 > [ 0.000000] [<9000000000337f94>] init_cgroup_housekeeping+0xe8/0x144 > [ 0.000000] [<900000000033e364>] init_cgroup_root+0x38/0xa0 > [ 0.000000] [<90000000017801ac>] cgroup_init_early+0x44/0x16c > [ 0.000000] [<9000000001770758>] start_kernel+0x50/0x624 > [ 0.000000] [<90000000015410b4>] kernel_entry+0xb4/0xc4 > > Reverting it fixes the problem. Bisect log attached. > > This is also seen in v6.5.y and v6.4.y since the patch has been applied > to those branches. Does this happens with CONFIG_SMP=n ? If so, I think the untested patch below might fix the issue. Helge --- [PATCH] loogarch: Keep PERCPU section in init section even for !CONFIG_SMP Signed-off-by: Helge Deller diff --git a/arch/loongarch/kernel/vmlinux.lds.S b/arch/loongarch/kernel/vmlinux.lds.S index b1686afcf876..32d61e931cdc 100644 --- a/arch/loongarch/kernel/vmlinux.lds.S +++ b/arch/loongarch/kernel/vmlinux.lds.S @@ -99,9 +99,7 @@ SECTIONS EXIT_DATA } -#ifdef CONFIG_SMP PERCPU_SECTION(1 << CONFIG_L1_CACHE_SHIFT) -#endif .init.bss : { *(.init.bss)