From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A132161321; Fri, 29 Nov 2024 08:42:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732869780; cv=none; b=V46iyoOv8YTlE3eTNOrWIov5iUsPiKTQw1j6Q+lPanKj6cDN1e3PWBbnMs0RUFiTDgdzseadhoatHD90BICfvln3DzdmJRFI/g8W+r//I0g8krl0ttzswzdNUj88NsKL6h2gk2TJM1kM46Itx3QR++Fy35SPDJ96qWQUOLqvio8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732869780; c=relaxed/simple; bh=Ym0SI+xT22Jv1VQDGHdVIS9SkKv1ncTsD1r7VAkDhlg=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=WgoviD+zJkxWhzr6LUJW7vYMfEzCp+IKnSzPRXwJhAVtKRw662mh8sv8b/UN+TZi2TRiDXDm+F+sptjGUny8q6618sm+ry1v81HZhA5YLw/vCqH2uE/V0uB/+O7YZVdU8/tKu1qoYwPxpVs54Yk9UgGvdLkUVWS4VkquRKygpJ0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VLtFe4Ec; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VLtFe4Ec" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81501C4CECF; Fri, 29 Nov 2024 08:42:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1732869779; bh=Ym0SI+xT22Jv1VQDGHdVIS9SkKv1ncTsD1r7VAkDhlg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=VLtFe4EcqNg44BIJ7tT2mz7OirCn7zFZs03fmrbhLJSZ7iv2otSL12SGP4MgbITGw UhVqAsT3RvlQ6UwUmaqX88OFr2E7rRNCGDOBFOq8IZVSEuSY1M1Jkv8PVW98ayfMyw mwS2KxrxX0t8xrQ+MMq1KGxKyEd8JhP2BwEjVFtexPrkFk/AnLI5keNSu63cFYAkJs f0JIbcSXQ3KnRTJiLdtUcdftj1zFKi0bgeu0cSxChU0L1jJhJR7iJVHRN/uBilBbLY qOH5qtDZUH92n99fPTLj1UwrYCp5L71YHfSde8rs2ts/zaCy4WR4VYhabI1LRZOLLe 7PNIcoCyVsOsA== Received: from [37.169.128.218] (helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tGwaW-00GhG0-RA; Fri, 29 Nov 2024 08:42:57 +0000 Date: Fri, 29 Nov 2024 08:42:55 +0000 Message-ID: <87v7w6sa5s.wl-maz@kernel.org> From: Marc Zyngier To: Mike Rapoport Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Catalin Marinas , Will Deacon , Zi Yan , Dan Williams , David Hildenbrand , Andrew Morton , stable@vger.kernel.org Subject: Re: [PATCH] arch_numa: Restore nid checks before registering a memblock with a node In-Reply-To: References: <20241127193000.3702637-1-maz@kernel.org> <87y113s3lt.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.4 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 37.169.128.218 X-SA-Exim-Rcpt-To: rppt@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will@kernel.org, ziy@nvidia.com, dan.j.williams@intel.com, david@redhat.com, akpm@linux-foundation.org, stable@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Fri, 29 Nov 2024 08:24:16 +0000, Mike Rapoport wrote: > > On Thu, Nov 28, 2024 at 04:52:14PM +0000, Marc Zyngier wrote: > > Hi Mike, > > > > On Thu, 28 Nov 2024 07:03:33 +0000, > > Mike Rapoport wrote: > > > > > > Hi Marc, > > > > > > > diff --git a/drivers/base/arch_numa.c b/drivers/base/arch_numa.c > > > > index e187016764265..5457248eb0811 100644 > > > > --- a/drivers/base/arch_numa.c > > > > +++ b/drivers/base/arch_numa.c > > > > @@ -207,7 +207,21 @@ static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn) > > > > static int __init numa_register_nodes(void) > > > > { > > > > int nid; > > > > - > > > > + struct memblock_region *mblk; > > > > + > > > > + /* Check that valid nid is set to memblks */ > > > > + for_each_mem_region(mblk) { > > > > + int mblk_nid = memblock_get_region_node(mblk); > > > > + phys_addr_t start = mblk->base; > > > > + phys_addr_t end = mblk->base + mblk->size - 1; > > > > + > > > > + if (mblk_nid == NUMA_NO_NODE || mblk_nid >= MAX_NUMNODES) { > > > > + pr_warn("Warning: invalid memblk node %d [mem %pap-%pap]\n", > > > > + mblk_nid, &start, &end); > > > > + return -EINVAL; > > > > + } > > > > > > We have memblock_validate_numa_coverage() that checks that amount of memory > > > with unset node id is less than a threshold. The loop here can be replaced > > > with something like > > > > > > if (!memblock_validate_numa_coverage(0)) > > > return -EINVAL; > > > > Unfortunately, that doesn't seem to result in something that works > > (relevant extract only): > > > > [ 0.000000] NUMA: no nodes coverage for 9MB of 65516MB RAM > > [ 0.000000] NUMA: Faking a node at [mem 0x0000000000500000-0x0000000fff0fffff] > > [ 0.000000] NUMA: no nodes coverage for 0MB of 65516MB RAM > > [ 0.000000] Unable to handle kernel paging request at virtual address 0000000000001d40 > > > > Any idea? > > With 0 as the threshold the validation fails for the fake node, but it > should be fine with memblock_validate_numa_coverage(1) Huh, subtle. This indeed seems to work. I'll respin the patch next week. Thanks for your help, M. -- Without deviation from the norm, progress is not possible.