From: Wei Yang <richard.weiyang@gmail.com>
To: Mike Rapoport <rppt@kernel.org>
Cc: Guenter Roeck <linux@roeck-us.net>,
Michal Simek <monstr@monstr.eu>,
Wei Yang <richard.weiyang@gmail.com>,
akpm@linux-foundation.org, linux-mm@kvack.org,
Paul Mackerras <paulus@ozlabs.org>, Tejun Heo <tj@kernel.org>
Subject: Re: [Patch v3] mm/memblock: remove empty dummy entry
Date: Sun, 23 Jun 2024 00:31:12 +0000 [thread overview]
Message-ID: <20240623003112.5zdyojbr72ykmkbl@master> (raw)
In-Reply-To: <ZncU98y-9DRbyv54@kernel.org>
On Sat, Jun 22, 2024 at 09:16:23PM +0300, Mike Rapoport wrote:
>(added microblaze maintainer)
>
>On Fri, Jun 21, 2024 at 09:11:59PM -0700, Guenter Roeck wrote:
>> On 6/21/24 16:06, Wei Yang wrote:
>> > On Thu, Jun 20, 2024 at 07:34:06PM -0700, Guenter Roeck wrote:
>> > > On 6/20/24 18:07, Wei Yang wrote:
>> > > > On Thu, Jun 20, 2024 at 02:58:17PM -0700, Guenter Roeck wrote:
>> > > > > Hi,
>> > > > >
>> > > > > On Fri, Apr 05, 2024 at 01:58:21AM +0000, Wei Yang wrote:
>> > > > > > The dummy entry is introduced in the initial implementation of lmb in
>> > > > > > commit 7c8c6b9776fb ("powerpc: Merge lmb.c and make MM initialization
>> > > > > > use it.").
>> > > > > >
>> > > > > > As the comment says the empty dummy entry is to simplify the code.
>> > > > > >
>> > > > > > /* Create a dummy zero size LMB which will get coalesced away later.
>> > > > > > * This simplifies the lmb_add() code below...
>> > > > > > */
>> > > > > >
>> > > > > > While current code is reimplemented by Tejun in commit 784656f9c680
>> > > > > > ("memblock: Reimplement memblock_add_region()"). This empty dummy entry
>> > > > > > seems not benefit the code any more.
>> > > > > >
>> > > > > > Let's remove it.
>> > > > > >
>> > > > > > Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
>> > > > > > CC: Paul Mackerras <paulus@ozlabs.org>
>> > > > > > CC: Tejun Heo <tj@kernel.org>
>> > > > > > CC: Mike Rapoport <rppt@kernel.org>
>> > > > > >
>> > > > >
>> > > > > With this patch in linux-next, all microblaze qemu images fail to boot. Reverting it
>> > > > > fixes the problem.
>> > >
>> > > This is a silent failure. There is no console output, so the image crashes
>> > > before it gets to that point.
>> > >
>> > > Building microblaze:petalogix-s3adsp1800:initrd ... running ................R............. failed (silent)
>> > > ------------
>> > > qemu log:
>> > > qemu-system-microblaze: terminating on signal 15 from pid 2343410 (/bin/bash)
>> >
>> > Would you mind add kernel parameter memblock=debug without the commit applied?
>> > If my understanding is correct, you can bootup without this commit, right?
>>
>> Yes. With this change on top of linux-next:
>>
>> diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c
>> index 3827dc76edd8..1d3edac064ee 100644
>> --- a/arch/microblaze/mm/init.c
>> +++ b/arch/microblaze/mm/init.c
>> @@ -195,7 +195,9 @@ asmlinkage void __init mmu_init(void)
>>
>> if (!memblock.reserved.cnt) {
>
>I tried to understand what this was supposed to check, but this test was
>there from day 1, so git archaeology didn't help :(
>
>Anyway, it's perfectly fine to have any number of memblock reservations
>here or no at all.
>
>early_init_devtree() is called before mmu_init() and it sets up
>memblock.memory via early_init_dt_scan() and even allows memblock
>allocations. So the check for !memblock.reserved.cnt here seems wrong.
>
>> pr_emerg("Error memory count\n");
>> +#if 0
>> machine_restart(NULL);
>> +#endif
>> }
>>
>> the log starts with:
>>
>> random: crng init done
>> Ramdisk addr 0x51923788,
>> FDT at 0x51f43d88
>> Error memory count
>> MEMBLOCK configuration:
>> memory size = 0x10000000 reserved size = 0x015bb600
>> memory.cnt = 0x1
>> memory[0x0] [0x50000000-0x5fffffff], 0x10000000 bytes flags: 0x0
>> reserved.cnt = 0x3
>> reserved[0x0] [0x50000000-0x50f5cfff], 0x00f5d000 bytes flags: 0x0
>> reserved[0x1] [0x510c0000-0x510fffff], 0x00040000 bytes flags: 0x0
>> reserved[0x2] [0x51923788-0x51f41d87], 0x0061e600 bytes flags: 0x0
>> Linux version 6.10.0-rc4-next-20240620-dirty (groeck@server.roeck-us.net) (microblaze-linux-gcc (GCC) 11.4.0, GNU ld (GNU Binutils) 2.40) #1 Fri Jun 21 21:00:40 PDT 2024
>> setup_memory: max_mapnr: 0x10000
>> setup_memory: min_low_pfn: 0x50000
>> setup_memory: max_low_pfn: 0x60000
>> setup_memory: max_pfn: 0x60000
>> memblock_alloc_try_nid: 4096 bytes align=0x1000 nid=-1 from=0x00000000 max_addr=0x51100000 pte_alloc_one_kernel+0x50/0x64
>> memblock_reserve: [0x510bf000-0x510bffff] memblock_alloc_range_nid+0x104/0x1d4
>>
>> Guenter
>
>I think simply removing the check for !memblock.reserved.cnt is the right
>thing to do here:
>
>>From 975c5ba011330238444c82d0b171779c2156d2dc Mon Sep 17 00:00:00 2001
>From: "Mike Rapoport (IBM)" <rppt@kernel.org>
>Date: Sat, 22 Jun 2024 20:46:36 +0300
>Subject: [PATCH] microblaze: don't treat zero reserved memory regions as error
>
>Before commit 721f4a6526da ("mm/memblock: remove empty dummy entry") the
>check for non-zero of memblock.reserved.cnt in mmu_init() would always
>be true either because memblock.reserved.cnt is initialized to 1 or
>because there were memory reservations earlier.
>
>The removal of dummy empty entry in memblock caused this check to fail
>because now memblock.reserved.cnt is initialized to 0.
>
>Remove the check for non-zero of memblock.reserved.cnt because it's
>perfectly fine to have an empty memblock.reserved array that early in
>boot.
>
>Reported-by: Guenter Roeck <linux@roeck-us.net>
>Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
Thanks Mike :-)
Reviewed-by: Wei Yang <richard.weiyang@gmail.com>
>---
> arch/microblaze/mm/init.c | 5 -----
> 1 file changed, 5 deletions(-)
>
>diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c
>index 3827dc76edd8..4520c5741579 100644
>--- a/arch/microblaze/mm/init.c
>+++ b/arch/microblaze/mm/init.c
>@@ -193,11 +193,6 @@ asmlinkage void __init mmu_init(void)
> {
> unsigned int kstart, ksize;
>
>- if (!memblock.reserved.cnt) {
>- pr_emerg("Error memory count\n");
>- machine_restart(NULL);
>- }
>-
> if ((u32) memblock.memory.regions[0].size < 0x400000) {
> pr_emerg("Memory must be greater than 4MB\n");
> machine_restart(NULL);
>--
>2.43.0
>
>
>--
>Sincerely yours,
>Mike.
--
Wei Yang
Help you, Help me
next prev parent reply other threads:[~2024-06-23 0:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-05 1:58 Wei Yang
2024-04-08 5:44 ` Mike Rapoport
2024-04-08 12:37 ` Wei Yang
2024-04-09 5:02 ` Mike Rapoport
[not found] ` <8d6205d4-18fb-4e98-97e6-db226dcf48f3@roeck-us.net>
2024-06-21 1:07 ` Wei Yang
2024-06-21 2:34 ` Guenter Roeck
2024-06-21 23:06 ` Wei Yang
[not found] ` <2113ef59-0efd-4de2-83f7-f5940ce40fca@roeck-us.net>
2024-06-22 18:16 ` Mike Rapoport
2024-06-23 0:31 ` Wei Yang [this message]
2024-06-21 1:11 ` Wei Yang
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=20240623003112.5zdyojbr72ykmkbl@master \
--to=richard.weiyang@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=linux@roeck-us.net \
--cc=monstr@monstr.eu \
--cc=paulus@ozlabs.org \
--cc=rppt@kernel.org \
--cc=tj@kernel.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