From patchwork Wed Aug 7 06:40:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13755843 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4488CC52D6F for ; Wed, 7 Aug 2024 06:50:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rd8KSI0loS5alh2BkoRwt4vQ7eO0tVJ5EXQXPz4fl0M=; b=WVhhfTCf0wkIzV +kaYGk3AAldIUt5wkG9H7SqmVOx+DSix1gz14hFzm0w3j13WwP/HfG27VZp5+dqDNB1kpI4qOa+3W 8KhVourMiWTy3x7SQcvguplEsIvqOubwUpz4+Ij2OQBtLL1VHSWKeniHMM4vSLhKCL2+A6RGFCNqG DRmZdx7hSeLcy6NOuPOBpugXJlMoz+MFvTF+8lEXtxmVtidB72ROnVgLRF2IvPzhI4H/HRuobqtk/ 8HHPfWXdF7nrUBTO9GE/7uDKw4wPCg+O50x4GXcmTBUHDnYa+ul+IgxqWFEDLkwPTy6xapEYsEyWI PUo5kpIR6rF/MmnlwXzw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sbaVU-000000045Iw-3ERq; Wed, 07 Aug 2024 06:50:48 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sbaP4-0000000421j-1ySH; Wed, 07 Aug 2024 06:44:12 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id A0347CE0CF2; Wed, 7 Aug 2024 06:44:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34388C4AF0E; Wed, 7 Aug 2024 06:43:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723013047; bh=QDF0U8QlawtqeT1NfRWfgk6Ztj16qIvsn11RQ3DyQoE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PhQ805wYlvX3eC1aoinqgplf1Qch2y+Fs8pNFYaDs9OngkD16ya6T8zdMurHDrVEQ IUdlTUAp/LTQ9stjhlsQz7mLNoxgi85TwPJl1I8W2VIf35ybs53CSoAPaDDNVfdFOb wdIXMOEwJAfcGil2uGFN7ue/Z15y9iuwnUFzCLb7HGA/bWj4noYJOFjD46H+bAX+UJ spPzo2/5QJrBFp1ikul6SIXorZbHadt5AwUrVpwWdP3d8g3l0HjNHehJmTisYEK3Ci RVFiwWFAgVdyF6C+qQpMbtAwk5NzP0TWauk3VLMrkhIpssnn/x0EyntdEb3W6zef+L r7tATnEWIQ2nw== From: Mike Rapoport To: linux-kernel@vger.kernel.org Cc: Alexander Gordeev , Andreas Larsson , Andrew Morton , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Christophe Leroy , Dan Williams , Dave Hansen , David Hildenbrand , "David S. Miller" , Davidlohr Bueso , Greg Kroah-Hartman , Heiko Carstens , Huacai Chen , Ingo Molnar , Jiaxun Yang , John Paul Adrian Glaubitz , Jonathan Cameron , Jonathan Corbet , Michael Ellerman , Mike Rapoport , Palmer Dabbelt , "Rafael J. Wysocki" , Rob Herring , Samuel Holland , Thomas Bogendoerfer , Thomas Gleixner , Vasily Gorbik , Will Deacon , Zi Yan , devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-cxl@vger.kernel.org, linux-doc@vger.kernel.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, loongarch@lists.linux.dev, nvdimm@lists.linux.dev, sparclinux@vger.kernel.org, x86@kernel.org, Jonathan Cameron Subject: [PATCH v4 13/26] x86/numa_emu: simplify allocation of phys_dist Date: Wed, 7 Aug 2024 09:40:57 +0300 Message-ID: <20240807064110.1003856-14-rppt@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240807064110.1003856-1-rppt@kernel.org> References: <20240807064110.1003856-1-rppt@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240806_234410_955473_352FFEE0 X-CRM114-Status: GOOD ( 13.02 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org From: "Mike Rapoport (Microsoft)" By the time numa_emulation() is called, all physical memory is already mapped in the direct map and there is no need to define limits for memblock allocation. Replace memblock_phys_alloc_range() with memblock_alloc(). Signed-off-by: Mike Rapoport (Microsoft) Reviewed-by: Jonathan Cameron Tested-by: Zi Yan # for x86_64 and arm64 Tested-by: Jonathan Cameron [arm64 + CXL via QEMU] Acked-by: Dan Williams Acked-by: David Hildenbrand --- arch/x86/mm/numa_emulation.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/arch/x86/mm/numa_emulation.c b/arch/x86/mm/numa_emulation.c index 1ce22e315b80..439804e21962 100644 --- a/arch/x86/mm/numa_emulation.c +++ b/arch/x86/mm/numa_emulation.c @@ -448,15 +448,11 @@ void __init numa_emulation(struct numa_meminfo *numa_meminfo, int numa_dist_cnt) /* copy the physical distance table */ if (numa_dist_cnt) { - u64 phys; - - phys = memblock_phys_alloc_range(phys_size, PAGE_SIZE, 0, - PFN_PHYS(max_pfn_mapped)); - if (!phys) { + phys_dist = memblock_alloc(phys_size, PAGE_SIZE); + if (!phys_dist) { pr_warn("NUMA: Warning: can't allocate copy of distance table, disabling emulation\n"); goto no_emu; } - phys_dist = __va(phys); for (i = 0; i < numa_dist_cnt; i++) for (j = 0; j < numa_dist_cnt; j++)