All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v7 1/1] numa: add memmap-type option for memory type configuration
@ 2026-05-21 10:41 Huang, FangSheng (Jerry)
  2026-05-21 14:07 ` Igor Mammedov
  0 siblings, 1 reply; 12+ messages in thread
From: Huang, FangSheng (Jerry) @ 2026-05-21 10:41 UTC (permalink / raw)
  To: Igor Mammedov
  Cc: qemu-devel, David Hildenbrand, Gregory Price, Zhigang Luo,
	Lianjie Shi

Hi Igor,

Thanks for the candor in this round, and for laying out the
architectural reasoning rather than just the position. The framing is
clear: an RFC with a rough prototype demonstrating the device-based
approach, and the interface decision after that exploration
converges. That's a reasonable bar and I'm glad to converge on it.

Two of your clarifications particularly helped me converge:

- SPM belongs to the memory-device family by design, not as an
   extension of built-in RAM.

- The v4 -object/backend-property rejection is scoped to that form,
   not to any device-based shape -- so `-device spm-memory` doesn't
   carry the v4 risk forward.

One thing I should mention while we're aligning: in parallel with
this thread, I've actually been prototyping the spm-memory device
direction you outlined. I held off bringing it into the v7
discussion because I didn't want to muddy the interface debate with
implementation specifics before the direction was settled. Now that
you've made the path explicit, I can share what I've found and move
the discussion to the v8 / RFC thread properly.

A short prototype status and a couple of architectural findings
below. Some you've likely thought through already; raising them so
the v8 thread has a starting point.

(1) Prototype status

A working `spm-memory` prototype inheriting from TYPE_MEMORY_DEVICE
-- end-to-end verified on both SeaBIOS and OVMF across single,
multi-instance, and mixed-with-pc-dimm scenarios.

(2) Umbrella overlap finding + proposed mitigation for your read

The umbrella SRAT entry at acpi-build.c:1510-1515 (PXM =
nb_numa_nodes - 1, covering the full device_memory length per
pc.c:615) overlaps every per-device entry by construction. Any
driver that first-match-by-PXM via SRAT walk lands on the
umbrella's range rather than the device's actual range.

Mitigation in the prototype: in acpi-build.c, skip the umbrella
when every plugged memory device is TYPE_SPM_MEMORY. Empty
device_memory and mixed configs (SPM + pc-dimm / nvdimm /
virtio-mem) keep the umbrella, preserving Windows hotplug /
Linux <4G SWIOTLB. Verified in both directions. Honest scoping:
mixed mode still has the overlap, so this is a partial
mitigation.

(3) Process

I'll prepare a v8 PATCH series along the lines you sketched:

   - spm-memory device class (TYPE_MEMORY_DEVICE base for first cut)
   - drop the `reserved` enum value
   - commit message with the bigger-picture rationale

I'll post the RFC on qemu-devel under a fresh subject so the 
device-based discussion can start clean.

Setting the v7 memmap-type discussion aside accordingly. Thanks
again for the patience.

Best regards,
FangSheng Huang (Jerry)


^ permalink raw reply	[flat|nested] 12+ messages in thread
* [PATCH v7 0/1] numa: add 'memmap-type' option for memory type configuration
@ 2026-03-06  8:27 fanhuang
  2026-03-06  8:27 ` [PATCH v7 1/1] " fanhuang
  0 siblings, 1 reply; 12+ messages in thread
From: fanhuang @ 2026-03-06  8:27 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 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(-)

-- 
2.34.1



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

end of thread, other threads:[~2026-05-21 14:08 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-21 10:41 [PATCH v7 1/1] numa: add memmap-type option for memory type configuration Huang, FangSheng (Jerry)
2026-05-21 14:07 ` Igor Mammedov
  -- strict thread matches above, loose matches on Subject: below --
2026-03-06  8:27 [PATCH v7 0/1] numa: add 'memmap-type' " fanhuang
2026-03-06  8:27 ` [PATCH v7 1/1] " fanhuang
2026-05-14 13:05   ` Igor Mammedov
2026-05-14 13:38     ` Gregory Price
2026-05-18  8:15       ` David Hildenbrand (Arm)
2026-05-15  7:53     ` Huang, FangSheng (Jerry)
2026-05-15 13:04       ` Igor Mammedov
2026-05-18 10:43         ` Huang, FangSheng (Jerry)
2026-05-18 14:32           ` Igor Mammedov
2026-05-19  4:18             ` Huang, FangSheng (Jerry)
2026-05-20 12:41               ` Igor Mammedov

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.