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 207D6ECAAD3 for ; Wed, 14 Sep 2022 09:32:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8E5136B0071; Wed, 14 Sep 2022 05:32:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 894E66B0073; Wed, 14 Sep 2022 05:32:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 75CB38D0001; Wed, 14 Sep 2022 05:32:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 6624E6B0071 for ; Wed, 14 Sep 2022 05:32:13 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 34F51AB077 for ; Wed, 14 Sep 2022 09:32:13 +0000 (UTC) X-FDA: 79910174946.20.40181DC Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf21.hostedemail.com (Postfix) with ESMTP id AA8161C00B4 for ; Wed, 14 Sep 2022 09:32:12 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EA351B818C8; Wed, 14 Sep 2022 09:32:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E81BCC433C1; Wed, 14 Sep 2022 09:32:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663147929; bh=JxlkMJhrFSFFd6GtkvF2gyR+Kxu6WhW64tS/6rm9TXs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=P4VT86VowfQcbzvjW0VcEym36mb1+PciD6o1k2Ls4HXI16wpqJUhc88Y9UO21msye iK2VrEdALff3PJtBFLmKtHOT21Rv+nhUeksgnAh5WK4MUB6zpAa5LIIpZ8wJfIxzYv s87uj3ntbf0XzWLqV0srU0WXMN7HxEQlvfNmkdzaGwXdrs5kUej1MrPlcGuWjJvW+B SwZ9yXZSbP8xhbJ+MahdrMxL7/gzksicAScx6D0kVcSDIwEWDTRXkOq5OzgUj6kyOb Y1NEyatobrXNErnt13KtwctAj/yJNvJYoXFJyKvXnBxWLhMH4Cm+44cUDa0/9x+kop eGqJPEhGG6tkg== Date: Wed, 14 Sep 2022 10:32:00 +0100 From: Mike Rapoport To: Christophe Leroy Cc: Pali =?iso-8859-1?Q?Roh=E1r?= , Ash Logan , "paulus@samba.org" , "mpe@ellerman.id.au" , "robh+dt@kernel.org" , "benh@kernel.crashing.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-kernel@vger.kernel.org" , "j.ne@posteo.net" , "linux-mm@kvack.org" Subject: Re: Fragmented physical memory on powerpc/32 Message-ID: References: <20220609222420.ponpoodiqmaqtwht@pali> <20220808184034.lskqrk6z3gb5q76r@pali> <219cda7b-da4b-7a5a-9809-0878e0fc02ba@csgroup.eu> <20220908153511.57ceunyusziqfcav@pali> <20220908201701.sd3zqn5hfixmjvhh@pali> <9fbc5338-5e10-032a-8f55-e080bd93f74b@csgroup.eu> <20220912211623.djb7fckgknyfmof7@pali> <1c95875c-29f8-68b7-e480-fed8614f3037@csgroup.eu> <4f540391-37dc-8e22-be0a-74543082504d@csgroup.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4f540391-37dc-8e22-be0a-74543082504d@csgroup.eu> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663147932; a=rsa-sha256; cv=none; b=r2VLPYKXZP9w4oN6iOSYEu6WgIQ3nz8d7uHWBg57Ng/B3p3Vi/tCYkSA4UHDfTgTGvZLfk 6/Xv/WvfZAUozHFfoOE9op1ED/pKwpQSfnzx9mnHddfK2G9qGvg6Xb2yNFEhm8AbBSqhqo Soa0QIxMByiomoCgI51SnVDh935h8U8= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=P4VT86Vo; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf21.hostedemail.com: domain of rppt@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=rppt@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663147932; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=pVE0m152EqrhlfzbOnyAdokKN10WHt7DaUIp+cK9upc=; b=keVIMY7LE8tBI0Q0MSSdhisTb1duYdqIOQ9ga+s6NA+cNxGvD92APc3FlWrsKWniFaadZu mfCTLAwxAzgnkGAQ8v8APNrVC6Dp+P+uk1/YITBGqzinbFJyixPFIAK93Jt8zaxg/irDtE AVZwSwfv+e0x8t3RJcxvIGh4OBIG5nQ= Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=P4VT86Vo; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf21.hostedemail.com: domain of rppt@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=rppt@kernel.org X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: AA8161C00B4 X-Stat-Signature: z1zmgbxgzrzyjpez4egpjp577sbj4k7f X-Rspam-User: X-HE-Tag: 1663147932-956042 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: On Tue, Sep 13, 2022 at 02:36:13PM +0200, Christophe Leroy wrote: > > > Le 13/09/2022 à 08:11, Christophe Leroy a écrit : > > > > > > Le 12/09/2022 à 23:16, Pali Rohár a écrit : > > > > > > > > My guess would be that something went wrong in the linear map > > > > setup, but it > > > > won't hurt running with "memblock=debug" added to the kernel > > > > command line > > > > to see if there is anything suspicious there. > > > > > > Here is boot log on serial console with memblock=debug command line: > > > > > ... > > > > > > Do you need something more for debug? > > > > Can you send me the 'vmlinux' used to generate the above Oops so that I > > can see exactly where we are in function mem_init(). > > > > And could you also try without CONFIG_HIGHMEM just in case. > > > > I looked at the vmlinux you sent me, the problem is in the loop for highmem > in mem_init(). It crashes in the call to free_highmem_page() > > #ifdef CONFIG_HIGHMEM > { > unsigned long pfn, highmem_mapnr; > > highmem_mapnr = lowmem_end_addr >> PAGE_SHIFT; > for (pfn = highmem_mapnr; pfn < max_mapnr; ++pfn) { > phys_addr_t paddr = (phys_addr_t)pfn << PAGE_SHIFT; > struct page *page = pfn_to_page(pfn); > if (!memblock_is_reserved(paddr)) > free_highmem_page(page); > } > } > #endif /* CONFIG_HIGHMEM */ > > > As far as I can see in the memblock debug lines, the holes don't seem to be > marked as reserved by memblock. So it is above valid ? Other architectures > seem to do differently. > > Can you try by replacing !memblock_is_reserved(paddr) by > memblock_is_memory(paddr) ? The holes should not be marked as reserved, we just need to loop over the memory ranges rather than over pfns. Then the holes will be taken into account. I believe arm and xtensa got this right: (from arch/arm/mm/init.c) static void __init free_highpages(void) { #ifdef CONFIG_HIGHMEM unsigned long max_low = max_low_pfn; phys_addr_t range_start, range_end; u64 i; /* set highmem page free */ for_each_free_mem_range(i, NUMA_NO_NODE, MEMBLOCK_NONE, &range_start, &range_end, NULL) { unsigned long start = PFN_UP(range_start); unsigned long end = PFN_DOWN(range_end); /* Ignore complete lowmem entries */ if (end <= max_low) continue; /* Truncate partial highmem entries */ if (start < max_low) start = max_low; for (; start < end; start++) free_highmem_page(pfn_to_page(start)); } #endif } > Thanks > Christophe > -- Sincerely yours, Mike.