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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <67857cd2524a9_1863f3294d8@iweiny-mobl.notmuch>
Date: Mon, 13 Jan 2025 14:51:30 -0600
From: Ira Weiny <ira.weiny@...el.com>
To: Gregory Price <gourry@...rry.net>, <linux-mm@...ck.org>,
	<linux-acpi@...r.kernel.org>
CC: <kernel-team@...a.com>, <x86@...nel.org>, <linux-kernel@...r.kernel.org>,
	<dave.hansen@...ux.intel.com>, <luto@...nel.org>, <peterz@...radead.org>,
	<tglx@...utronix.de>, <mingo@...hat.com>, <bp@...en8.de>, <hpa@...or.com>,
	<rafael@...nel.org>, <lenb@...nel.org>, <david@...hat.com>,
	<osalvador@...e.de>, <gregkh@...uxfoundation.org>,
	<akpm@...ux-foundation.org>, <dan.j.williams@...el.com>,
	<Jonathan.Cameron@...wei.com>, <alison.schofield@...el.com>,
	<rrichter@....com>, <rppt@...nel.org>, <gourry@...rry.net>,
	<bfaccini@...dia.com>, <haibo1.xu@...el.com>, <dave.jiang@...el.com>, "Ira
 Weiny" <ira.weiny@...el.com>, Fan Ni <fan.ni@...sung.com>
Subject: Re: [RESEND v7 1/3] memory: implement
 memory_block_advise/probe_max_size

Gregory Price wrote:
> Hotplug memory sources may have opinions on what the memblock size
> should be - usually for alignment purposes.  For example, CXL memory
> extents can be 256MB with a matching alignment. If this size/alignment
> is smaller than the block size, it can result in stranded capacity.
> 
> Implement memory_block_advise_max_size for use prior to allocator init,
> for software to advise the system on the max block size.
> 
> Implement memory_block_probe_max_size for use by arch init code to
> calculate the best block size. Use of advice is architecture defined.
> 
> The probe value can never change after first probe. Calls to advise
> after probe will return -EBUSY to aid debugging.
> 
> On systems without hotplug, always return -ENODEV and 0 respectively.
> 
> Suggested-by: Ira Weiny <ira.weiny@...el.com>
> Signed-off-by: Gregory Price <gourry@...rry.net>
> Acked-by: David Hildenbrand <david@...hat.com>
> Acked-by: Mike Rapoport (Microsoft) <rppt@...nel.org>
> Acked-by: Dan Williams <dan.j.williams@...el.com>
> Tested-by: Fan Ni <fan.ni@...sung.com>
> ---

[snip]

> +int __init memory_block_advise_max_size(unsigned long size)
> +{
> +	if (!size || !is_power_of_2(size))
> +		return -EINVAL;
> +
> +	if (memory_block_advised_size_queried)
> +		return -EBUSY;
> +
> +	if (memory_block_advised_size) {
> +		memory_block_advised_size = min(memory_block_advised_size,
> +						size);
> +	} else {
> +		memory_block_advised_size = size;
> +	}

NIT: Style: single statements don't need '{}'

Other than that it looks ok.

Reviewed-by: Ira Weiny <ira.weiny@...el.com>

[snip]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ