From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 4211796484 for ; Tue, 24 Jan 2023 14:05:12 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 296ED3C1C for ; Tue, 24 Jan 2023 14:05:12 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Tue, 24 Jan 2023 14:05:09 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id F0D3745EAA; Tue, 24 Jan 2023 14:05:08 +0100 (CET) Message-ID: <82bd85df-382d-798a-df1f-8d7aae5344f7@proxmox.com> Date: Tue, 24 Jan 2023 14:05:08 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 From: Fiona Ebner To: pve-devel@lists.proxmox.com, "aderumier@odiso.com" References: <20230104064303.2898194-1-aderumier@odiso.com> <20230104064303.2898194-5-aderumier@odiso.com> Content-Language: en-US In-Reply-To: <20230104064303.2898194-5-aderumier@odiso.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.593 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment NICE_REPLY_A -1.148 Looks like a legit reply (A) SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [memory.pm] Subject: Re: [pve-devel] [PATCH v2 qemu-server 4/9] config: memory: add 'max' option X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jan 2023 13:05:12 -0000 Am 04.01.23 um 07:42 schrieb Alexandre Derumier: > max can be multiple of 64GB only, > The dimm size is compute from the max memory > > we can have 64 slots: > > 64GB = 64 slots x 1GB > 128GB = 64 slots x 2GB > .. > 4TB = 64 slots x 64GB > > Also, with numa, we need to share slot between (up to 8) sockets. > > 64 is a multiple of 8, > > 64GB = 8 sockets * 8 slots * 1GB > 128GB = 8 sockets * 8 slots * 2GB > ... > > and with virtio-mem, > we can have 32000 blocks of 2M minimum > > 64GB = 32000 * 2MB The units above should all be TiB, GiB and MiB, right? The virtio-mem documentation also talks about MiB. But then 32000 * 2MiB isn't 64 GiB. > > Signed-off-by: Alexandre Derumier > --- > PVE/QemuServer/Memory.pm | 18 +++++++++++++++++- > 1 file changed, 17 insertions(+), 1 deletion(-) > > diff --git a/PVE/QemuServer/Memory.pm b/PVE/QemuServer/Memory.pm > index e9c0115..1c4f356 100644 > --- a/PVE/QemuServer/Memory.pm > +++ b/PVE/QemuServer/Memory.pm > @@ -5,6 +5,7 @@ use warnings; > > use PVE::Tools qw(run_command lock_file lock_file_full file_read_firstline dir_glob_foreach); > use PVE::Exception qw(raise raise_param_exc); > +use PVE::GuestHelpers qw(safe_string_ne safe_num_ne safe_boolean_ne); > > use PVE::QemuServer; > use PVE::QemuServer::Monitor qw(mon_cmd); > @@ -25,7 +26,14 @@ my $memory_fmt = { > optional => 1, > minimum => 16, > default => 512, > - } > + }, > + max => { > + type => 'integer', > + optional => 1, > + type => 'integer', > + minimum => 65536, > + maximum => 4194304 > + }, > }; > > sub print_memory { > @@ -43,6 +51,9 @@ sub parse_memory { > > $res = eval { PVE::JSONSchema::parse_property_string($memory_fmt, $value) }; > die $@ if $@; > + > + die "max memory need to be a multiple of 64GB" if $res->{max} && $res->{max} % 65536 != 0; s/GB/GiB/ Missing newline at the end of error message You could also add a dedicated verify method for the format, for example like pve_verify_hotplug_features(). Then this check is already done at parameter verification time. > + > return $res; > } > > @@ -223,6 +234,11 @@ sub qemu_memory_hotplug { > my $oldmem = parse_memory($conf->{memory}); > my $newmem = parse_memory($value); > > + # skip non hotpluggable value > + if (safe_num_ne($newmem->{max}, $oldmem->{max})) { > + die "skip\n"; > + } Please move this to the call sites. The "die "skip""-logic should not cross function boundaries. > + > my $memory = $oldmem->{current}; > $value = $newmem->{current}; >