Message ID | ZNZblen+NXOrW9wE@p100 |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp1222576vqi; Fri, 11 Aug 2023 09:46:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFomgZVdtIz7VAL3kl2hzd6IObVdS2/Gacnwsy+enSl37LOvFb58ORTXyXqGRG9UW0njKF0 X-Received: by 2002:aca:2112:0:b0:3a7:64b4:81b0 with SMTP id 18-20020aca2112000000b003a764b481b0mr2727157oiz.25.1691772362131; Fri, 11 Aug 2023 09:46:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691772362; cv=none; d=google.com; s=arc-20160816; b=rEejroehnbdnv/WbOt55wGKzu5b3r/COKq2cVjCaBP/R1AzPzrlNK/TUwrNFn/dpBA Q3s+JXOvvP9Dsyd6gUl1a0CDHzSL2qS3rsedYmDKWetUZsXATNJ0bW/Agc1xygs3PsOb iAYATUBI8UM4r5GyfQHWbeDSinXvg4P/CdhBz473EhRUIbHhZwSY7zGnSjNNKlIJGRAl MN9wuSrj9Yr9PaSGSuX5s8c3T+9h4N7RSNuxVdtBWzXlNQrZj+BBbxFQCJOB0E7ijWb2 yEcYudTveL+Ko7wCF6Ha4pFWoKj2723faSii7WVBMcjeOERfUIKnMpt6LCnMYmRiSTQs W7mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:ui-outboundreport :content-disposition:mime-version:message-id:subject:cc:to:from:date :dkim-signature; bh=pS3E/kRtvQB1ZDJrBg7FXOnme+PLTHl01x31MRYbFkU=; fh=5Yh9Rbto1AF7N2HuJtzqtCURYQsEHLJUFeVAQb32AdA=; b=SBD1cD/b9yiTGhf6dLLKdvreINl08awWt/JwB7Y66PMarup9Rn8MbJ6uUiB/bujzUv bqNAlkQD41Kk+EsF7+annBiaBpcD5coH3QyTyqyDIWzYMFM5Uyj+ne7KDVbEJmkahboy hcQpEkx/yahWdQZ+++1oDKT++nllg8qMSXA/BX+glw3FBKvo0GdHGNrtcNnDeFQGlFH8 pZzhJJ+M7UucPTt3AhqlNHOatofDLYJpDoe03ZWboQDHXZY75lb70LWwb1wKTq1/y1K1 t6/hRCmJy44Fmk1zTRLpokhUOqDf8v7HN3B+HKYB6WShqjZxvu+HZDYAXEEIu7cBmzAk Axpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=gurEsYiC; 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=gmx.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y124-20020a636482000000b00564cd142ca4si3811112pgb.338.2023.08.11.09.45.46; Fri, 11 Aug 2023 09:46:02 -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=@gmx.de header.s=s31663417 header.b=gurEsYiC; 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=gmx.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231225AbjHKQCk (ORCPT <rfc822;lanlanxiyiji@gmail.com> + 99 others); Fri, 11 Aug 2023 12:02:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230004AbjHKQCi (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 11 Aug 2023 12:02:38 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0C2E26A0; Fri, 11 Aug 2023 09:02:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1691769750; x=1692374550; i=deller@gmx.de; bh=iqnZU8mU7l4QzSUyGuAE8+gkYIPMNUxpXam1GvezFL0=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject; b=gurEsYiCx5h6JS7/3E7TPINnChnbpJXgenK2gid4u1fOoY03aXbqBS87XMcUMvTfvgDtklY P7l3ZBhcWjXPZSeBXOfLLsnyvDae63pVkMSSLBI43bC655NoV+7UHypumTm7PXyI7urtAl9Ho pGL04kP3y7XegtUkLyVyYWPragvEvAFodzTyc6kgvzVmPw3PsR4hjH5MR2GmC34M07MPCEFEu MwdOdUsZYEkCQFmjXUme+r2KxJsX1PRN+JJKzWSlgcOyhcrZ1IjSIj10UKXCnEU7UpYPWszep s/Hkj6oZMe0xaArxeq3gTQjqRRgCphcX4zi4lREbRKrAyYuQex5A== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from p100 ([94.134.154.87]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MtwUw-1perNa3bQ4-00uLvy; Fri, 11 Aug 2023 18:02:30 +0200 Date: Fri, 11 Aug 2023 18:02:29 +0200 From: Helge Deller <deller@gmx.de> To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, "Rafael J. Wysocki" <rafael@kernel.org> Cc: linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org Subject: [PATCH] devtmpfs: Add missing lockdep annotation Message-ID: <ZNZblen+NXOrW9wE@p100> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Provags-ID: V03:K1:5h8fVYMFGB3PYIxsCO6QS49v1wEkt43agtMG/34iq//pZ9V5LAb YkF0bhNu1i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H/4AFRIa7ZF34x9EJMF5FVbjg7R 7H8eutYsLbRS0e7nc9Nrecqc0uzaqpd7oUxBCHsUeFzDJzcQUJN5uBnWh6srygHYIfkkdm/S3 hNG41XU1OuESyInIAXLOMst3zus= Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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: INBOX X-GMAIL-THRID: 1773951896441927675 X-GMAIL-MSGID: 1773951896441927675 |
Series |
devtmpfs: Add missing lockdep annotation
|
|
Commit Message
Helge Deller
Aug. 11, 2023, 4:02 p.m. UTC
Add the lockdep annotation to the setup_done completer to avoid this
kernel warning:
Backtrace:
[<000000004030bcd0>] show_stack+0x74/0xb0
[<000000004146c63c>] dump_stack_lvl+0x104/0x180
[<000000004146c6ec>] dump_stack+0x34/0x48
[<000000004040e5b4>] register_lock_class+0xd24/0xd30
[<000000004040c21c>] __lock_acquire.isra.0+0xb4/0xac8
[<000000004040cd60>] lock_acquire+0x130/0x298
[<000000004147095c>] _raw_spin_lock_irq+0x60/0xb8
[<0000000041474a4c>] wait_for_completion+0xa0/0x2d0
[<000000004015d9f4>] devtmpfs_init+0x1e0/0x2b8
[<000000004015d0e4>] driver_init+0x68/0x1b8
[<0000000040102b68>] kernel_init_freeable+0x4ac/0x7f0
[<000000004146df68>] kernel_init+0x64/0x3a8
[<0000000040302020>] ret_from_kernel_thread+0x20/0x28
Signed-off-by: Helge Deller <deller@gmx.de>
Comments
On Fri, Aug 11, 2023 at 06:02:29PM +0200, Helge Deller wrote: > Add the lockdep annotation to the setup_done completer to avoid this > kernel warning: > > Backtrace: > [<000000004030bcd0>] show_stack+0x74/0xb0 > [<000000004146c63c>] dump_stack_lvl+0x104/0x180 > [<000000004146c6ec>] dump_stack+0x34/0x48 > [<000000004040e5b4>] register_lock_class+0xd24/0xd30 > [<000000004040c21c>] __lock_acquire.isra.0+0xb4/0xac8 > [<000000004040cd60>] lock_acquire+0x130/0x298 > [<000000004147095c>] _raw_spin_lock_irq+0x60/0xb8 > [<0000000041474a4c>] wait_for_completion+0xa0/0x2d0 > [<000000004015d9f4>] devtmpfs_init+0x1e0/0x2b8 > [<000000004015d0e4>] driver_init+0x68/0x1b8 > [<0000000040102b68>] kernel_init_freeable+0x4ac/0x7f0 > [<000000004146df68>] kernel_init+0x64/0x3a8 > [<0000000040302020>] ret_from_kernel_thread+0x20/0x28 > > Signed-off-by: Helge Deller <deller@gmx.de> > > diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c > index b848764ef018..f98d58b0225c 100644 > --- a/drivers/base/devtmpfs.c > +++ b/drivers/base/devtmpfs.c > @@ -462,6 +462,7 @@ int __init devtmpfs_init(void) > return err; > } > > + init_completion(&setup_done); > thread = kthread_run(devtmpfsd, &err, "kdevtmpfs"); > if (!IS_ERR(thread)) { > wait_for_completion(&setup_done); What changed to required this now? What commit id does this fix? Why doesn't the declaration of DECLARE_COMPLETION() initialize this properly for us already? thanks, greg k-h
* Greg Kroah-Hartman <gregkh@linuxfoundation.org>: > On Fri, Aug 11, 2023 at 06:02:29PM +0200, Helge Deller wrote: > > Add the lockdep annotation to the setup_done completer to avoid this > > kernel warning: > > > > Backtrace: > > [<000000004030bcd0>] show_stack+0x74/0xb0 > > [<000000004146c63c>] dump_stack_lvl+0x104/0x180 > > [<000000004146c6ec>] dump_stack+0x34/0x48 > > [<000000004040e5b4>] register_lock_class+0xd24/0xd30 > > [<000000004040c21c>] __lock_acquire.isra.0+0xb4/0xac8 > > [<000000004040cd60>] lock_acquire+0x130/0x298 > > [<000000004147095c>] _raw_spin_lock_irq+0x60/0xb8 > > [<0000000041474a4c>] wait_for_completion+0xa0/0x2d0 > > [<000000004015d9f4>] devtmpfs_init+0x1e0/0x2b8 > > [<000000004015d0e4>] driver_init+0x68/0x1b8 > > [<0000000040102b68>] kernel_init_freeable+0x4ac/0x7f0 > > [<000000004146df68>] kernel_init+0x64/0x3a8 > > [<0000000040302020>] ret_from_kernel_thread+0x20/0x28 > > > > Signed-off-by: Helge Deller <deller@gmx.de> > > > > diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c > > index b848764ef018..f98d58b0225c 100644 > > --- a/drivers/base/devtmpfs.c > > +++ b/drivers/base/devtmpfs.c > > @@ -462,6 +462,7 @@ int __init devtmpfs_init(void) > > return err; > > } > > > > + init_completion(&setup_done); > > thread = kthread_run(devtmpfsd, &err, "kdevtmpfs"); > > if (!IS_ERR(thread)) { > > wait_for_completion(&setup_done); > > What changed to required this now? What commit id does this fix? Why > doesn't the declaration of DECLARE_COMPLETION() initialize this properly > for us already? You're right! The problem is not the missing init_completion() call. That part of the kernel warning indicates the real problem: INFO: trying to register non-static key. Lockdep uses static_obj() to check if the given lock is in "static" memory, aka inside a valid memory region: from &_stext to &_end. The "setup_done" completer is used at bootup only, and thus located in the __initdata section. And on parisc the __initdata section is outside of the &_stext to &_end range, so the static_obj() check fails. The patch below fixes it. I'll send a proper patch to the mailing list in a moment. Thanks! Helge diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index 111607d91489..aa99245d8e12 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -855,6 +855,15 @@ static int static_obj(const void *obj) if (is_kernel_percpu_address(addr)) return 1; + /* + * in initdata section and used during bootup only? + * NOTE: On some platforms the initdata section is + * outside of the _stext ... _end range. + */ + if (system_state < SYSTEM_FREEING_INITMEM && + init_section_contains((void*)addr, 1)) + return 1; + /* * module static or percpu var? */
diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c index b848764ef018..f98d58b0225c 100644 --- a/drivers/base/devtmpfs.c +++ b/drivers/base/devtmpfs.c @@ -462,6 +462,7 @@ int __init devtmpfs_init(void) return err; } + init_completion(&setup_done); thread = kthread_run(devtmpfsd, &err, "kdevtmpfs"); if (!IS_ERR(thread)) { wait_for_completion(&setup_done);