From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 7D8811FF0BC for ; Wed, 02 Dec 2026 16:20:32 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 6420E2191D; Wed, 02 Dec 2026 16:19:27 +0100 (CET) From: Jonas Theisen To: pve-devel@lists.proxmox.com Subject: [PATCH manager v4 15/21] pvestatd: broadcast the supported CPU flags again if they got lost Date: Wed, 2 Dec 2026 16:18:11 +0100 Message-ID: <20261202151831.414110-16-j.theisen@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261202151831.414110-1-j.theisen@proxmox.com> References: <20261202151831.414110-1-j.theisen@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1796224749506 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.056 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust 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: NERS4E24KXGFTCPA6AYJJU4CF23OSIXB X-Message-ID-Hash: NERS4E24KXGFTCPA6AYJJU4CF23OSIXB X-MailFrom: j.theisen@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: pvestatd only detects and broadcasts the CPU flags that QEMU supports when the QEMU version changes. If the node key-value entries get lost, for example as pmxcfs was restarted, they stay missing until then, so the CPU flag selector and the live migration checks for missing CPU flags lack the information of this node. Remember the broadcast values and broadcast them again if the entries are missing. Signed-off-by: Jonas Theisen --- PVE/Service/pvestatd.pm | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/PVE/Service/pvestatd.pm b/PVE/Service/pvestatd.pm index 2f6a2671..8c0f3c37 100755 --- a/PVE/Service/pvestatd.pm +++ b/PVE/Service/pvestatd.pm @@ -79,6 +79,7 @@ sub hup { } my $cached_kvm_version = ''; +my $cached_cpuflags = {}; my $next_flag_update_time; my $failed_flag_update_delay_sec = 120; @@ -93,7 +94,15 @@ sub update_supported_cpuflags { # only update when QEMU/KVM version has changed, as that is the only reason # why flags could change without restarting pvestatd - return if $cached_kvm_version && $cached_kvm_version eq $kvm_version; + if ($cached_kvm_version && $cached_kvm_version eq $kvm_version) { + # re-broadcast entries that got lost, for example after a restart of pmxcfs + for my $accel (sort keys $cached_cpuflags->%*) { + my $old = PVE::Cluster::get_node_kv("cpuflags-$accel", $nodename)->{$nodename}; + PVE::Cluster::broadcast_node_kv("cpuflags-$accel", $cached_cpuflags->{$accel}) + if !defined($old); + } + return; + } if ($next_flag_update_time && $next_flag_update_time > time()) { return; @@ -118,15 +127,10 @@ sub update_supported_cpuflags { } for my $accel ("tcg", "kvm") { - if ($supported_cpuflags->{$accel}) { - PVE::Cluster::broadcast_node_kv( - "cpuflags-$accel", - join(' ', @{ $supported_cpuflags->{$accel} }), - ); - } else { - # clear potentially invalid data - PVE::Cluster::broadcast_node_kv("cpuflags-$accel", ''); - } + # an empty value clears potentially invalid data + my $flags = join(' ', ($supported_cpuflags->{$accel} // [])->@*); + PVE::Cluster::broadcast_node_kv("cpuflags-$accel", $flags); + $cached_cpuflags->{$accel} = $flags; } } -- 2.47.3