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 78039932E7 for ; Mon, 19 Feb 2024 15:47:44 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 5A15F31EA8 for ; Mon, 19 Feb 2024 15:47:14 +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 ; Mon, 19 Feb 2024 15:47:13 +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 2329543715 for ; Mon, 19 Feb 2024 15:47:13 +0100 (CET) Message-ID: <1c859d08-8df1-4ec1-b1c6-3c7924cf85fd@proxmox.com> Date: Mon, 19 Feb 2024 15:47:12 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Proxmox VE development discussion , Filip Schauer References: <20231219094023.25726-1-f.schauer@proxmox.com> <20231219094023.25726-3-f.schauer@proxmox.com> From: Fiona Ebner In-Reply-To: <20231219094023.25726-3-f.schauer@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.071 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 SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: Re: [pve-devel] [PATCH qemu-server 1/4] cpu config: Add helper to get the default CPU type 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: Mon, 19 Feb 2024 14:47:44 -0000 Am 19.12.23 um 10:40 schrieb Filip Schauer: > Signed-off-by: Filip Schauer > --- > PVE/QemuServer/CPUConfig.pm | 9 +++------ > PVE/QemuServer/Helpers.pm | 10 ++++++++++ > 2 files changed, 13 insertions(+), 6 deletions(-) > > diff --git a/PVE/QemuServer/CPUConfig.pm b/PVE/QemuServer/CPUConfig.pm > index ca2946b..c25c2c8 100644 > --- a/PVE/QemuServer/CPUConfig.pm > +++ b/PVE/QemuServer/CPUConfig.pm > @@ -5,7 +5,7 @@ use warnings; > > use PVE::JSONSchema; > use PVE::Cluster qw(cfs_register_file cfs_read_file); > -use PVE::QemuServer::Helpers qw(min_version); > +use PVE::QemuServer::Helpers qw(get_default_cpu_type min_version); > > use base qw(PVE::SectionConfig Exporter); > > @@ -405,7 +405,7 @@ sub print_cpu_device { > my ($conf, $id) = @_; > > my $kvm = $conf->{kvm} // 1; > - my $cpu = $kvm ? "kvm64" : "qemu64"; > + my $cpu = get_default_cpu_type('x86_64', $kvm); Not a new issue, but I think we should check the configured arch and die with a clean error when it's not x86_64 (and also move the FIXME up here), rather than continuing for some time and attempting a hotplug with some known non-working device commandline. > if (my $cputype = $conf->{cpu}) { > my $cpuconf = PVE::JSONSchema::parse_property_string('pve-vm-cpu-conf', $cputype) > or die "Cannot parse cpu description: $cputype\n"; > @@ -515,10 +515,7 @@ sub parse_cpuflag_list { > sub get_cpu_options { > my ($conf, $arch, $kvm, $kvm_off, $machine_version, $winversion, $gpu_passthrough) = @_; > > - my $cputype = $kvm ? "kvm64" : "qemu64"; > - if ($arch eq 'aarch64') { > - $cputype = 'cortex-a57'; > - } > + my $cputype = get_default_cpu_type($arch, $kvm); > > my $cpu = {}; > my $custom_cpu; > diff --git a/PVE/QemuServer/Helpers.pm b/PVE/QemuServer/Helpers.pm > index 0afb631..77052ad 100644 > --- a/PVE/QemuServer/Helpers.pm > +++ b/PVE/QemuServer/Helpers.pm > @@ -15,6 +15,7 @@ min_version > config_aware_timeout > parse_number_sets > windows_version > +get_default_cpu_type > ); > > my $nodename = PVE::INotify::nodename(); > @@ -225,4 +226,13 @@ sub windows_version { > return $winversion; > } > > +sub get_default_cpu_type { Why put this into the Helpers module rather than CPUConfig? That would be the most natural choice, because this is precisely concerned with the CPU config and it's only used there too. > + my ($arch, $kvm) = @_; > + > + my $cputype = $kvm ? 'kvm64' : 'qemu64'; > + $cputype = 'cortex-a57' if $arch eq 'aarch64'; > + > + return $cputype; > +} > + > 1;