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: <Zz42ehwdXDcX8rIu@smc-140338-bm01>
Date: Wed, 20 Nov 2024 19:20:26 +0000
From: Fan Ni <nifan.cxl@...il.com>
To: Gregory Price <gourry@...rry.net>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org,
	linux-acpi@...r.kernel.org, linux-mm@...ck.org,
	linux-cxl@...r.kernel.org, kernel-team@...a.com,
	Jonathan.Cameron@...wei.com, dan.j.williams@...el.com,
	rrichter@....com, Terry.Bowman@....com, dave.jiang@...el.com,
	ira.weiny@...el.com, alison.schofield@...el.com,
	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, rppt@...nel.org
Subject: Re: [PATCH v6 0/3] memory,x86,acpi: hotplug memory alignment
 advisement

On Wed, Nov 06, 2024 at 10:58:44AM -0500, Gregory Price wrote:
> When physical address regions are not aligned to memory block size,
> the misaligned portion is lost (stranded capacity).
> 
> Block size (min/max/selected) is architecture defined. Most architectures
> tend to use the minimum block size or some simplistic heurist. On x86,
> memory block size increases up to 2GB, and is otherwise fitted to the
> alignment of non-hotplug (i.e. not special purpose memory).
> 
> CXL exposes its memory for management through the ACPI CEDT (CXL Early
> Detection Table) in a field called the CXL Fixed Memory Window.  Per
> the CXL specification, this memory must be aligned to at least 256MB.
> 
> When a CFMW aligns on a size less than the block size, this causes a
> loss of up to 2GB per CFMW on x86.  It is not uncommon for CFMW to be
> allocated per-device - though this behavior is BIOS defined.
> 
> This patch set provides 3 things:
>  1) implement advise/query functions in driverse/base/memory.c to
>     report/query architecture agnostic hotplug block alignment advice.
>  2) update x86 memblock size logic to consider the hotplug advice
>  3) add code in acpi/numa/srat.c to report CFMW alignment advice
> 
> The advisement interfaces are design to be called during arch_init
> code prior to allocator and smp_init.  start_kernel will call these
> through setup_arch() (via acpi and mm/init_64.c on x86), which occurs
> prior to mm_core_init and smp_init - so no need for atomics.
> 
> There's an attempt to signal callers to advise() that query has already
> occurred, but this is predicated on the notion that query actually
> occurs (which presently only happens on the x86 arch). This is to
> assist debugging future users.  Otherwise, the advise() call has
> been marked __init to help static discovery of bad call times.
> 
> Once query is called the first time, it will always return the same value.
> 
> Interfaces return -EBUSY and 0 respectively on systems without hotplug.
> 
> v6:
> - boot_cpu_has -> cpu_feature_enabled() in x86 code
> - ack tags
> 
> Suggested-by: Ira Weiny <ira.weiny@...el.com>
> Suggested-by: David Hildenbrand <david@...hat.com>
> Suggested-by: Dan Williams <dan.j.williams@...el.com>
> Signed-off-by: Gregory Price <gourry@...rry.net>
> 

Tested on a CXL server with a directly attached cxl device, works as
expected.


Tested-by: Fan Ni <fan.ni@...sung.com>

Fan
> Gregory Price (3):
>   memory: implement memory_block_advise/probe_max_size
>   x86: probe memory block size advisement value during mm init
>   acpi,srat: give memory block size advice based on CFMWS alignment
> 
>  arch/x86/mm/init_64.c    | 15 ++++++++----
>  drivers/acpi/numa/srat.c | 12 ++++++++-
>  drivers/base/memory.c    | 53 ++++++++++++++++++++++++++++++++++++++++
>  include/linux/memory.h   | 10 ++++++++
>  4 files changed, 84 insertions(+), 6 deletions(-)
> 
> -- 
> 2.43.0
> 

-- 
Fan Ni (From gmail)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ