From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60376C2BB85 for ; Sat, 22 Jun 2024 18:18:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6B3F56B05EF; Sat, 22 Jun 2024 14:18:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 663696B05F0; Sat, 22 Jun 2024 14:18:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 52BAE6B05F1; Sat, 22 Jun 2024 14:18:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 3561F6B05EF for ; Sat, 22 Jun 2024 14:18:50 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 9F7621A19FD for ; Sat, 22 Jun 2024 18:18:49 +0000 (UTC) X-FDA: 82259335578.05.03BBB8F Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf05.hostedemail.com (Postfix) with ESMTP id F3721100011 for ; Sat, 22 Jun 2024 18:18:46 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=BFLzNz4y; spf=pass (imf05.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719080316; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ldRhOsyQ2YRqj09IMZTtTFIenj0A6wENhBP5QYqTxyk=; b=W4SlSD+qM3Um9T04OlnBSq9WKN+O+pwNWsSIHNdUWvhipmB2gS+vnE67cN3VHB632Byskk X7WDGuwhDYbaM6UuN6H6RpC6FYzOIVAwfwdXOZjn5nUowzeo0xnzGJOn/6cFZHov8JVC3Z eo/bIPgCf6EXRy58XmrWdezon884iz4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719080316; a=rsa-sha256; cv=none; b=YCQEm6M0oWA+dCRxITx6MYeMHfZJ21pcm/jrZ/Sqxo8zr0mU37btrO1O2iw1F8YB2iUTLi QcDUQUmPXKjVjprpxP/bnRVqG8aCkloJeM/BbZ+zxTlzkRFLN++pMEoS+V5GYaVk0W7WwX s36OEmwAXBhsI0Irvrr59DO9/p6A/JM= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=BFLzNz4y; spf=pass (imf05.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 2BC0F6117B; Sat, 22 Jun 2024 18:18:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B382C3277B; Sat, 22 Jun 2024 18:18:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719080325; bh=bkTOaWmT2Usa0g8OZu7EoE7yp0oq4r/VOO11O7NkMfA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BFLzNz4ys1AS0eJSnJG53USw3iaBpZ/FpghCZbvs1iWHuW2zovOXcxON9J5oBtpKX AltorvznlReDroZT/zqnuNooPj+yKwLyTytHND26zMoRKsGQGBCxrFYAU32rVS57xL POhnM1cYkI+U/Nhh8mPLGSegjbfn2K0mK0DJtfci7wwUVPcxt2tRVu89L6upNN+2f9 4ji9M/S+mrxXd+MmHpFmU3x4Nnzrutif7UPl1Cwp4WD9wLOR6QIUbezD7KOOEqGJB9 f7EAOG/r38/eIr6ICyNXwSZovbzpAvYapM7YgnYTpCRxA5ybOwIR0Ty6FwPojer0jR NhVoYtJTGbZkg== Date: Sat, 22 Jun 2024 21:16:23 +0300 From: Mike Rapoport To: Guenter Roeck , Michal Simek Cc: Wei Yang , akpm@linux-foundation.org, linux-mm@kvack.org, Paul Mackerras , Tejun Heo Subject: Re: [Patch v3] mm/memblock: remove empty dummy entry Message-ID: References: <20240405015821.13411-1-richard.weiyang@gmail.com> <8d6205d4-18fb-4e98-97e6-db226dcf48f3@roeck-us.net> <20240621010713.cyai3pkucbp7v7r5@master> <20240621230625.7nopxs226k7oagm5@master> <2113ef59-0efd-4de2-83f7-f5940ce40fca@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2113ef59-0efd-4de2-83f7-f5940ce40fca@roeck-us.net> X-Rspamd-Queue-Id: F3721100011 X-Stat-Signature: 1zppbbkkgkiuhucyprdddgrdco6mmnmq X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1719080326-678457 X-HE-Meta: U2FsdGVkX194toXFffLOOger8iVqo6kuoauAFUC27h12R+93hCW8x1LfoCSeFDJZk7YgrEs2zIv/DIr9TtpIRtRNz6sM+DFeqrwaoNbZKE+k9ZN9p5+dM9SNoEEJhywjnx0JC14dYEPThNLWiwOAvA7iyXHbG/mYbDAUvHXx1W8qVZIrnbxhi13hbhyweteNLFXNfzV8ZxEDjnawKQGtMAC9tvRDswzmRzh7DxmNHK0PUB8ayVooSb6EGuLahswGIvLoQlicozSij10/vmr+jA19jaeFsMWUE6NWmPqFRjMhcuxAfcGW29+gvl2ktxckl8H6bMFTfROzFJcLqSMnAR76n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trp1BlxpfWRoExnu9z2xKqeYumaXN54Q3PbzH4K2w9KMyW533zDV/ZJLCg9s0xZCxA21tQ59xVrQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: (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 > > > > > > CC: Paul Mackerras > > > > > > CC: Tejun Heo > > > > > > CC: Mike Rapoport > > > > > > > > > > > > > > > > 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)" 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 Signed-off-by: Mike Rapoport (IBM) --- 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.