All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6 0/1] numa: add 'memmap-type' option for memory type configuration
@ 2026-02-26 10:50 fanhuang
  2026-02-26 10:50 ` [PATCH v6 1/1] " fanhuang
  2026-03-05 12:32 ` [PATCH v6 0/1] " Jonathan Cameron via qemu development
  0 siblings, 2 replies; 10+ messages in thread
From: fanhuang @ 2026-02-26 10:50 UTC (permalink / raw)
  To: qemu-devel, david, imammedo, gourry, jonathan.cameron
  Cc: apopple, dan.j.williams, Zhigang.Luo, Lianjie.Shi, fanhuang

Hi all,

This is v6 of the SPM (Specific Purpose Memory) patch. Thank you for
the feedback on v5, especially Gregory's review.

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

OS-facing test results:

1. memmap-type=spm
~~~~~~~~~~~~~~~~~~

  -numa node,cpus=4-7,nodeid=1,memdev=m1,memmap-type=spm

Guest dmesg output:

  [    0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000027fffffff] usable
  [    0.000000] BIOS-e820: [mem 0x0000000280000000-0x000000047fffffff] soft reserved
  [    0.000000] BIOS-e820: [mem 0x000000fd00000000-0x000000ffffffffff] reserved

  [    0.042582] ACPI: SRAT: Node 1 PXM 1 [mem 0x280000000-0x47fffffff]

2. memmap-type=reserved
~~~~~~~~~~~~~~~~~~~~~~~

  -numa node,cpus=4-7,nodeid=1,memdev=m1,memmap-type=reserved

Guest dmesg output:

  [    0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000027fffffff] usable
  [    0.000000] BIOS-e820: [mem 0x0000000280000000-0x000000047fffffff] reserved
  [    0.000000] BIOS-e820: [mem 0x000000fd00000000-0x000000ffffffffff] reserved

  [    0.042728] ACPI: SRAT: Node 0 PXM 0 [mem 0x00000000-0x0009ffff]
  [    0.042729] ACPI: SRAT: Node 0 PXM 0 [mem 0x00100000-0x7fffffff]
  [    0.042731] ACPI: SRAT: Node 0 PXM 0 [mem 0x100000000-0x27fffffff]

  Note: Node 1 is excluded from SRAT memory affinity entries since v6,
  because E820 already marks it as reserved and it should not be reported
  as enabled memory.

3. normal (default, no memmap-type specified)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  -numa node,cpus=4-7,nodeid=1,memdev=m1

Guest dmesg output:

  [    0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000047fffffff] usable
  [    0.000000] BIOS-e820: [mem 0x000000fd00000000-0x000000ffffffffff] reserved

  [    0.042413] ACPI: SRAT: Node 0 PXM 0 [mem 0x00000000-0x0009ffff]
  [    0.042414] ACPI: SRAT: Node 0 PXM 0 [mem 0x00100000-0x7fffffff]
  [    0.042416] ACPI: SRAT: Node 0 PXM 0 [mem 0x100000000-0x27fffffff]
  [    0.042417] ACPI: SRAT: Node 1 PXM 1 [mem 0x280000000-0x47fffffff]

The results show:
- Node association is correct (Node 1 at 0x280000000-0x47fffffff)
- E820 types are correctly applied (usable/soft reserved/reserved)
- SRAT entries are generated for normal and spm configurations
- Reserved nodes are excluded from SRAT memory affinity (new in v6)

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

-- 
2.34.1



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

end of thread, other threads:[~2026-03-06  5:48 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-26 10:50 [PATCH v6 0/1] numa: add 'memmap-type' option for memory type configuration fanhuang
2026-02-26 10:50 ` [PATCH v6 1/1] " fanhuang
2026-02-27 20:34   ` David Hildenbrand
2026-03-02  9:01     ` Huang, FangSheng (Jerry)
2026-03-04 17:16       ` David Hildenbrand
2026-03-04 17:19   ` Gregory Price
2026-03-05 10:39     ` Huang, FangSheng (Jerry)
2026-03-05 21:06   ` Gregory Price
2026-03-06  5:48     ` Huang, FangSheng (Jerry)
2026-03-05 12:32 ` [PATCH v6 0/1] " Jonathan Cameron via qemu development

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.