* [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
2026-01-14 12:53 ` Fiona Ebner
0 siblings, 1 reply; 2+ messages 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] 2+ messages in thread
* Re: [pve-devel] [PATCH qemu-server 1/1] QemuServer.pm: add support for storing VM memory in /dev/shm
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
@ 2026-01-14 12:53 ` Fiona Ebner
0 siblings, 0 replies; 2+ messages in thread
From: Fiona Ebner @ 2026-01-14 12:53 UTC (permalink / raw)
To: Proxmox VE development discussion; +Cc: Drew Green
Hi,
Am 19.11.25 um 10:50 PM schrieb Drew Green via pve-devel:
> 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".
yes, it is a rather niche use case. You can also add the machine flag
and object via custom '-args' in the VM configuration. Would using that
instead work for you? If yes, I'd rather postpone this, but feel free to
open a feature request on the bugzilla (referring back to your patch),
so we can better track interest from other users.
For completeness, regarding the patch submission: please use 'git
format-patch' to generate the email. And we'd also need a signed CLA and
a Signed-off-by trailer to be able to accept your patch. For details,
see: https://pve.proxmox.com/wiki/Developer_Documentation
Best Regards,
Fiona
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-01-14 12:53 UTC | newest]
Thread overview: 2+ messages (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
2026-01-14 12:53 ` Fiona Ebner
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.