From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com, "aderumier@odiso.com" <aderumier@odiso.com>
Subject: Re: [pve-devel] [PATCH v2 qemu-server 4/9] config: memory: add 'max' option
Date: Tue, 24 Jan 2023 14:05:08 +0100 [thread overview]
Message-ID: <82bd85df-382d-798a-df1f-8d7aae5344f7@proxmox.com> (raw)
In-Reply-To: <20230104064303.2898194-5-aderumier@odiso.com>
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 <aderumier@odiso.com>
> ---
> 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};
>
next prev parent reply other threads:[~2023-01-24 13:05 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-04 6:42 [pve-devel] [PATCH v2 qemu-server 0/9] rework memory hotplug + virtiomem Alexandre Derumier
2023-01-04 6:42 ` [pve-devel] [PATCH v2 qemu-server 1/9] test: add memory tests Alexandre Derumier
2023-01-24 13:04 ` Fiona Ebner
2023-01-04 6:42 ` [pve-devel] [PATCH v2 qemu-server 2/9] add memory parser Alexandre Derumier
2023-01-24 13:04 ` Fiona Ebner
2023-01-04 6:42 ` [pve-devel] [PATCH v2 qemu-server 3/9] memory: add get_static_mem Alexandre Derumier
2023-01-24 13:04 ` Fiona Ebner
2023-01-04 6:42 ` [pve-devel] [PATCH v2 qemu-server 4/9] config: memory: add 'max' option Alexandre Derumier
2023-01-24 13:05 ` Fiona Ebner [this message]
2023-01-27 15:03 ` DERUMIER, Alexandre
2023-01-30 8:03 ` Fiona Ebner
2023-01-30 8:45 ` DERUMIER, Alexandre
2023-01-04 6:42 ` [pve-devel] [PATCH v2 qemu-server 5/9] memory: get_max_mem: use config memory max Alexandre Derumier
2023-01-24 13:05 ` Fiona Ebner
2023-01-27 15:15 ` DERUMIER, Alexandre
2023-01-30 8:04 ` Fiona Ebner
2023-01-04 6:43 ` [pve-devel] [PATCH v2 qemu-server 6/9] memory: use 64 slots && static dimm size when max is defined Alexandre Derumier
2023-01-24 13:06 ` Fiona Ebner
2023-01-27 15:52 ` DERUMIER, Alexandre
2023-01-04 6:43 ` [pve-devel] [PATCH v2 qemu-server 7/9] test: add memory-max tests Alexandre Derumier
2023-01-24 13:06 ` Fiona Ebner
2023-01-04 6:43 ` [pve-devel] [PATCH v2 qemu-server 8/9] memory: add virtio-mem support Alexandre Derumier
2023-01-24 13:06 ` Fiona Ebner
2023-01-25 9:00 ` DERUMIER, Alexandre
2023-01-25 9:54 ` Fiona Ebner
2023-01-25 10:28 ` DERUMIER, Alexandre
2023-01-25 10:52 ` Fiona Ebner
2023-01-04 6:43 ` [pve-devel] [PATCH v2 qemu-server 9/9] tests: add virtio-mem tests Alexandre Derumier
2023-01-24 13:08 ` Fiona Ebner
2023-01-24 13:08 ` [pve-devel] [PATCH v2 qemu-server 0/9] rework memory hotplug + virtiomem Fiona Ebner
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=82bd85df-382d-798a-df1f-8d7aae5344f7@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=aderumier@odiso.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