* [pve-devel] [PATCH qemu-server 1/1] QemuServer.pm: add support for storing VM memory in /dev/shm
@ 2025-11-19 21:50 Drew Green via pve-devel
0 siblings, 0 replies; only message in thread
From: Drew Green via pve-devel @ 2025-11-19 21:50 UTC (permalink / raw)
To: pve-devel; +Cc: Drew Green
[-- Attachment #1: Type: message/rfc822, Size: 7347 bytes --]
From: Drew Green <agreenbhm@gmail.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu-server 1/1] QemuServer.pm: add support for storing VM memory in /dev/shm
Date: Wed, 19 Nov 2025 16:50:03 -0500
Message-ID: <CANDN8xF4U2-C=RGbJtn6y1i_ojHw0FrSc6y39+Rewha98rh8tg@mail.gmail.com>
PVE supports the VM option "ivshmem" which creates a memory-backed file on
the host operating system in /dev/shm to allow sharing resources between
the guest and host and other guests. There is currently no support for
utilizing the Qemu feature to make the guest's system memory available via
the filesystem, which can be useful for experimentation and testing
purposes. This patch adds an additional boolean option to the existing
"ivshmem" configuration called "ram", which when set to 1 will store the
guest's memory in the same location in /dev/shm that "ivshmem" normally
would. Additional logic is added to support that option, such as adding an
additional "-machine" argument required for this and excluding the
"-device" argument normally required for traditional "ivshmem".
--- PVE/QemuServer.pm 2025-11-19 21:33:15.962832901 +0000
+++ PVE/QemuServer.pm 2025-11-19 21:36:40.390068876 +0000
@@ -199,6 +199,13 @@
description =>
"The name of the file. Will be prefixed with 'pve-shm-'.
Default is the VMID. Will be deleted when the VM is stopped.",
},
+ ram => {
+ type => 'boolean',
+ optional => 1,
+ default => 0,
+ description =>
+ "Whether to use Inter-VM Shared Memory as backing for VM's RAM.",
+ },
};
my $audio_fmt = {
@@ -3711,17 +3718,21 @@
if ($conf->{ivshmem}) {
my $ivshmem = parse_property_string($ivshmem_fmt,
$conf->{ivshmem});
- my $bus;
- if ($q35) {
- $bus = print_pcie_addr("ivshmem");
+ if (!$ivshmem->{ram}) {
+ my $bus;
+ if ($q35) {
+ $bus = print_pcie_addr("ivshmem");
+ } else {
+ $bus = print_pci_addr("ivshmem", $bridges, $arch);
+ }
+ push @$devices, '-device', "ivshmem-plain,memdev=ivshmem$bus,";
} else {
- $bus = print_pci_addr("ivshmem", $bridges, $arch);
- }
+ push @$machineFlags, 'memory-backend=ivshmem';
+ }
my $ivshmem_name = $ivshmem->{name} // $vmid;
my $path = '/dev/shm/pve-shm-' . $ivshmem_name;
- push @$devices, '-device', "ivshmem-plain,memdev=ivshmem$bus,";
push @$devices, '-object',
"memory-backend-file,id=ivshmem,share=on,mem-path=$path" .
",size=$ivshmem->{size}M";
}
--
Drew Green
www.drewgreen.net
PGP: 17BDDD7E
<https://pgp.mit.edu/pks/lookup?op=get&search=0x37F838ED17BDDD7E>
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-11-19 21:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-19 21:50 [pve-devel] [PATCH qemu-server 1/1] QemuServer.pm: add support for storing VM memory in /dev/shm Drew Green via pve-devel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox