From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id D37961FF140 for ; Fri, 13 Mar 2026 16:38:31 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0E8A976B0; Fri, 13 Mar 2026 16:38:35 +0100 (CET) From: Maximiliano Sandoval To: pve-devel@lists.proxmox.com Subject: [RFC PATCH qemu-server] capture obscure error related to phys-bits Date: Fri, 13 Mar 2026 16:37:51 +0100 Message-ID: <20260313153759.241986-1-m.sandoval@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1773416241515 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.953 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_MSPIKE_H2 0.001 Average reputation (+2) RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.408 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.819 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.903 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: WWHQJ7F7SZANT5V3ESO4P5GPUFD5PIGQ X-Message-ID-Hash: WWHQJ7F7SZANT5V3ESO4P5GPUFD5PIGQ X-MailFrom: m.sandoval@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Provides context to the somewhat obscure error message: kvm: Address space limit 0xffffffffff < 0x2877fffffff phys-bits too low (40) when failing to start a VM due to the CPU's phys-bits option being too small. Note that by default phys-bit is read from the CPU address size capped to 40, and that 0xffffffffff = (1 << 40) - 1 (cf. [1]) would be what most modern systems would see nowadays. In the example above one would need to, aptly, set phys-bits to at least 42 to avoid running into this issue. The computation for the max address size required for QEMU is not straight forward and depends on the machine type among other factors so we cannot easily try to detect the error before it happens and bump the value of phys-bits (if not explicitly set in the VM config) preemptively. One can speculate that a guest with 1 TiB of memory configured would run into this issue as 0xffffffffff < 0x10000000000 too. [1] https://gitlab.com/qemu-project/qemu/-/blob/v10.2.1/hw/i386/pc.c#L877 Suggested-by: Fiona Ebner Signed-off-by: Maximiliano Sandoval --- The place where the $run_params{logfunc} is set is obviously wrong, my host in particular runs into the elsif branch for AuthenticAMD CPUs. I was hoping to gather some feedback before modifying the logging mechanism. In general cathing log messages like this is not a good idea, but here I was not sure if there is a sane venue to make this error more understandable. Notes: This came up in enterprise support. In this case the machine had a CPU address size of 48 bits and the guest in question had 1.572.864 MiB of memory assigned. src/PVE/QemuServer.pm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm index 09e7a19b..58aa538a 100644 --- a/src/PVE/QemuServer.pm +++ b/src/PVE/QemuServer.pm @@ -5432,6 +5432,22 @@ my $log_filter_catch_outdated_zen5_firmware = sub { } }; +my $log_filter_catch_host_phys_bits_too_small = sub { + my ($line) = @_; + print "$line\n"; + if ($line =~ + m/Address space limit (?0x[0-9A-Fa-f]+) < (?0x[0-9A-Fa-f]+) phys-bits too low \((?[0-9]+)\)/ + ) { + log_warn( + "phys-bits=$+{phys_bits} is configured for the CPU. This results in an address" + . " space of size '(1 << phys-bits) - 1 = $+{curr_size}' which is smaller than" + . " what QEMU expects ($+{target_size}) for the VM's configured memory size." + . " Please increase its value to satisfy the previous assertion.\nBy default" + . " phys-bits will be set to the host's CPU address size capped to 40. Its value " + . " can be set via\nqm set --cpu=...,phys-bits="); + } +}; + # see vm_start_nolock for parameters, additionally: # migrate_opts: # storagemap = parsed storage map for allocating NBD disks @@ -5708,6 +5724,8 @@ sub vm_start_nolock { $run_params{logfunc} = sub { print "QEMU: $_[0]\n" }; } elsif ($cpuinfo->{vendor} eq 'AuthenticAMD' && $cpuinfo->{family} == 26) { $run_params{logfunc} = $log_filter_catch_outdated_zen5_firmware; + } else { + $run_params{logfunc} = $log_filter_catch_host_phys_bits_too_small; } my %systemd_properties = ( -- 2.47.3