lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240802105527.00005240@Huawei.com>
Date: Fri, 2 Aug 2024 10:55:27 +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>, Davidlohr Bueso
	<dave@...olabs.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>, Jonathan Corbet
	<corbet@....net>, Michael Ellerman <mpe@...erman.id.au>, Palmer Dabbelt
	<palmer@...belt.com>, "Rafael J. Wysocki" <rafael@...nel.org>, Rob Herring
	<robh@...nel.org>, Samuel Holland <samuel.holland@...ive.com>, Thomas
 Bogendoerfer <tsbogend@...ha.franken.de>, Thomas Gleixner
	<tglx@...utronix.de>, "Vasily Gorbik" <gor@...ux.ibm.com>, Will Deacon
	<will@...nel.org>, Zi Yan <ziy@...dia.com>, <devicetree@...r.kernel.org>,
	<linux-acpi@...r.kernel.org>, <linux-arch@...r.kernel.org>,
	<linux-arm-kernel@...ts.infradead.org>, <linux-cxl@...r.kernel.org>,
	<linux-doc@...r.kernel.org>, <linux-mips@...r.kernel.org>,
	<linux-mm@...ck.org>, <linux-riscv@...ts.infradead.org>,
	<linux-s390@...r.kernel.org>, <linux-sh@...r.kernel.org>,
	<linuxppc-dev@...ts.ozlabs.org>, <loongarch@...ts.linux.dev>,
	<nvdimm@...ts.linux.dev>, <sparclinux@...r.kernel.org>, <x86@...nel.org>
Subject: Re: [PATCH v3 09/26] arch, mm: pull out allocation of NODE_DATA to
 generic code

On Thu,  1 Aug 2024 09:08:09 +0300
Mike Rapoport <rppt@...nel.org> wrote:

> From: "Mike Rapoport (Microsoft)" <rppt@...nel.org>
> 
> Architectures that support NUMA duplicate the code that allocates
> NODE_DATA on the node-local memory with slight variations in reporting
> of the addresses where the memory was allocated.
> 
> Use x86 version as the basis for the generic alloc_node_data() function
> and call this function in architecture specific numa initialization.
> 
> Round up node data size to SMP_CACHE_BYTES rather than to PAGE_SIZE like
> x86 used to do since the bootmem era when allocation granularity was
> PAGE_SIZE anyway.
> 
> Signed-off-by: Mike Rapoport (Microsoft) <rppt@...nel.org>
> Acked-by: David Hildenbrand <david@...hat.com>
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
> Tested-by: Zi Yan <ziy@...dia.com> # for x86_64 and arm64

One comment unrelated to this patch set as such, just made
more obvious by it.

> diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
> index 0744a9a2944b..3c1da08304d0 100644
> --- a/arch/powerpc/mm/numa.c
> +++ b/arch/powerpc/mm/numa.c
> @@ -1093,27 +1093,9 @@ void __init dump_numa_cpu_topology(void)
>  static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn)
>  {
>  	u64 spanned_pages = end_pfn - start_pfn;

Trivial, but might as well squash this local variable into the
single place it's used.

> -	const size_t nd_size = roundup(sizeof(pg_data_t), SMP_CACHE_BYTES);
> -	u64 nd_pa;
> -	void *nd;
> -	int tnid;
> -
> -	nd_pa = memblock_phys_alloc_try_nid(nd_size, SMP_CACHE_BYTES, nid);
> -	if (!nd_pa)
> -		panic("Cannot allocate %zu bytes for node %d data\n",
> -		      nd_size, nid);
> -
> -	nd = __va(nd_pa);
> -
> -	/* report and initialize */
> -	pr_info("  NODE_DATA [mem %#010Lx-%#010Lx]\n",
> -		nd_pa, nd_pa + nd_size - 1);
> -	tnid = early_pfn_to_nid(nd_pa >> PAGE_SHIFT);
> -	if (tnid != nid)
> -		pr_info("    NODE_DATA(%d) on node %d\n", nid, tnid);
> -
> -	node_data[nid] = nd;
> -	memset(NODE_DATA(nid), 0, sizeof(pg_data_t));
> +
> +	alloc_node_data(nid);
> +
>  	NODE_DATA(nid)->node_id = nid;
>  	NODE_DATA(nid)->node_start_pfn = start_pfn;
>  	NODE_DATA(nid)->node_spanned_pages = spanned_pages;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ