[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240719191602.000075d2@Huawei.com>
Date: Fri, 19 Jul 2024 19:16:02 +0100
From: Jonathan Cameron <Jonathan.Cameron@...wei.com>
To: Mike Rapoport <rppt@...nel.org>
CC: <linux-kernel@...r.kernel.org>, Alexander Gordeev
<agordeev@...ux.ibm.com>, Andreas Larsson <andreas@...sler.com>, "Andrew
Morton" <akpm@...ux-foundation.org>, Arnd Bergmann <arnd@...db.de>, "Borislav
Petkov" <bp@...en8.de>, Catalin Marinas <catalin.marinas@....com>, Christophe
Leroy <christophe.leroy@...roup.eu>, Dan Williams <dan.j.williams@...el.com>,
Dave Hansen <dave.hansen@...ux.intel.com>, David Hildenbrand
<david@...hat.com>, "David S. Miller" <davem@...emloft.net>, Greg
Kroah-Hartman <gregkh@...uxfoundation.org>, Heiko Carstens
<hca@...ux.ibm.com>, Huacai Chen <chenhuacai@...nel.org>, Ingo Molnar
<mingo@...hat.com>, Jiaxun Yang <jiaxun.yang@...goat.com>, "John Paul Adrian
Glaubitz" <glaubitz@...sik.fu-berlin.de>, Michael Ellerman
<mpe@...erman.id.au>, Palmer Dabbelt <palmer@...belt.com>, "Rafael J.
Wysocki" <rafael@...nel.org>, Rob Herring <robh@...nel.org>, "Thomas
Bogendoerfer" <tsbogend@...ha.franken.de>, Thomas Gleixner
<tglx@...utronix.de>, Vasily Gorbik <gor@...ux.ibm.com>, Will Deacon
<will@...nel.org>, <linux-arm-kernel@...ts.infradead.org>,
<loongarch@...ts.linux.dev>, <linux-mips@...r.kernel.org>,
<linuxppc-dev@...ts.ozlabs.org>, <linux-riscv@...ts.infradead.org>,
<linux-s390@...r.kernel.org>, <linux-sh@...r.kernel.org>,
<sparclinux@...r.kernel.org>, <linux-acpi@...r.kernel.org>,
<linux-cxl@...r.kernel.org>, <nvdimm@...ts.linux.dev>,
<devicetree@...r.kernel.org>, <linux-arch@...r.kernel.org>,
<linux-mm@...ck.org>, <x86@...nel.org>
Subject: Re: [PATCH 16/17] arch_numa: switch over to numa_memblks
On Tue, 16 Jul 2024 14:13:45 +0300
Mike Rapoport <rppt@...nel.org> wrote:
> From: "Mike Rapoport (Microsoft)" <rppt@...nel.org>
>
> Until now arch_numa was directly translating firmware NUMA information
> to memblock.
>
> Using numa_memblks as an intermediate step has a few advantages:
> * alignment with more battle tested x86 implementation
> * availability of NUMA emulation
> * maintaining node information for not yet populated memory
>
> Replace current functionality related to numa_add_memblk() and
> __node_distance() with the implementation based on numa_memblks and add
> functions required by numa_emulation.
>
> Signed-off-by: Mike Rapoport (Microsoft) <rppt@...nel.org>
One trivial comment inline,
Jonathan
> /*
> * Initialize NODE_DATA for a node on the local memory
> */
> @@ -226,116 +204,9 @@ static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn)
> NODE_DATA(nid)->node_spanned_pages = end_pfn - start_pfn;
> }
>
> @@ -454,3 +321,54 @@ void __init arch_numa_init(void)
>
> numa_init(dummy_numa_init);
> }
> +
> +#ifdef CONFIG_NUMA_EMU
> +void __init numa_emu_update_cpu_to_node(int *emu_nid_to_phys,
> + unsigned int nr_emu_nids)
> +{
> + int i, j;
> +
> + /*
> + * Transform __apicid_to_node table to use emulated nids by
Comment needs an update seeing as there is no __apicid_to_node table
here.
> + * reverse-mapping phys_nid. The maps should always exist but fall
> + * back to zero just in case.
> + */
> + for (i = 0; i < ARRAY_SIZE(cpu_to_node_map); i++) {
> + if (cpu_to_node_map[i] == NUMA_NO_NODE)
> + continue;
> + for (j = 0; j < nr_emu_nids; j++)
> + if (cpu_to_node_map[i] == emu_nid_to_phys[j])
> + break;
> + cpu_to_node_map[i] = j < nr_emu_nids ? j : 0;
> + }
> +}
> +
> +u64 __init numa_emu_dma_end(void)
> +{
> + return PFN_PHYS(memblock_start_of_DRAM() + SZ_4G);
> +}
Powered by blists - more mailing lists