From: Daniel Axtens <dja@axtens.net>
To: Michael Ellerman <mpe@ellerman.id.au>,
Bart Van Assche <bvanassche@acm.org>, Qian Cai <cai@lca.pw>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: lockdep warning while booting POWER9 PowerNV
Date: Mon, 25 Nov 2019 12:12:01 +1100 [thread overview]
Message-ID: <87v9r8g3oe.fsf@dja-thinkpad.axtens.net> (raw)
In-Reply-To: <87ef0vpfbc.fsf@mpe.ellerman.id.au>
Hi Michael,
>>> Once in a while, booting an IBM POWER9 PowerNV system (8335-GTH) would generate
>>> a warning in lockdep_register_key() at,
>>>
>>> if (WARN_ON_ONCE(static_obj(key)))
>>>
>>> because
>>>
>>> key = 0xc0000000019ad118
>>> &_stext = 0xc000000000000000
>>> &_end = 0xc0000000049d0000
>>>
>>> i.e., it will cause static_obj() returns 1.
>>
>> (back from a trip)
>>
>> Hi Qian,
>>
>> Does this mean that on POWER9 it can happen that a dynamically allocated
>> object has an address that falls between &_stext and &_end?
>
> I thought that was true on all arches due to initmem, but seems not.
>
> I guess we have the same problem as s390 and we need to define
> arch_is_kernel_initmem_freed().
>
> Qian, can you try this:
>
> diff --git a/arch/powerpc/include/asm/sections.h b/arch/powerpc/include/asm/sections.h
> index 4a1664a8658d..616b1b7b7e52 100644
> --- a/arch/powerpc/include/asm/sections.h
> +++ b/arch/powerpc/include/asm/sections.h
> @@ -5,8 +5,22 @@
>
> #include <linux/elf.h>
> #include <linux/uaccess.h>
> +
> +#define arch_is_kernel_initmem_freed arch_is_kernel_initmem_freed
> +
> #include <asm-generic/sections.h>
>
> +extern bool init_mem_is_free;
> +
> +static inline int arch_is_kernel_initmem_freed(unsigned long addr)
> +{
> + if (!init_mem_is_free)
> + return 0;
> +
> + return addr >= (unsigned long)__init_begin &&
> + addr < (unsigned long)__init_end;
> +}
> +
> extern char __head_end[];
>
> #ifdef __powerpc64__
>
This also fixes the following syzkaller bug:
https://syzkaller-ppc64.appspot.com/bug?id=cfdf75cd985012d0124cd41e6fa095d33e7d0f6b
https://github.com/linuxppc/issues/issues/284
Would you like me to do up a nice commit message for it?
Regards,
Daniel
>
> cheers
next prev parent reply other threads:[~2019-11-25 1:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-30 21:13 lockdep warning while booting POWER9 PowerNV Qian Cai
2019-09-04 16:09 ` Bart Van Assche
2019-09-05 3:55 ` Michael Ellerman
2019-09-05 14:30 ` Qian Cai
2019-11-21 17:13 ` Qian Cai
2019-11-25 1:12 ` Daniel Axtens [this message]
2019-11-25 5:01 ` Michael Ellerman
2019-11-25 12:49 ` Daniel Axtens
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87v9r8g3oe.fsf@dja-thinkpad.axtens.net \
--to=dja@axtens.net \
--cc=bvanassche@acm.org \
--cc=cai@lca.pw \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mingo@kernel.org \
--cc=mpe@ellerman.id.au \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).