linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v8 0/3] memory,x86,acpi: hotplug memory alignment advisement
@ 2025-01-27 15:34 Gregory Price
  2025-01-27 15:34 ` [PATCH v8 1/3] memory: implement memory_block_advise/probe_max_size Gregory Price
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Gregory Price @ 2025-01-27 15:34 UTC (permalink / raw)
  To: linux-mm, linux-acpi
  Cc: kernel-team, x86, linux-kernel, dave.hansen, luto, peterz, tglx,
	mingo, bp, hpa, rafael, lenb, david, osalvador, gregkh, akpm,
	dan.j.williams, Jonathan.Cameron, alison.schofield, rrichter,
	rppt, gourry, bfaccini, haibo1.xu, dave.jiang, Ira Weiny, Fan Ni

v8: nits and tag pickups

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.

Suggested-by: Ira Weiny <ira.weiny@intel.com>
Suggested-by: David Hildenbrand <david@redhat.com>
Suggested-by: Dan Williams <dan.j.williams@intel.com>
Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Acked-by: David Hildenbrand <david@redhat.com>
Acked-by: Dan Williams <dan.j.williams@intel.com>
Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
Signed-off-by: Gregory Price <gourry@gourry.net>
Tested-by: Fan Ni <fan.ni@samsung.com>

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.48.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2025-04-02 10:07 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-27 15:34 [PATCH v8 0/3] memory,x86,acpi: hotplug memory alignment advisement Gregory Price
2025-01-27 15:34 ` [PATCH v8 1/3] memory: implement memory_block_advise/probe_max_size Gregory Price
2025-04-01 18:50   ` Oscar Salvador
2025-01-27 15:34 ` [PATCH v8 2/3] x86: probe memory block size advisement value during mm init Gregory Price
2025-04-01 18:51   ` Oscar Salvador
2025-01-27 15:34 ` [PATCH v8 3/3] acpi,srat: give memory block size advice based on CFMWS alignment Gregory Price
2025-04-01 18:52   ` Oscar Salvador
2025-04-01 18:33 ` [PATCH v8 0/3] memory,x86,acpi: hotplug memory alignment advisement Gregory Price
2025-04-01 18:53 ` Oscar Salvador
2025-04-01 19:08   ` David Hildenbrand
2025-04-02  9:39     ` Mike Rapoport
2025-04-02 10:07       ` David Hildenbrand
2025-04-01 19:44   ` Dan Williams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).