linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] memory,acpi: resize memory blocks based on CFMW alignment
@ 2024-10-08  4:43 Gregory Price
  2024-10-08  4:43 ` [PATCH 1/3] memory: extern memory_block_size_bytes and set_memory_block_size_order Gregory Price
                   ` (3 more replies)
  0 siblings, 4 replies; 21+ messages in thread
From: Gregory Price @ 2024-10-08  4:43 UTC (permalink / raw)
  To: linux-cxl, x86, linux-mm, linux-acpi
  Cc: linux-kernel, dave.hansen, luto, peterz, tglx, mingo, bp, hpa,
	david, osalvador, gregkh, rafael, akpm, dan.j.williams,
	Jonathan.Cameron, alison.schofield, rrichter, terry.bowman, lenb,
	dave.jiang, ira.weiny

When physical address capacity is not aligned to the size of a memory
block managed size, the misaligned portion is not mapped - creating
an effective loss of capacity.

This appears to be a calculated decision based on the fact that most
regions would generally be aligned, and the loss of capacity would be
relatively limited. With CXL devices, this is no longer the case.

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.

On X86, memory block capacity increases based on the overall capacity
of the machine - eventually reaching a maximum of 2GB per memory block.
When a CFMW aligns on 256MB, this causes a loss of at least 2GB of
capacity, and in some cases more.

It is also possible for multiple CFMW to be exposed for a single device.
This can happen if a reserved region intersects with the target memory
location of the memory device. This happens on AMD x86 platforms. 

This patch set detects the alignments of all CFMW in the ACPI CEDT,
and changes the memory block size downward to meet the largest common
denomenator of the supported memory regions.

To do this, we needed 3 changes:
    1) extern memory block management functions for the acpi driver
    2) modify x86 to update its cached block size value
    3) add code in acpi/numa/srat.c to do the alignment check

Presently this only affects x86, since this is the only architecture
that implements set_memory_block_size_order.

Presently this appears to only affect x86, and we only mitigated there
since it is the only arch to implement set_memory_block_size_order.

Suggested-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Gregory Price <gourry@gourry.net>

Gregory Price (3):
  memory: extern memory_block_size_bytes and set_memory_block_size_order
  x86/mm: if memblock size is adjusted, update the cached value
  acpi,srat: reduce memory block size if CFMWS has a smaller alignment

 arch/x86/mm/init_64.c    | 17 ++++++++++++--
 drivers/acpi/numa/srat.c | 48 ++++++++++++++++++++++++++++++++++++++++
 drivers/base/memory.c    |  6 +++++
 include/linux/memory.h   |  4 ++--
 4 files changed, 71 insertions(+), 4 deletions(-)

-- 
2.43.0



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

end of thread, other threads:[~2024-10-14 22:40 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-08  4:43 [PATCH 0/3] memory,acpi: resize memory blocks based on CFMW alignment Gregory Price
2024-10-08  4:43 ` [PATCH 1/3] memory: extern memory_block_size_bytes and set_memory_block_size_order Gregory Price
2024-10-08 14:03   ` David Hildenbrand
2024-10-08 14:51     ` Gregory Price
2024-10-08 15:02       ` David Hildenbrand
2024-10-08 15:21         ` Gregory Price
2024-10-08 19:04           ` Ira Weiny
2024-10-08 19:45             ` Gregory Price
2024-10-14 11:54           ` David Hildenbrand
2024-10-14 14:25             ` Gregory Price
2024-10-14 20:32               ` David Hildenbrand
2024-10-14 22:40                 ` Gregory Price
2024-10-08  4:43 ` [PATCH 2/3] x86/mm: if memblock size is adjusted, update the cached value Gregory Price
2024-10-08  4:43 ` [PATCH 3/3] acpi,srat: reduce memory block size if CFMWS has a smaller alignment Gregory Price
2024-10-08 14:58   ` Ira Weiny
2024-10-08 15:17     ` Gregory Price
2024-10-08 16:46       ` Dan Williams
2024-10-14 11:50         ` David Hildenbrand
2024-10-08 19:02       ` Ira Weiny
2024-10-08 14:38 ` [PATCH 0/3] memory,acpi: resize memory blocks based on CFMW alignment Ira Weiny
2024-10-08 14:49   ` Gregory Price

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