public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Reiter <s.reiter@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH v2 qemu-server] fix #2570: add 'keephugepages' config
Date: Wed,  2 Sep 2020 11:03:37 +0200	[thread overview]
Message-ID: <20200902090337.10970-1-s.reiter@proxmox.com> (raw)

We already keep hugepages if they are created with the kernel
commandline (hugepagesz=x hugepages=y), but some setups (specifically
hugepages across multiple NUMA nodes) cannot be configured that way.
Since we always clear these hugepages at VM shutdown, rebooting a VM
that uses them might not work, since the requested count might not be
available anymore by the time we want to use them (also, we would then
no longer allocate them correctly on the NUMA nodes).

Add a 'keephugepages' parameter to skip cleanup and simply leave them
untouched.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---

v2:
* rebase

 PVE/QemuServer.pm | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index a5ee8e2..d2a20b6 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -441,6 +441,14 @@ EODESC
 	description => "Enable/disable hugepages memory.",
 	enum => [qw(any 2 1024)],
     },
+    keephugepages => {
+	optional => 1,
+	type => 'boolean',
+	default => 0,
+	description => "Use together with hugepages. If enabled, hugepages will"
+		     . " not be deleted after VM shutdown and can be used for"
+		     . " subsequent starts.",
+    },
     vcpus => {
 	optional => 1,
 	type => 'integer',
@@ -5034,11 +5042,13 @@ sub vm_start_nolock {
 
 	    eval { $run_qemu->() };
 	    if (my $err = $@) {
-		PVE::QemuServer::Memory::hugepages_reset($hugepages_host_topology);
+		PVE::QemuServer::Memory::hugepages_reset($hugepages_host_topology)
+		    if !$conf->{keephugepages};
 		die $err;
 	    }
 
-	    PVE::QemuServer::Memory::hugepages_pre_deallocate($hugepages_topology);
+	    PVE::QemuServer::Memory::hugepages_pre_deallocate($hugepages_topology)
+		if !$conf->{keephugepages};
 	};
 	eval { PVE::QemuServer::Memory::hugepages_update_locked($code); };
 
-- 
2.20.1





             reply	other threads:[~2020-09-02  9:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-02  9:03 Stefan Reiter [this message]
2020-09-02 12:10 ` [pve-devel] applied: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200902090337.10970-1-s.reiter@proxmox.com \
    --to=s.reiter@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal