From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id B62AA1FF183 for ; Wed, 19 Nov 2025 22:50:51 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A6331185BF; Wed, 19 Nov 2025 22:50:54 +0100 (CET) Date: Wed, 19 Nov 2025 16:50:03 -0500 To: pve-devel@lists.proxmox.com MIME-Version: 1.0 Message-ID: List-Id: Proxmox VE development discussion List-Post: From: Drew Green via pve-devel Precedence: list Cc: Drew Green X-Mailman-Version: 2.1.29 X-BeenThere: pve-devel@lists.proxmox.com List-Subscribe: , List-Unsubscribe: , List-Archive: Reply-To: Proxmox VE development discussion List-Help: Subject: [pve-devel] [PATCH qemu-server 1/1] QemuServer.pm: add support for storing VM memory in /dev/shm Content-Type: multipart/mixed; boundary="===============1581496158008585562==" Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" --===============1581496158008585562== Content-Type: message/rfc822 Content-Disposition: inline Return-Path: X-Original-To: pve-devel@lists.proxmox.com Delivered-To: pve-devel@lists.proxmox.com Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id F3D35E2278 for ; Wed, 19 Nov 2025 22:50:53 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id C7AB018565 for ; Wed, 19 Nov 2025 22:50:23 +0100 (CET) Received: from mail-qv1-xf2d.google.com (mail-qv1-xf2d.google.com [IPv6:2607:f8b0:4864:20::f2d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Wed, 19 Nov 2025 22:50:22 +0100 (CET) Received: by mail-qv1-xf2d.google.com with SMTP id 6a1803df08f44-8823d5127daso2299716d6.0 for ; Wed, 19 Nov 2025 13:50:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763589015; x=1764193815; darn=lists.proxmox.com; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=U+4OsX2Qo06pcsiQd3t8QKuf/qycvam8u5vh0z7Sco8=; b=E+WNj28uDHD3rrwaAw/1e9RJXOycD0UxiDq/dW+v2V8yZkyIcXxf2jTJuD0GLx/AI7 mUuI5MNQNN5ISnZVq20fGVDY2ncHalh0VQ2fkf7bVQLAQ8xt+XR1yRVz04iC1+Dai0eB Qg8H6gWq3pTCiKDgK5GZNugSG69m18dAqGDeBudi1gbPtPOF6Ikp/fUjN9UEouC2Fodz b7bSYMpnlFF3vr9SjWDHdCprOvwD/s/Bl+VazP87SLRMNbadKMChVeSotVagw3rs3JVw B6JvBWde+YISIeTR8ayi7YEDQml67NASFhf1XB+Cp+LiC35E+n2GVtr9aMGEJi3NNRnY l7Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763589015; x=1764193815; h=to:subject:message-id:date:from:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=U+4OsX2Qo06pcsiQd3t8QKuf/qycvam8u5vh0z7Sco8=; b=XTNNzeuDKhfCbuWeFJt5oldchwRJpTMiS9+1Gop3h3iIPFJV/uop0AmxRnKEAOMVuu yLOAGBMCu71hfWqWAEY1upYH74XkgIo7ExXRtEaZAU8FUZ2mIR0jzzzUo59yH+XSBcSn MIKk8dgz2M7kmyfq5LiEfNt4Np57uB+hCAg+6/hLaL5+DrOzIYrOuM66FQMtgral4BO9 WjrPfLfMNmAMPK6oXnv2u0q7/JUiRmsCMx5kwj8ilvjXNXfyTq13x9fZ62c/Z9qk9A3l +CVn4JB5Nd5tyNQewAnIG+y63pDP/AQLjGgoAcmOBN1jGUxX0y+m81c2mNfG+QCMOG1I Vt1w== X-Gm-Message-State: AOJu0Yw/7TkWAoostgswzhWfKBnv02j88GvRidZag5WTGgofF1se5tYJ 0B5I5oZjGJ6lEK8l7Iaftwmqf+sJzwZK5hkyJrZV+8ekXQac876gFYtDwxzSC9aZNIGttMysl3s f/+7nylnRcujxgitlRwfhQMTj0QuVs8ALH/nf X-Gm-Gg: ASbGncuw0plrZTiO3ZMBsVqY+C9qzCEVskceJI/YdcmsaX1tNqTNCqtuI/Ni4JyX+hU qmsgKaFAT87YeufuPymIRcQbqRlgUcMP+BNNYVslIAxWUM3WKogp5zn3gEPb3CGK5rP5Z5vl031 wozuTcqbb1i1m4WiL7MdxyDdLuqWZL+mlhXDfcX1Fkx1tcXRBvSwMbCTe/YLGE4X7cd3G7mC0bO Asl+Tf7zQFC9lvSpgWNhRVvt3CODH6/gcauokJ40JqdxuKZOtxzLeqQSolYbYYb0Wc= X-Google-Smtp-Source: AGHT+IG3XOyui+gWf1BwLzM9yEoxgHlPClHqHKnd61qELG1kGOVFbGdWBTMfMJKPa0zTKjk7NDet0UO571vS3jlrLQg= X-Received: by 2002:a05:6214:3f8b:b0:880:4789:8fa3 with SMTP id 6a1803df08f44-8846edec4camr8418256d6.30.1763589014506; Wed, 19 Nov 2025 13:50:14 -0800 (PST) MIME-Version: 1.0 From: Drew Green Date: Wed, 19 Nov 2025 16:50:03 -0500 X-Gm-Features: AWmQ_bnGZNGakqqfs1AGMXO0dB2MNArltbXAoVmHbCk-g-FZJMHoFlq1aIcbJo4 Message-ID: Subject: [PATCH qemu-server 1/1] QemuServer.pm: add support for storing VM memory in /dev/shm To: pve-devel@lists.proxmox.com X-SPAM-LEVEL: Spam detection results: 0 BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain DMARC_PASS -0.1 DMARC pass policy FREEMAIL_FROM 0.001 Sender email is commonly abused enduser mail provider HTML_MESSAGE 0.001 HTML included in message KAM_SHORT 0.001 Use of a URL Shortener for very short URL RCVD_IN_DNSWL_NONE -0.0001 Sender listed at https://www.dnswl.org/, no trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URI_DOTEDU 0.5 Has .edu URI Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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 --===============1581496158008585562== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel --===============1581496158008585562==--