Skip to content

numa: add 'memmap-type' option for memory type configuration

fanhuang qemu-devel 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v7 Latest1 patch 14 repliesIn review
  2. v61 patch 8 repliesSuperseded
  3. v5 posting 3/31 patch 3 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v5 posting 2/30 of 1 patch0 repliesSuperseded
v5 posting 1/31 patch0 repliesSuperseded

Changes in v7 from the cover letter

- Fixed pc_update_numa_memory_types() to use x86ms->above_4g_mem_start instead of hardcoded 0x100000000ULL (4 GiB). On AMD hosts with IOMMU, above_4g_mem_start is relocated to above 1 TB, so the hardcode would produce wrong guest physical addresses. (spotted by Gregory Price)

Patches in v7 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1numa: add 'memmap-type' option for memory type configurationhw/core/numa.c hw/i386/acpi-build.c hw/i386/e820_memory_layout.c +5 more+202 -79 replies

Reviews trailers per patch

The patch has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchDavid HildenbrandGregory Price
SeriesA-b R-b R-b
1/1A-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v7 thread

Cover letter [PATCH v7 0/1] numa: add 'memmap-type' option for memory type configuration

Hi all,

This is v7 of the SPM (Specific Purpose Memory) patch. Thank you David for the Acked-by, and Gregory for the Reviewed-by and for catching the hardcoded address bug.

Changes in v7:
- Fixed pc_update_numa_memory_types() to use x86ms->above_4g_mem_start instead of hardcoded 0x100000000ULL (4 GiB). On AMD hosts with IOMMU, above_4g_mem_start is relocated to above 1 TB, so the hardcode would produce wrong guest physical addresses. (spotted by Gregory Price)

Changes in v6:
- Added validation: memmap-type now requires memdev to be specified, to avoid misconfiguration on memory-less NUMA nodes
- Simplified pc_update_numa_memory_types() by replacing switch/goto with a direct conditional expression
- Reserved memory nodes are now excluded from SRAT memory affinity entries, since E820 already marks them as reserved and SRAT should not report them as enabled memory affinity

Use case:
This feature allows marking NUMA node memory as Specific Purpose Memory (SPM) or reserved in the E820 table. SPM serves as a hint to the guest that this memory might be managed by device drivers based on guest policy

Example usage:
-object memory-backend-ram,size=8G,id=m0
-object memory-backend-memfd,size=8G,id=m1
-numa node,nodeid=0,memdev=m0
-numa node,nodeid=1,memdev=m1,memmap-type=spm

Supported memmap-type values:
- normal: Regular system RAM (E820 type 1, default)
- spm: Specific Purpose Memory (E820 type 0xEFFFFFFF), a hint
that this memory might be managed by device drivers
- reserved: Reserved memory (E820 type 2), not usable as RAM

Please review. Thanks!

Best regards,
Jerry Huang

fanhuang (1):
numa: add 'memmap-type' option for memory type configuration

 hw/core/numa.c               | 24 ++++++++++++
 hw/i386/acpi-build.c         |  8 ++++
 hw/i386/e820_memory_layout.c | 72 ++++++++++++++++++++++++++++++++++++
 hw/i386/e820_memory_layout.h | 12 +++---
 hw/i386/pc.c                 | 48 ++++++++++++++++++++++++
 include/system/numa.h        |  7 ++++
 qapi/machine.json            | 24 ++++++++++++
 qemu-options.hx              | 14 ++++++-
 8 files changed, 202 insertions(+), 7 deletions(-)
Signature · 1 line
2.34.1