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

fanhuang posted 1 patch 2 weeks, 1 day ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260123024312.1601732-1-FangSheng.Huang@amd.com
Maintainers: Eduardo Habkost <eduardo@habkost.net>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Yanan Wang <wangyanan55@huawei.com>, Zhao Liu <zhao1.liu@intel.com>, Paolo Bonzini <pbonzini@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, "Michael S. Tsirkin" <mst@redhat.com>, Eric Blake <eblake@redhat.com>, Markus Armbruster <armbru@redhat.com>
[PATCH v5 0/1] numa: add 'memmap-type' option for memory type configuration
Posted by fanhuang 2 weeks, 1 day ago
Hi all,

This is v5 of the SPM (Specific Purpose Memory) patch. Thank you for
the feedback on v4.

Changes in v5:
- Renamed 'spm=on|off' to 'memmap-type=normal|spm|reserved' enum
  (per Gregory's suggestion for better extensibility)
- Updated QAPI schema with new NumaMemmapType enum
- Updated documentation to describe SPM as a policy hint
  (per Jonathan's feedback)

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

-- 
2.34.1
Re: [PATCH v5 0/1] numa: add 'memmap-type' option for memory type configuration
Posted by Huang, FangSheng (Jerry) 1 week, 4 days ago
On 1/23/2026 10:43 AM, fanhuang wrote:
> Hi all,
> 
> This is v5 of the SPM (Specific Purpose Memory) patch. Thank you for
> the feedback on v4.
> 
> Changes in v5:
> - Renamed 'spm=on|off' to 'memmap-type=normal|spm|reserved' enum
>    (per Gregory's suggestion for better extensibility)
> - Updated QAPI schema with new NumaMemmapType enum
> - Updated documentation to describe SPM as a policy hint
>    (per Jonathan's feedback)
> 
> 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
> 
Hi all,

Here are the OS-facing test results showing E820 and ACPI SRAT data for
different memmap-type configurations:

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.042578] ACPI: SRAT: Node 0 PXM 0 [mem 0x00000000-0x0009ffff]
   [    0.042580] ACPI: SRAT: Node 0 PXM 0 [mem 0x00100000-0x7fffffff]
   [    0.042581] ACPI: SRAT: Node 0 PXM 0 [mem 0x100000000-0x27fffffff]
   [    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]
   [    0.042732] ACPI: SRAT: Node 1 PXM 1 [mem 0x280000000-0x47fffffff]

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 all configurations