Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp52168pxb; Tue, 12 Apr 2022 16:33:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPDD4xLFIEk509AFZykL8OjrEgxZFaV1xHdE2NpexgnhAsmTr/02zWtjvgiLtzMns4EOF4 X-Received: by 2002:a17:902:9a98:b0:155:f634:5f37 with SMTP id w24-20020a1709029a9800b00155f6345f37mr39811637plp.86.1649806387079; Tue, 12 Apr 2022 16:33:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649806387; cv=none; d=google.com; s=arc-20160816; b=SeLmqYOKhxVOrzc6NvplOlGaFzKaTUjNMba+ejDy9LCwyF2RHNM29MveOO+80rPKpk wg4Q3yM/93rj39nisfd6CXAS6oNeEXAxQAVQq7WOfzTmt9F7UFeFh5GgS38I7MnNVpAt Jb8PU9RHhUs+d+gJ0sDnwbvnGxgjtTvj7lubY0MYsM4JHlIWCYJo6BWUI6mO9WBFvieR /SooyZL3Dji0L582mDxK9TP4ckmvLYGCvaTxLbGnwoPnA+ExsgcjWSbwyqYJE3FTkaEQ OVsDyXwUUkpcOWJ63CXa0WDIKyAMWG4KTadPtP0KQaiZPmopFjyt1FVcsHShTwHGxL5C wU+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:references:in-reply-to:subject:cc:to:from :dkim-signature; bh=m4MwxwbcZdNUXgF4qvMI9+VwYgaKkYE8vyW9IWIBWtI=; b=hIUCNs5sggCgmbJH1zMy3IC5QrBfV72dGKb1a4m9tyztxxMH+XPIsxgreocYTCgGMY RPQuF/9/gfiNuy4t56LQPNpmnuBIViea7gcXUa9ibT6l2URFwt5lqBlrJGEyGJYJesP6 s81MXHSpCYoJOqJegRNmTsa3kZH59BpH/3qg4+T6t2TGZz24CovDcuxuIY2dy8Pux3wY HSjxAB9Ofht4dIw/3BAKla/9GFh3dEfVcQ2i338/Xn0zdrmwDCnxrcK5uS0aDo33wBEx hPZrf9js5/YGxDgYKVQ/yjdRFuy5Vkqp9B1ku980Yivpz7/SRBmz4SXuBLAz8BiY0Lp8 foRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=bpPJhxFI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q7-20020a170902dac700b00153b2d16652si1032008plx.602.2022.04.12.16.33.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 16:33:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=bpPJhxFI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 894691B0857; Tue, 12 Apr 2022 14:24:37 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354500AbiDLHSW (ORCPT + 99 others); Tue, 12 Apr 2022 03:18:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352220AbiDLHE7 (ORCPT ); Tue, 12 Apr 2022 03:04:59 -0400 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10C6B27162 for ; Mon, 11 Apr 2022 23:47:50 -0700 (PDT) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4Kcx9w2HNHz4xXW; Tue, 12 Apr 2022 16:47:48 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1649746069; bh=m4MwxwbcZdNUXgF4qvMI9+VwYgaKkYE8vyW9IWIBWtI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=bpPJhxFIp5kqmWf/g0qcLrUdm0Lgg1PISHaoWjkrZcEjmaDyJPe8un+f43k4joLTp ZTsikZTszA6+03sTHL53h/XUNP7WjYqWSZ8yzKklwFbzWZ4h57tLtlTavQdBD+FYVD fhGWiyOgX+t+4dyqjzCVXDImNMnqGG/IQoRlRbu0rCSihnAI4wCJXD/Sio8KsQvBth Cz4fJyEsDPUCxrr2tBilZdyMak7lRicCSC4GzRqSKPAfgd7ZkDZcwMYUv9/biWB9hs dHj39a+vrhdDqV25Tcm5vnBaWLeG0nGWJz+xTBSqViLq0vXiwSDcE6tuGHEwYgnAfE sWNvp+ui4F6xg== From: Michael Ellerman To: Christophe Leroy , Ariel Marcovitch , Mike Rapoport , Catalin Marinas Cc: "akpm@linux-foundation.org" , "benh@kernel.crashing.org" , "paulus@samba.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" Subject: Re: False positive kmemleak report for dtb properties names on powerpc In-Reply-To: References: <9dd08bb5-f39e-53d8-f88d-bec598a08c93@gmail.com> <2603cae9-3b75-cd13-1d41-2f1bed6ca32e@gmail.com> Date: Tue, 12 Apr 2022 16:47:47 +1000 Message-ID: <87pmlm6bn0.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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: X-Mailing-List: linux-kernel@vger.kernel.org Christophe Leroy writes: > Hi Ariel > > Le 09/04/2022 =C3=A0 15:47, Ariel Marcovitch a =C3=A9crit=C2=A0: >> Hi Christophe, did you get the chance to look at this? > > I tested something this morning, it works for me, see below > >>=20 >> On 23/03/2022 21:06, Mike Rapoport wrote: >>> Hi Catalin, >>> >>> On Wed, Mar 23, 2022 at 05:22:38PM +0000, Catalin Marinas wrote: >>>> Hi Ariel, >>>> >>>> On Fri, Feb 18, 2022 at 09:45:51PM +0200, Ariel Marcovitch wrote: >>>>> I was running a powerpc 32bit kernel (built using >>>>> qemu_ppc_mpc8544ds_defconfig >>>>> buildroot config, with enabling DEBUGFS+KMEMLEAK+HIGHMEM in the kernel >>>>> config) > > ... > >>>>> I don't suppose I can just shuffle the calls in setup_arch() around,= =20 >>>>> so I >>>>> wanted to hear your opinions first >>>> I think it's better if we change the logic than shuffling the calls. >>>> IIUC MEMBLOCK_ALLOC_ACCESSIBLE means that __va() works on the phys >>>> address return by memblock, so something like below (untested): >>> MEMBLOCK_ALLOC_ACCESSIBLE means "anywhere", see commit e63075a3c937 >>> ("memblock: Introduce default allocation limit and use it to replace >>> explicit ones"), so it won't help to detect high memory. >>> >>> If I remember correctly, ppc initializes memblock *very* early, so=20 >>> setting >>> max_low_pfn along with lowmem_end_addr in >>> arch/powerpc/mm/init_32::MMU_init() makes sense to me. >>> >>> Maybe ppc folks have other ideas... >>> I've added Christophe who works on ppc32 these days. > > I think memblock is already available at the end of MMU_init() on PPC32=20 > and at the end of early_setup() on PPC64. It means it is ready when we=20 > enter setup_arch(). > > I tested the change below, it works for me, I don't get any kmemleak=20 > report anymore. > > diff --git a/arch/powerpc/kernel/setup-common.c=20 > b/arch/powerpc/kernel/setup-common.c > index 518ae5aa9410..9f4e50b176c9 100644 > --- a/arch/powerpc/kernel/setup-common.c > +++ b/arch/powerpc/kernel/setup-common.c > @@ -840,6 +840,9 @@ void __init setup_arch(char **cmdline_p) > /* Set a half-reasonable default so udelay does something sensible */ > loops_per_jiffy =3D 500000000 / HZ; > > + /* Parse memory topology */ > + mem_topology_setup(); > + > /* Unflatten the device-tree passed by prom_init or kexec */ > unflatten_device_tree(); The 64-bit/NUMA version of mem_topology_setup() requires the device tree to be unflattened, so I don't think that can work. Setting max_low_pfn etc in MMU_init() as Mike suggested seems more likely to work. But we might need to set it again in mem_topology_setup() though, so that things that change memblock_end_of_DRAM() are reflected, eg. memory limit or crash dump? cheers