public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel
@ 2023-05-22 10:25 Alexandre Derumier
  2023-05-22 10:25 ` [pve-devel] [PATCH v3 qemu-server 1/7] cpuconfig: add new x86-64-vX models Alexandre Derumier
                   ` (10 more replies)
  0 siblings, 11 replies; 37+ messages in thread
From: Alexandre Derumier @ 2023-05-22 10:25 UTC (permalink / raw)
  To: pve-devel


Hi,

we used kvm64 as default cpumodel since the begin of proxmox. (basically, it's like a pentium4 cpu flags).

New distros like rhel9 are compiled to use more modern cpu flags.
(and windows already use new flags since year, and we already add some extra cpu flags)

"
In 2020, AMD, Intel, Red Hat, and SUSE worked together to define
three microarchitecture levels on top of the historical x86-64
baseline:

  * x86-64-v1: original x86_64 baseline instruction set
  * x86-64-v2: vector instructions up to Streaming SIMD
               Extensions 4.2 (SSE4.2)  and Supplemental
               Streaming SIMD Extensions 3 (SSSE3), the
               POPCNT instruction, and CMPXCHG16B
  * x86-64-v3: vector instructions up to AVX2, MOVBE,
               and additional bit-manipulation instructions.
  * x86-64-v4: vector instructions from some of the
               AVX-512 variants.

"


This patch series add new models inspired from a patch was found on qemu mailing, but never appplied

https://lore.kernel.org/all/20210526144038.278899-1-berrange@redhat.com/T/


In addition to theses model, I have enabled aes too.
I think it's really important, because a lot of users use default values and have
bad performance with ssl and other crypto stuffs.


This was discussed on the qemu mailing

"
Crypto accelerator caveats
==========================

Similarly I'm not a huge fan of leaving out the "aes"
instruction for accelerated crypto, as missing "aes" is
also one of the key factors in making qemu64 a bad choice.

If we include 'aes' in x86-64-v2, then we loose support
for Nehalem hosts.

If we include 'aes' in x86-64-v3 then we further loose
support for Dhyana hosts (an EPYC derived CPU).
"

Nahelemn is a 2008 cpu, so I think it's ok, we are in 2013 ;)
(and user can disable aes flag in gui too)

That mean than the minimum compatible cpu for v2 is Intel Westmere (2010)
and Amd Bulldozer (2011).


This patch series add new models, and set x86-64-abi2 model as default in pve-manager
wizard only.
(to not break current vm, where kvm64 is the default when cputype is not defined
in configuration)



Additionnaly, it could be great to use a real cpu model when we don't have
mixed intel/amd cluster, to have spectre/meltdown/.... mitigations enabled.

I have added initial code for best model detection based on host cpuflags
vs qemu models flags.

Not yet plugged, I'm not sure what is the best way, only at vm create,
or at vm start to auto upgrade vm cpu to last version ?
I'm not sure with cluster, if user add a new older node.
(vmware have a feature called EVC, compute the best model when node join/leave)



changelog v2:
 - remove qemu patch and implement new models in qemu-server
 - use x86-64-vX instead x86-64-abiX  (less confusing for user)
 - don't expose v4 model for now (need epyc v4 for testing)
 - use add and set x86-64-v2 as default model for new vms

changelog v3:
 - add best cpu model detection from cpu flags && msr
 - pve-common : add optionnal parsing of msr in read_cpuinfo



qemu-server :

Alexandre Derumier (7):
  cpuconfig: add new x86-64-vX models
  cpumodel: add cpu models with flags
  cpumodel: compute qemu supported flags
  cpuconfig: add get_host_cpu_flags
  cpuconfig: add find_best_cpumodel
  cpuconfig: add find_hosts_common_flags
  add best cpu model detection tests

 PVE/QemuServer/CPUConfig.pm |  253 ++-
 PVE/QemuServer/CPUModels.pm | 4221 +++++++++++++++++++++++++++++++++++
 PVE/QemuServer/Makefile     |    1 +
 test/Makefile               |    5 +-
 test/run_cpumodel_tests.pl  |  272 +++
 5 files changed, 4682 insertions(+), 70 deletions(-)
 create mode 100644 PVE/QemuServer/CPUModels.pm
 create mode 100755 test/run_cpumodel_tests.pl

pve-common:

Alexandre Derumier (1):
  read_cpuinfo: add msr support

 src/PVE/ProcFSTools.pm | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

pve-manager:

Alexandre Derumier (1):
  qemu: processor : set x86-64-v2 as default cputype for create wizard

 www/manager6/qemu/OSDefaults.js    |  1 +
 www/manager6/qemu/ProcessorEdit.js | 13 +++++++++++++
 2 files changed, 14 insertions(+)



-- 
2.30.2




^ permalink raw reply	[flat|nested] 37+ messages in thread

* [pve-devel] [PATCH v3 qemu-server 1/7] cpuconfig: add new x86-64-vX models
  2023-05-22 10:25 [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel Alexandre Derumier
@ 2023-05-22 10:25 ` Alexandre Derumier
  2023-05-31 11:08   ` Fiona Ebner
  2023-05-22 10:25 ` [pve-devel] [PATCH v2 pve-manager 1/1] qemu: processor : set x86-64-v2 as default cputype for create wizard Alexandre Derumier
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 37+ messages in thread
From: Alexandre Derumier @ 2023-05-22 10:25 UTC (permalink / raw)
  To: pve-devel

https://lore.kernel.org/all/20210526144038.278899-1-berrange@redhat.com/T/
"
In 2020, AMD, Intel, Red Hat, and SUSE worked together to define
three microarchitecture levels on top of the historical x86-64
baseline:

  * x86-64:    original x86_64 baseline instruction set
  * x86-64-v2: vector instructions up to Streaming SIMD
               Extensions 4.2 (SSE4.2)  and Supplemental
               Streaming SIMD Extensions 3 (SSSE3), the
               POPCNT instruction, and CMPXCHG16B
  * x86-64-v3: vector instructions up to AVX2, MOVBE,
               and additional bit-manipulation instructions.
  * x86-64-v4: vector instructions from some of the
               AVX-512 variants.
"

This patch add new builtin model derivated from original models,
to be compatible between intel/amd.

x86-64-v1 : Derived from Opteron_G1, minus vme
x86-64-v2 : Derived from Nehalem, -vme,+aes

min intel: Westmere (because of aes)
min amd : Opteron_G3

x86-64-v3 : Derived from Haswell-noTSX, -pcid,-erms,-invpcid,-tsc-deadline,-x2apic,-pclmulqdq,+aes

min intel: Haswell
min amd : EPYC_v1

x86-64-v4 : Derived from Skylake-Server-noTSX-IBRS, -spec-ctrl

min intel: Skylake
min amd : EPYC_v4

(v4 model not yet exposed, because not yet tested, other models have been tested)

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 PVE/QemuServer/CPUConfig.pm | 33 +++++++++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git a/PVE/QemuServer/CPUConfig.pm b/PVE/QemuServer/CPUConfig.pm
index fb0861b..54bbd55 100644
--- a/PVE/QemuServer/CPUConfig.pm
+++ b/PVE/QemuServer/CPUConfig.pm
@@ -31,6 +31,25 @@ sub load_custom_model_conf {
     return cfs_read_file($default_filename);
 }
 
+my $builtin_models = {
+    'x86-64-v1' => {
+	'reported-model' => 'Opteron_G1',
+	flags => "-vme;-svm;-vmx",
+    },
+    'x86-64-v2' => {
+	'reported-model' => 'Nehalem',
+	flags => "+aes;-svm;-vmx",
+    },
+    'x86-64-v3' => {
+	'reported-model' => 'Haswell-noTSX',
+	flags => "+aes;-pcid;-erms;-invpcid;-tsc-deadline;-x2apic;-pclmulqdq;-svm;-vmx",
+    },
+#    'x86-64-v4' => {
+#	'reported-model' => 'Skylake-Server-noTSX-IBRS',
+#	flags => "+aes;-spec-ctrl;-svm;-vmx",
+#    },
+};
+
 my $depreacated_cpu_map = {
     # there never was such a client CPU, so map it to the server one for backward compat
     'Icelake-Client' => 'Icelake-Server',
@@ -96,6 +115,9 @@ my $cpu_vendor_list = {
     kvm64 => 'default',
     qemu32 => 'default',
     qemu64 => 'default',
+    'x86-64-v1' => 'default',
+    'x86-64-v2' => 'default',
+    'x86-64-v3' => 'default',
     max => 'default',
 };
 
@@ -359,7 +381,10 @@ sub print_cpu_device {
 	    or die "Cannot parse cpu description: $cputype\n";
 	$cpu = $cpuconf->{cputype};
 
-	if (is_custom_model($cpu)) {
+	if (my $model = $builtin_models->{$cpu}) {
+	    $cpu = $model->{'reported-model'} // $cpu_fmt->{'reported-model'}->{default};
+	}
+	if (is_custom_model($cputype)) {
 	    my $custom_cpu = get_custom_model($cpu);
 
 	    $cpu = $custom_cpu->{'reported-model'} // $cpu_fmt->{'reported-model'}->{default};
@@ -474,7 +499,11 @@ sub get_cpu_options {
 	    or die "Cannot parse cpu description: $cpu_prop_str\n";
 
 	$cputype = $cpu->{cputype};
-
+	if (my $model = $builtin_models->{$cputype}) {
+	    my $model = $builtin_models->{$cputype};
+	    $cputype = $model->{'reported-model'} // $cpu_fmt->{'reported-model'}->{default};
+	    $custom_cpu->{flags} = $model->{'flags'};
+	}
 	if (is_custom_model($cputype)) {
 	    $custom_cpu = get_custom_model($cputype);
 
-- 
2.30.2




^ permalink raw reply	[flat|nested] 37+ messages in thread

* [pve-devel] [PATCH v2 pve-manager 1/1] qemu: processor : set x86-64-v2 as default cputype for create wizard
  2023-05-22 10:25 [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel Alexandre Derumier
  2023-05-22 10:25 ` [pve-devel] [PATCH v3 qemu-server 1/7] cpuconfig: add new x86-64-vX models Alexandre Derumier
@ 2023-05-22 10:25 ` Alexandre Derumier
  2023-05-22 10:25 ` [pve-devel] [PATCH pve-common 1/1] read_cpuinfo: add msr support Alexandre Derumier
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 37+ messages in thread
From: Alexandre Derumier @ 2023-05-22 10:25 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 www/manager6/qemu/OSDefaults.js    |  1 +
 www/manager6/qemu/ProcessorEdit.js | 13 +++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/www/manager6/qemu/OSDefaults.js b/www/manager6/qemu/OSDefaults.js
index 5e588a58..fe3ed2c2 100644
--- a/www/manager6/qemu/OSDefaults.js
+++ b/www/manager6/qemu/OSDefaults.js
@@ -43,6 +43,7 @@ Ext.define('PVE.qemu.OSDefaults', {
 		    virtio: 1,
 	    },
 	    scsihw: 'virtio-scsi-single',
+	    cputype: 'x86-64-v2',
 	};
 
        // virtio-net is in kernel since 2.6.25
diff --git a/www/manager6/qemu/ProcessorEdit.js b/www/manager6/qemu/ProcessorEdit.js
index b845ff66..727d1679 100644
--- a/www/manager6/qemu/ProcessorEdit.js
+++ b/www/manager6/qemu/ProcessorEdit.js
@@ -29,6 +29,19 @@ Ext.define('PVE.qemu.ProcessorInputPanel', {
 
 	    viewModel.set('userIsRoot', Proxmox.UserName === 'root@pam');
 	},
+	control: {
+	    '#': {
+		afterrender: 'setCputype',
+	    },
+	},
+	setCputype: function() {
+	    let me = this;
+	    let view = me.getView();
+	    let cputype = view.down('CPUModelSelector[name=cputype]');
+	    if (view.insideWizard) {
+		cputype.setValue(PVE.qemu.OSDefaults.generic.cputype);
+	    }
+        },
     },
 
     onGetValues: function(values) {
-- 
2.30.2




^ permalink raw reply	[flat|nested] 37+ messages in thread

* [pve-devel] [PATCH pve-common 1/1] read_cpuinfo: add msr support
  2023-05-22 10:25 [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel Alexandre Derumier
  2023-05-22 10:25 ` [pve-devel] [PATCH v3 qemu-server 1/7] cpuconfig: add new x86-64-vX models Alexandre Derumier
  2023-05-22 10:25 ` [pve-devel] [PATCH v2 pve-manager 1/1] qemu: processor : set x86-64-v2 as default cputype for create wizard Alexandre Derumier
@ 2023-05-22 10:25 ` Alexandre Derumier
  2023-05-22 10:25 ` [pve-devel] [PATCH v3 qemu-server 2/7] cpumodel: add cpu models with flags Alexandre Derumier
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 37+ messages in thread
From: Alexandre Derumier @ 2023-05-22 10:25 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 src/PVE/ProcFSTools.pm | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/src/PVE/ProcFSTools.pm b/src/PVE/ProcFSTools.pm
index 3826fcc..f491452 100644
--- a/src/PVE/ProcFSTools.pm
+++ b/src/PVE/ProcFSTools.pm
@@ -21,12 +21,15 @@ my $clock_ticks = POSIX::sysconf(&POSIX::_SC_CLK_TCK);
 my $cpuinfo;
 
 sub read_cpuinfo {
+    my ($msr) = @_;
+
     my $fn = '/proc/cpuinfo';
 
     return $cpuinfo if $cpuinfo;
 
     my $res = {
 	user_hz => $clock_ticks,
+	vendor => 'unknown',
 	model => 'unknown',
 	mhz => 0,
 	cpus => 1,
@@ -45,6 +48,8 @@ sub read_cpuinfo {
 	    $count++;
 	} elsif ($line =~ m/^model\s+name\s*:\s*(.*)\s*$/i) {
 	    $res->{model} = $1 if $res->{model} eq 'unknown';
+	} elsif ($line =~ m/^vendor_id\s*:\s*(.*)\s*$/i) {
+	    $res->{vendor} = $1 if $res->{vendor} eq 'unknown';
 	} elsif ($line =~ m/^cpu\s+MHz\s*:\s*(\d+\.\d+)\s*$/i) {
 	    $res->{mhz} = $1 if !$res->{mhz};
 	} elsif ($line =~ m/^flags\s*:\s*(.*)$/) {
@@ -70,9 +75,45 @@ sub read_cpuinfo {
 
     $cpuinfo = $res;
 
+    return $res if !$msr;
+
+    if ($cpuinfo->{vendor} eq 'GenuineIntel') {
+	$res->{msr} = read_cpu_intel_msr();
+    }
+
     return $res;
 }
 
+sub read_msr {
+    my ($fh, $offset) = @_;
+
+    my $value = undef;
+    seek $fh, $offset,0;
+    read $fh, $value, 8;
+    return unpack("Q", $value) if $value;
+}
+
+sub read_cpu_intel_msr {
+    my $msr = {};
+    my $spectr_msr = undef;
+    my $capabilities_msr = undef;
+    my $fn = '/dev/cpu/0/msr';
+
+    if (!-d $fn) {
+	eval {
+	    system("/sbin/modprobe msr >/dev/null 2>/dev/null");
+	};
+    }
+    return if !$fn;
+
+    my $fh = IO::File->new ($fn, "r");
+    return if !$fh;
+    $msr->{'spec-ctrl'} = read_msr($fh, 0x48);
+    $msr->{'arch-capabilities'} = read_msr($fh, 0x10a);
+    close $fh;
+    return $msr;
+}
+
 sub read_proc_uptime {
     my $ticks = shift;
 
-- 
2.30.2




^ permalink raw reply	[flat|nested] 37+ messages in thread

* [pve-devel] [PATCH v3 qemu-server 2/7] cpumodel: add cpu models with flags
  2023-05-22 10:25 [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel Alexandre Derumier
                   ` (2 preceding siblings ...)
  2023-05-22 10:25 ` [pve-devel] [PATCH pve-common 1/1] read_cpuinfo: add msr support Alexandre Derumier
@ 2023-05-22 10:25 ` Alexandre Derumier
  2023-05-22 10:25 ` [pve-devel] [PATCH v3 qemu-server 3/7] cpumodel: compute qemu supported flags Alexandre Derumier
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 37+ messages in thread
From: Alexandre Derumier @ 2023-05-22 10:25 UTC (permalink / raw)
  To: pve-devel

This is all qemu cpu models for qemu 8.0 with cpu flags
extracted from qemu cpu.c using
https://github.com/libvirt/libvirt/blob/master/src/cpu_map/sync_qemu_models_i386.py
(with some modifications, as the script is buggy, and override main model flags with
last version flags)

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 PVE/QemuServer/CPUConfig.pm |   78 +-
 PVE/QemuServer/CPUModels.pm | 4211 +++++++++++++++++++++++++++++++++++
 PVE/QemuServer/Makefile     |    1 +
 3 files changed, 4220 insertions(+), 70 deletions(-)
 create mode 100644 PVE/QemuServer/CPUModels.pm

diff --git a/PVE/QemuServer/CPUConfig.pm b/PVE/QemuServer/CPUConfig.pm
index 54bbd55..758f93f 100644
--- a/PVE/QemuServer/CPUConfig.pm
+++ b/PVE/QemuServer/CPUConfig.pm
@@ -6,6 +6,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::CPUModels qw(get_default_cpu_models);
 
 use base qw(PVE::SectionConfig Exporter);
 
@@ -56,70 +57,7 @@ my $depreacated_cpu_map = {
     'Icelake-Client-noTSX' => 'Icelake-Server-noTSX',
 };
 
-my $cpu_vendor_list = {
-    # Intel CPUs
-    486 => 'GenuineIntel',
-    pentium => 'GenuineIntel',
-    pentium2 => 'GenuineIntel',
-    pentium3 => 'GenuineIntel',
-    coreduo => 'GenuineIntel',
-    core2duo => 'GenuineIntel',
-    Conroe => 'GenuineIntel',
-    Penryn => 'GenuineIntel',
-    Nehalem => 'GenuineIntel',
-    'Nehalem-IBRS' => 'GenuineIntel',
-    Westmere => 'GenuineIntel',
-    'Westmere-IBRS' => 'GenuineIntel',
-    SandyBridge => 'GenuineIntel',
-    'SandyBridge-IBRS' => 'GenuineIntel',
-    IvyBridge => 'GenuineIntel',
-    'IvyBridge-IBRS' => 'GenuineIntel',
-    Haswell => 'GenuineIntel',
-    'Haswell-IBRS' => 'GenuineIntel',
-    'Haswell-noTSX' => 'GenuineIntel',
-    'Haswell-noTSX-IBRS' => 'GenuineIntel',
-    Broadwell => 'GenuineIntel',
-    'Broadwell-IBRS' => 'GenuineIntel',
-    'Broadwell-noTSX' => 'GenuineIntel',
-    'Broadwell-noTSX-IBRS' => 'GenuineIntel',
-    'Skylake-Client' => 'GenuineIntel',
-    'Skylake-Client-IBRS' => 'GenuineIntel',
-    'Skylake-Client-noTSX-IBRS' => 'GenuineIntel',
-    'Skylake-Server' => 'GenuineIntel',
-    'Skylake-Server-IBRS' => 'GenuineIntel',
-    'Skylake-Server-noTSX-IBRS' => 'GenuineIntel',
-    'Cascadelake-Server' => 'GenuineIntel',
-    'Cascadelake-Server-noTSX' => 'GenuineIntel',
-    KnightsMill => 'GenuineIntel',
-    'Icelake-Client' => 'GenuineIntel', # depreacated, removed with QEMU 7.1
-    'Icelake-Client-noTSX' => 'GenuineIntel', # depreacated, removed with QEMU 7.1
-    'Icelake-Server' => 'GenuineIntel',
-    'Icelake-Server-noTSX' => 'GenuineIntel',
-
-    # AMD CPUs
-    athlon => 'AuthenticAMD',
-    phenom => 'AuthenticAMD',
-    Opteron_G1 => 'AuthenticAMD',
-    Opteron_G2 => 'AuthenticAMD',
-    Opteron_G3 => 'AuthenticAMD',
-    Opteron_G4 => 'AuthenticAMD',
-    Opteron_G5 => 'AuthenticAMD',
-    EPYC => 'AuthenticAMD',
-    'EPYC-IBPB' => 'AuthenticAMD',
-    'EPYC-Rome' => 'AuthenticAMD',
-    'EPYC-Milan' => 'AuthenticAMD',
-
-    # generic types, use vendor from host node
-    host => 'default',
-    kvm32 => 'default',
-    kvm64 => 'default',
-    qemu32 => 'default',
-    qemu64 => 'default',
-    'x86-64-v1' => 'default',
-    'x86-64-v2' => 'default',
-    'x86-64-v3' => 'default',
-    max => 'default',
-};
+my $qemu_cpu_models = get_default_cpu_models();
 
 my @supported_cpu_flags = (
     'pcid',
@@ -153,7 +91,7 @@ my $cpu_fmt = {
 	description => "CPU model and vendor to report to the guest. Must be a QEMU/KVM supported model."
 	    ." Only valid for custom CPU model definitions, default models will always report themselves to the guest OS.",
 	type => 'string',
-	enum => [ sort { lc("$a") cmp lc("$b") } keys %$cpu_vendor_list ],
+	enum => [ sort { lc("$a") cmp lc("$b") } keys %$qemu_cpu_models ],
 	default => 'kvm64',
 	optional => 1,
     },
@@ -234,7 +172,7 @@ sub validate_vm_cpu_conf {
 	get_custom_model($cputype);
     } else {
 	die "Built-in cputype '$cputype' is not defined (missing 'custom-' prefix?)\n"
-	    if !defined($cpu_vendor_list->{$cputype});
+	    if !defined($qemu_cpu_models->{$cputype});
     }
 
     # in a VM-specific config, certain properties are limited/forbidden
@@ -316,11 +254,11 @@ sub get_cpu_models {
 
     my $models = [];
 
-    for my $default_model (keys %{$cpu_vendor_list}) {
+    for my $default_model (keys %{$qemu_cpu_models}) {
 	push @$models, {
 	    name => $default_model,
 	    custom => 0,
-	    vendor => $cpu_vendor_list->{$default_model},
+	    vendor => $qemu_cpu_models->{$default_model}->{vendor},
 	};
     }
 
@@ -330,7 +268,7 @@ sub get_cpu_models {
     for my $custom_model (keys %{$conf->{ids}}) {
 	my $reported_model = $conf->{ids}->{$custom_model}->{'reported-model'};
 	$reported_model //= $cpu_fmt->{'reported-model'}->{default};
-	my $vendor = $cpu_vendor_list->{$reported_model};
+	my $vendor = $qemu_cpu_models->{$reported_model}->{vendor};
 	push @$models, {
 	    name => "custom-$custom_model",
 	    custom => 1,
@@ -550,7 +488,7 @@ sub get_cpu_options {
 
     # $cputype is the "reported-model" for custom types, so we can just look up
     # the vendor in the default list
-    my $cpu_vendor = $cpu_vendor_list->{$cputype};
+    my $cpu_vendor = $qemu_cpu_models->{$cputype}->{vendor};
     if ($cpu_vendor) {
 	$pve_forced_flags->{'vendor'} = {
 	    value => $cpu_vendor,
diff --git a/PVE/QemuServer/CPUModels.pm b/PVE/QemuServer/CPUModels.pm
new file mode 100644
index 0000000..20aacb1
--- /dev/null
+++ b/PVE/QemuServer/CPUModels.pm
@@ -0,0 +1,4211 @@
+package PVE::QemuServer::CPUModels;
+
+use strict;
+use warnings;
+
+use base 'Exporter';
+
+our @EXPORT_OK = qw(
+get_default_cpu_models
+);
+
+
+my $cpumodels = {
+    'Icelake-Client' => { # depreacated, removed with QEMU 7.1
+	vendor => 'GenuineIntel', # depreacated, removed with QEMU 7.1
+	family => 0,
+        model => 0,
+        version => 0,
+    },
+    'Icelake-Client-noTSX' => { # depreacated, removed with QEMU 7.1
+	vendor => 'GenuineIntel',
+	family => 0,
+        model => 0,
+        version => 0,
+    },
+    'host' => {
+        vendor => 'default',
+	family => 1,
+        model => 0,
+        version => 1,
+    },
+    'max' => {
+        vendor => 'default',
+	family => 1,
+        model => 0,
+        version => 1,
+    },
+    'x86-64-v1' => {
+        vendor => 'default',
+	family => 2,
+        model => 11,
+        version => 1,
+        flags => {
+            'apic' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'fpu' => 1,
+            'fxsr' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'sep' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+	}
+    },
+    'x86-64-v2' => {
+        vendor => 'default',
+	family => 2,
+        model => 12,
+        version => 1,
+        flags => {
+            'apic' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'fpu' => 1,
+            'fxsr' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'sep' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'vme' => 1,
+	    'aes' => 1,
+	}
+    },
+    'x86-64-v3' => {
+        vendor => 'default',
+	family => 2,
+        model => 13,
+        version => 1,
+        flags => {
+            'abm' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdrand' => 1,
+            'rdtscp' => 1,
+            'sep' => 1,
+            'smep' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'vme' => 1,
+            'xsave' => 1,
+            'xsaveopt' => 1,
+        },
+    },
+    'qemu64' => {
+        vendor => 'default',
+	family => 1,
+        model => 1,
+        version => 1,
+        flags => {
+            'apic' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'fpu' => 1,
+            'fxsr' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'sep' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'svm' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+        },
+    },
+    'phenom' => {
+        vendor => 'AuthenticAMD',
+        model => 2,
+        version => 1,
+        flags => {
+            '3dnow' => 1,
+            '3dnowext' => 1,
+            'abm' => 1,
+            'apic' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'fpu' => 1,
+            'fxsr' => 1,
+            'fxsr_opt' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'mmxext' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'npt' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pdpe1gb' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdtscp' => 1,
+            'sep' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4a' => 1,
+            'svm' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'vme' => 1,
+        },
+    },
+    'core2duo' => { 
+        vendor => 'GenuineIntel',
+        model => 15,
+	family => 6,
+        version => 1,
+        flags => {
+            'acpi' => 1,
+            'apic' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'fpu' => 1,
+            'fxsr' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'sep' => 1,
+            'ss' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'vme' => 1,
+        },
+    },
+    'kvm64' => {
+        vendor => 'default',
+	family => 2,
+        model => 6,
+        version => 1,
+        flags => {
+            'apic' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'fpu' => 1,
+            'fxsr' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'sep' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'vme' => 1,
+        },
+    },
+    'qemu32' => {
+        vendor => 'default',
+	family => 1,
+        model => 6,
+        version => 1,
+        flags => {
+            'apic' => 1,
+            'cmov' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'fpu' => 1,
+            'fxsr' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'msr' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'pse' => 1,
+            'sep' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'tsc' => 1,
+        },
+    },
+    'kvm32' => {
+        vendor => 'default',
+	family => 1,
+        model => 6,
+        version => 1,
+        flags => {
+            'apic' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'fpu' => 1,
+            'fxsr' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'sep' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'tsc' => 1,
+            'vme' => 1,
+        },
+    },
+    'coreduo' => { 
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 14,
+        version => 1,
+        flags => {
+            'acpi' => 1,
+            'apic' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'fpu' => 1,
+            'fxsr' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'pse' => 1,
+            'sep' => 1,
+            'ss' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'tsc' => 1,
+            'vme' => 1,
+        },
+    },
+    '486' => {
+        vendor => 'GenuineIntel',
+	family => 4,
+        model => 8,
+        version => 1,
+        flags => {
+            'fpu' => 1,
+            'pse' => 1,
+            'vme' => 1,
+        },
+    },
+    'pentium' => {
+        vendor => 'GenuineIntel',
+	family => 5,
+        model => 4,
+        version => 1,
+        flags => {
+            'apic' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'fpu' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'msr' => 1,
+            'pse' => 1,
+            'tsc' => 1,
+            'vme' => 1,
+        },
+    },
+    'pentium2' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 5,
+        version => 1,
+        flags => {
+            'apic' => 1,
+            'cmov' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'fpu' => 1,
+            'fxsr' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pge' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'sep' => 1,
+            'tsc' => 1,
+            'vme' => 1,
+        },
+    },
+    'pentium3' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 7,
+        version => 1,
+        flags => {
+            'apic' => 1,
+            'cmov' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'fpu' => 1,
+            'fxsr' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pge' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'sep' => 1,
+            'sse' => 1,
+            'tsc' => 1,
+            'vme' => 1,
+        },
+    },
+    'athlon' => {
+        vendor => 'AuthenticAMD',
+        model => 2,
+        version => 1,
+        flags => {
+            '3dnow' => 1,
+            '3dnowext' => 1,
+            'apic' => 1,
+            'cmov' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'fpu' => 1,
+            'fxsr' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'mmxext' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pge' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'sep' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'tsc' => 1,
+            'vme' => 1,
+        },
+    },
+    'Conroe' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 15,
+        version => 1,
+        flags => {
+            'apic' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'fpu' => 1,
+            'fxsr' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'sep' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'vme' => 1,
+        },
+    },
+    'Penryn' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 23,
+        version => 1,
+        flags => {
+            'apic' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'fpu' => 1,
+            'fxsr' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'sep' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'vme' => 1,
+        },
+    },
+    'Nehalem' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 26,
+        version => 1,
+        flags => {
+            'apic' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'fpu' => 1,
+            'fxsr' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'sep' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'vme' => 1,
+        },
+    },
+    'Nehalem-IBRS' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 26,
+        version => 2,
+        flags => {
+            'apic' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'fpu' => 1,
+            'fxsr' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'sep' => 1,
+            'spec-ctrl' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'vme' => 1,
+        },
+    },
+    'Westmere' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 44,
+        version => 1,
+        flags => {
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'fpu' => 1,
+            'fxsr' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pclmuldq' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'sep' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'vme' => 1,
+        },
+    },
+    'Westmere-IBRS' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 44,
+        version => 2,
+        flags => {
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'fpu' => 1,
+            'fxsr' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pclmuldq' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'sep' => 1,
+            'spec-ctrl' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'vme' => 1,
+        },
+    },
+    'SandyBridge' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 45,
+        version => 1,
+        flags => {
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'avx' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'fpu' => 1,
+            'fxsr' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pclmuldq' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdtscp' => 1,
+            'sep' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'vme' => 1,
+            'x2apic' => 1,
+            'xsave' => 1,
+            'xsaveopt' => 1,
+        },
+    },
+    'SandyBridge-IBRS' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 45,
+        version => 2,
+        flags => {
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'avx' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'fpu' => 1,
+            'fxsr' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pclmuldq' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdtscp' => 1,
+            'sep' => 1,
+            'spec-ctrl' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'vme' => 1,
+            'x2apic' => 1,
+            'xsave' => 1,
+            'xsaveopt' => 1,
+        },
+    },
+    'IvyBridge' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 62,
+        version => 1,
+        flags => {
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'avx' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pclmuldq' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdrand' => 1,
+            'rdtscp' => 1,
+            'sep' => 1,
+            'smep' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'vme' => 1,
+            'x2apic' => 1,
+            'xsave' => 1,
+            'xsaveopt' => 1,
+        },
+    },
+    'IvyBridge-IBRS' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 62,
+        version => 2,
+        flags => {
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'avx' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pclmuldq' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdrand' => 1,
+            'rdtscp' => 1,
+            'sep' => 1,
+            'smep' => 1,
+            'spec-ctrl' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'vme' => 1,
+            'x2apic' => 1,
+            'xsave' => 1,
+            'xsaveopt' => 1,
+        },
+    },
+    'Haswell' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 63,
+        version => 1,
+        flags => {
+            'abm' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'hle' => 1,
+            'invpcid' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pcid' => 1,
+            'pclmuldq' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdrand' => 1,
+            'rdtscp' => 1,
+            'rtm' => 1,
+            'sep' => 1,
+            'smep' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'vme' => 1,
+            'x2apic' => 1,
+            'xsave' => 1,
+            'xsaveopt' => 1,
+        },
+    },
+    'Haswell-noTSX' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 63,
+        version => 2,
+        flags => {
+            'abm' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'invpcid' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pcid' => 1,
+            'pclmuldq' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdrand' => 1,
+            'rdtscp' => 1,
+            'sep' => 1,
+            'smep' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'vme' => 1,
+            'x2apic' => 1,
+            'xsave' => 1,
+            'xsaveopt' => 1,
+        },
+    },
+    'Haswell-IBRS' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 63,
+        version => 3,
+        flags => {
+            'abm' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'hle' => 1,
+            'invpcid' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pcid' => 1,
+            'pclmuldq' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdrand' => 1,
+            'rdtscp' => 1,
+            'rtm' => 1,
+            'sep' => 1,
+            'smep' => 1,
+            'spec-ctrl' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'vme' => 1,
+            'x2apic' => 1,
+            'xsave' => 1,
+            'xsaveopt' => 1,
+        },
+    },
+    'Haswell-noTSX-IBRS' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 63,
+        version => 4,
+        flags => {
+            'abm' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'invpcid' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pcid' => 1,
+            'pclmuldq' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdrand' => 1,
+            'rdtscp' => 1,
+            'sep' => 1,
+            'smep' => 1,
+            'spec-ctrl' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'vme' => 1,
+            'x2apic' => 1,
+            'xsave' => 1,
+            'xsaveopt' => 1,
+        },
+    },
+    'Broadwell' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 79,
+        version => 1,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'adx' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'hle' => 1,
+            'invpcid' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pcid' => 1,
+            'pclmuldq' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdrand' => 1,
+            'rdseed' => 1,
+            'rdtscp' => 1,
+            'rtm' => 1,
+            'sep' => 1,
+            'smap' => 1,
+            'smep' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'vme' => 1,
+            'x2apic' => 1,
+            'xsave' => 1,
+            'xsaveopt' => 1,
+        },
+    },
+    'Broadwell-noTSX' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 79,
+        version => 2,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'adx' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'invpcid' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pcid' => 1,
+            'pclmuldq' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdrand' => 1,
+            'rdseed' => 1,
+            'rdtscp' => 1,
+            'sep' => 1,
+            'smap' => 1,
+            'smep' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'vme' => 1,
+            'x2apic' => 1,
+            'xsave' => 1,
+            'xsaveopt' => 1,
+        },
+    },
+    'Broadwell-IBRS' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 79,
+        version => 3,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'adx' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'hle' => 1,
+            'invpcid' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pcid' => 1,
+            'pclmuldq' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdrand' => 1,
+            'rdseed' => 1,
+            'rdtscp' => 1,
+            'rtm' => 1,
+            'sep' => 1,
+            'smap' => 1,
+            'smep' => 1,
+            'spec-ctrl' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'vme' => 1,
+            'x2apic' => 1,
+            'xsave' => 1,
+            'xsaveopt' => 1,
+        },
+    },
+    'Broadwell-noTSX-IBRS' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 79,
+        version => 4,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'adx' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'invpcid' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pcid' => 1,
+            'pclmuldq' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdrand' => 1,
+            'rdseed' => 1,
+            'rdtscp' => 1,
+            'sep' => 1,
+            'smap' => 1,
+            'smep' => 1,
+            'spec-ctrl' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'vme' => 1,
+            'x2apic' => 1,
+            'xsave' => 1,
+            'xsaveopt' => 1,
+        },
+    },
+    'Skylake-Client' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 78,
+        version => 1,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'adx' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'hle' => 1,
+            'invpcid' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pcid' => 1,
+            'pclmuldq' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdrand' => 1,
+            'rdseed' => 1,
+            'rdtscp' => 1,
+            'rtm' => 1,
+            'sep' => 1,
+            'smap' => 1,
+            'smep' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'vme' => 1,
+            'x2apic' => 1,
+            'xgetbv1' => 1,
+            'xsave' => 1,
+            'xsavec' => 1,
+            'xsaveopt' => 1,
+        },
+    },
+    'Skylake-Client-IBRS' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 78,
+        version => 2,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'adx' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'hle' => 1,
+            'invpcid' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pcid' => 1,
+            'pclmuldq' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdrand' => 1,
+            'rdseed' => 1,
+            'rdtscp' => 1,
+            'rtm' => 1,
+            'sep' => 1,
+            'smap' => 1,
+            'smep' => 1,
+            'spec-ctrl' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'vme' => 1,
+            'x2apic' => 1,
+            'xgetbv1' => 1,
+            'xsave' => 1,
+            'xsavec' => 1,
+            'xsaveopt' => 1,
+        },
+    },
+    'Skylake-Client-noTSX-IBRS' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 78,
+        version => 3,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'adx' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'invpcid' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pcid' => 1,
+            'pclmuldq' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdrand' => 1,
+            'rdseed' => 1,
+            'rdtscp' => 1,
+            'sep' => 1,
+            'smap' => 1,
+            'smep' => 1,
+            'spec-ctrl' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'vme' => 1,
+            'x2apic' => 1,
+            'xgetbv1' => 1,
+            'xsave' => 1,
+            'xsavec' => 1,
+            'xsaveopt' => 1,
+        },
+    },
+    'Skylake-Client-v4' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 78,
+        version => 4,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'adx' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'invpcid' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pcid' => 1,
+            'pclmuldq' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdrand' => 1,
+            'rdseed' => 1,
+            'rdtscp' => 1,
+            'sep' => 1,
+            'smap' => 1,
+            'smep' => 1,
+            'spec-ctrl' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'vme' => 1,
+            'x2apic' => 1,
+            'xgetbv1' => 1,
+            'xsave' => 1,
+            'xsavec' => 1,
+            'xsaveopt' => 1,
+            'xsaves' => 1,
+        },
+    },
+    'Skylake-Server' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 85,
+        version => 1,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'adx' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'avx512bw' => 1,
+            'avx512cd' => 1,
+            'avx512dq' => 1,
+            'avx512f' => 1,
+            'avx512vl' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'clflushopt' => 1,
+            'clwb' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'hle' => 1,
+            'invpcid' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pcid' => 1,
+            'pclmuldq' => 1,
+            'pdpe1gb' => 1,
+            'pge' => 1,
+            'pku' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdrand' => 1,
+            'rdseed' => 1,
+            'rdtscp' => 1,
+            'rtm' => 1,
+            'sep' => 1,
+            'smap' => 1,
+            'smep' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'vme' => 1,
+            'x2apic' => 1,
+            'xgetbv1' => 1,
+            'xsave' => 1,
+            'xsavec' => 1,
+            'xsaveopt' => 1,
+        },
+    },
+    'Skylake-Server-IBRS' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 85,
+        version => 2,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'adx' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'avx512bw' => 1,
+            'avx512cd' => 1,
+            'avx512dq' => 1,
+            'avx512f' => 1,
+            'avx512vl' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'clwb' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'hle' => 1,
+            'invpcid' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pcid' => 1,
+            'pclmuldq' => 1,
+            'pdpe1gb' => 1,
+            'pge' => 1,
+            'pku' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdrand' => 1,
+            'rdseed' => 1,
+            'rdtscp' => 1,
+            'rtm' => 1,
+            'sep' => 1,
+            'smap' => 1,
+            'smep' => 1,
+            'spec-ctrl' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'vme' => 1,
+            'x2apic' => 1,
+            'xgetbv1' => 1,
+            'xsave' => 1,
+            'xsavec' => 1,
+            'xsaveopt' => 1,
+        },
+    },
+    'Skylake-Server-noTSX-IBRS' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 85,
+        version => 3,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'adx' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'avx512bw' => 1,
+            'avx512cd' => 1,
+            'avx512dq' => 1,
+            'avx512f' => 1,
+            'avx512vl' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'clwb' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'invpcid' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pcid' => 1,
+            'pclmuldq' => 1,
+            'pdpe1gb' => 1,
+            'pge' => 1,
+            'pku' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdrand' => 1,
+            'rdseed' => 1,
+            'rdtscp' => 1,
+            'sep' => 1,
+            'smap' => 1,
+            'smep' => 1,
+            'spec-ctrl' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'vme' => 1,
+            'x2apic' => 1,
+            'xgetbv1' => 1,
+            'xsave' => 1,
+            'xsavec' => 1,
+            'xsaveopt' => 1,
+        },
+    },
+    'Skylake-Server-v4' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 85,
+        version => 4,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'adx' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'avx512bw' => 1,
+            'avx512cd' => 1,
+            'avx512dq' => 1,
+            'avx512f' => 1,
+            'avx512vl' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'clwb' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'invpcid' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pcid' => 1,
+            'pclmuldq' => 1,
+            'pdpe1gb' => 1,
+            'pge' => 1,
+            'pku' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdrand' => 1,
+            'rdseed' => 1,
+            'rdtscp' => 1,
+            'sep' => 1,
+            'smap' => 1,
+            'smep' => 1,
+            'spec-ctrl' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'vme' => 1,
+            'x2apic' => 1,
+            'xgetbv1' => 1,
+            'xsave' => 1,
+            'xsavec' => 1,
+            'xsaveopt' => 1,
+        },
+    },
+    'Skylake-Server-v5' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 85,
+        version => 5,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'adx' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'avx512bw' => 1,
+            'avx512cd' => 1,
+            'avx512dq' => 1,
+            'avx512f' => 1,
+            'avx512vl' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'clwb' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'invpcid' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pcid' => 1,
+            'pclmuldq' => 1,
+            'pdpe1gb' => 1,
+            'pge' => 1,
+            'pku' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdrand' => 1,
+            'rdseed' => 1,
+            'rdtscp' => 1,
+            'sep' => 1,
+            'smap' => 1,
+            'smep' => 1,
+            'spec-ctrl' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'vme' => 1,
+            'x2apic' => 1,
+            'xgetbv1' => 1,
+            'xsave' => 1,
+            'xsavec' => 1,
+            'xsaveopt' => 1,
+            'xsaves' => 1,
+        },
+    },
+    'Cascadelake-Server' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 86,
+        version => 1,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'adx' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'avx512bw' => 1,
+            'avx512cd' => 1,
+            'avx512dq' => 1,
+            'avx512f' => 1,
+            'avx512vl' => 1,
+            'avx512vnni' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'clflushopt' => 1,
+            'clwb' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'hle' => 1,
+            'invpcid' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pcid' => 1,
+            'pclmuldq' => 1,
+            'pdpe1gb' => 1,
+            'pge' => 1,
+            'pku' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdrand' => 1,
+            'rdseed' => 1,
+            'rdtscp' => 1,
+            'rtm' => 1,
+            'sep' => 1,
+            'smap' => 1,
+            'smep' => 1,
+            'spec-ctrl' => 1,
+            'ssbd' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'vme' => 1,
+            'x2apic' => 1,
+            'xgetbv1' => 1,
+            'xsave' => 1,
+            'xsavec' => 1,
+            'xsaveopt' => 1,
+        },
+    },
+    'Cascadelake-Server-v2' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 86,
+        version => 2,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'adx' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'arch-capabilities' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'avx512bw' => 1,
+            'avx512cd' => 1,
+            'avx512dq' => 1,
+            'avx512f' => 1,
+            'avx512vl' => 1,
+            'avx512vnni' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'clflushopt' => 1,
+            'clwb' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'hle' => 1,
+            'ibrs-all' => 1,
+            'invpcid' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mds-no' => 1,
+            'mmx' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pcid' => 1,
+            'pclmuldq' => 1,
+            'pdpe1gb' => 1,
+            'pge' => 1,
+            'pku' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdctl-no' => 1,
+            'rdrand' => 1,
+            'rdseed' => 1,
+            'rdtscp' => 1,
+            'rtm' => 1,
+            'sep' => 1,
+            'skip-l1dfl-vmentry' => 1,
+            'smap' => 1,
+            'smep' => 1,
+            'spec-ctrl' => 1,
+            'ssbd' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'vme' => 1,
+            'x2apic' => 1,
+            'xgetbv1' => 1,
+            'xsave' => 1,
+            'xsavec' => 1,
+            'xsaveopt' => 1,
+        },
+    },
+    'Cascadelake-Server-noTSX' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 86,
+        version => 3,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'adx' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'arch-capabilities' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'avx512bw' => 1,
+            'avx512cd' => 1,
+            'avx512dq' => 1,
+            'avx512f' => 1,
+            'avx512vl' => 1,
+            'avx512vnni' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'clflushopt' => 1,
+            'clwb' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'ibrs-all' => 1,
+            'invpcid' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mds-no' => 1,
+            'mmx' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pcid' => 1,
+            'pclmuldq' => 1,
+            'pdpe1gb' => 1,
+            'pge' => 1,
+            'pku' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdctl-no' => 1,
+            'rdrand' => 1,
+            'rdseed' => 1,
+            'rdtscp' => 1,
+            'sep' => 1,
+            'skip-l1dfl-vmentry' => 1,
+            'smap' => 1,
+            'smep' => 1,
+            'spec-ctrl' => 1,
+            'ssbd' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'vme' => 1,
+            'x2apic' => 1,
+            'xgetbv1' => 1,
+            'xsave' => 1,
+            'xsavec' => 1,
+            'xsaveopt' => 1,
+        },
+    },
+    'Cascadelake-Server-v4' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 86,
+        version => 4,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'adx' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'arch-capabilities' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'avx512bw' => 1,
+            'avx512cd' => 1,
+            'avx512dq' => 1,
+            'avx512f' => 1,
+            'avx512vl' => 1,
+            'avx512vnni' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'clflushopt' => 1,
+            'clwb' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'ibrs-all' => 1,
+            'invpcid' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mds-no' => 1,
+            'mmx' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pcid' => 1,
+            'pclmuldq' => 1,
+            'pdpe1gb' => 1,
+            'pge' => 1,
+            'pku' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdctl-no' => 1,
+            'rdrand' => 1,
+            'rdseed' => 1,
+            'rdtscp' => 1,
+            'sep' => 1,
+            'skip-l1dfl-vmentry' => 1,
+            'smap' => 1,
+            'smep' => 1,
+            'spec-ctrl' => 1,
+            'ssbd' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'vme' => 1,
+            'x2apic' => 1,
+            'xgetbv1' => 1,
+            'xsave' => 1,
+            'xsavec' => 1,
+            'xsaveopt' => 1,
+        },
+    },
+    'Cascadelake-Server-v5' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 86,
+        version => 5,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'adx' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'arch-capabilities' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'avx512bw' => 1,
+            'avx512cd' => 1,
+            'avx512dq' => 1,
+            'avx512f' => 1,
+            'avx512vl' => 1,
+            'avx512vnni' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'clflushopt' => 1,
+            'clwb' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'ibrs-all' => 1,
+            'invpcid' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mds-no' => 1,
+            'mmx' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pcid' => 1,
+            'pclmuldq' => 1,
+            'pdpe1gb' => 1,
+            'pge' => 1,
+            'pku' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdctl-no' => 1,
+            'rdrand' => 1,
+            'rdseed' => 1,
+            'rdtscp' => 1,
+            'sep' => 1,
+            'skip-l1dfl-vmentry' => 1,
+            'smap' => 1,
+            'smep' => 1,
+            'spec-ctrl' => 1,
+            'ssbd' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'vme' => 1,
+            'x2apic' => 1,
+            'xgetbv1' => 1,
+            'xsave' => 1,
+            'xsavec' => 1,
+            'xsaveopt' => 1,
+            'xsaves' => 1,
+        },
+    },
+    'Cooperlake' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 87,
+        version => 1,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'adx' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'arch-capabilities' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'avx512-bf16' => 1,
+            'avx512bw' => 1,
+            'avx512cd' => 1,
+            'avx512dq' => 1,
+            'avx512f' => 1,
+            'avx512vl' => 1,
+            'avx512vnni' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'clflushopt' => 1,
+            'clwb' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'hle' => 1,
+            'ibrs-all' => 1,
+            'invpcid' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mds-no' => 1,
+            'mmx' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pcid' => 1,
+            'pclmuldq' => 1,
+            'pdpe1gb' => 1,
+            'pge' => 1,
+            'pku' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pschange-mc-no' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdctl-no' => 1,
+            'rdrand' => 1,
+            'rdseed' => 1,
+            'rdtscp' => 1,
+            'rtm' => 1,
+            'sep' => 1,
+            'skip-l1dfl-vmentry' => 1,
+            'smap' => 1,
+            'smep' => 1,
+            'spec-ctrl' => 1,
+            'ssbd' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'stibp' => 1,
+            'syscall' => 1,
+            'taa-no' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'vme' => 1,
+            'x2apic' => 1,
+            'xgetbv1' => 1,
+            'xsave' => 1,
+            'xsavec' => 1,
+            'xsaveopt' => 1,
+        },
+    },
+    'Cooperlake-v2' => { 
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 87,
+        version => 2,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'adx' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'arch-capabilities' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'avx512-bf16' => 1,
+            'avx512bw' => 1,
+            'avx512cd' => 1,
+            'avx512dq' => 1,
+            'avx512f' => 1,
+            'avx512vl' => 1,
+            'avx512vnni' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'clflushopt' => 1,
+            'clwb' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'hle' => 1,
+            'ibrs-all' => 1,
+            'invpcid' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mds-no' => 1,
+            'mmx' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pcid' => 1,
+            'pclmuldq' => 1,
+            'pdpe1gb' => 1,
+            'pge' => 1,
+            'pku' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pschange-mc-no' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdctl-no' => 1,
+            'rdrand' => 1,
+            'rdseed' => 1,
+            'rdtscp' => 1,
+            'rtm' => 1,
+            'sep' => 1,
+            'skip-l1dfl-vmentry' => 1,
+            'smap' => 1,
+            'smep' => 1,
+            'spec-ctrl' => 1,
+            'ssbd' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'stibp' => 1,
+            'syscall' => 1,
+            'taa-no' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'vme' => 1,
+            'x2apic' => 1,
+            'xgetbv1' => 1,
+            'xsave' => 1,
+            'xsavec' => 1,
+            'xsaveopt' => 1,
+            'xsaves' => 1,
+        },
+    },
+    'Icelake-Server' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 134,
+        version => 1,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'adx' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'avx512-vpopcntdq' => 1,
+            'avx512bitalg' => 1,
+            'avx512bw' => 1,
+            'avx512cd' => 1,
+            'avx512dq' => 1,
+            'avx512f' => 1,
+            'avx512vbmi' => 1,
+            'avx512vbmi2' => 1,
+            'avx512vl' => 1,
+            'avx512vnni' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'clflushopt' => 1,
+            'clwb' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'gfni' => 1,
+            'hle' => 1,
+            'invpcid' => 1,
+            'la57' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pcid' => 1,
+            'pclmuldq' => 1,
+            'pdpe1gb' => 1,
+            'pge' => 1,
+            'pku' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdrand' => 1,
+            'rdseed' => 1,
+            'rdtscp' => 1,
+            'rtm' => 1,
+            'sep' => 1,
+            'smap' => 1,
+            'smep' => 1,
+            'spec-ctrl' => 1,
+            'ssbd' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'umip' => 1,
+            'vaes' => 1,
+            'vme' => 1,
+            'vpclmulqdq' => 1,
+            'wbnoinvd' => 1,
+            'x2apic' => 1,
+            'xgetbv1' => 1,
+            'xsave' => 1,
+            'xsavec' => 1,
+            'xsaveopt' => 1,
+        },
+    },
+    'Icelake-Server-noTSX' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 134,
+        version => 2,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'adx' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'avx512-vpopcntdq' => 1,
+            'avx512bitalg' => 1,
+            'avx512bw' => 1,
+            'avx512cd' => 1,
+            'avx512dq' => 1,
+            'avx512f' => 1,
+            'avx512vbmi' => 1,
+            'avx512vbmi2' => 1,
+            'avx512vl' => 1,
+            'avx512vnni' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'clflushopt' => 1,
+            'clwb' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'gfni' => 1,
+            'invpcid' => 1,
+            'la57' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pcid' => 1,
+            'pclmuldq' => 1,
+            'pdpe1gb' => 1,
+            'pge' => 1,
+            'pku' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdrand' => 1,
+            'rdseed' => 1,
+            'rdtscp' => 1,
+            'sep' => 1,
+            'smap' => 1,
+            'smep' => 1,
+            'spec-ctrl' => 1,
+            'ssbd' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'umip' => 1,
+            'vaes' => 1,
+            'vme' => 1,
+            'vpclmulqdq' => 1,
+            'wbnoinvd' => 1,
+            'x2apic' => 1,
+            'xgetbv1' => 1,
+            'xsave' => 1,
+            'xsavec' => 1,
+            'xsaveopt' => 1,
+        },
+    },
+    'Icelake-Server-v3' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 134,
+        version => 3,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'adx' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'arch-capabilities' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'avx512-vpopcntdq' => 1,
+            'avx512bitalg' => 1,
+            'avx512bw' => 1,
+            'avx512cd' => 1,
+            'avx512dq' => 1,
+            'avx512f' => 1,
+            'avx512vbmi' => 1,
+            'avx512vbmi2' => 1,
+            'avx512vl' => 1,
+            'avx512vnni' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'clflushopt' => 1,
+            'clwb' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'gfni' => 1,
+            'ibrs-all' => 1,
+            'invpcid' => 1,
+            'la57' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mds-no' => 1,
+            'mmx' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pcid' => 1,
+            'pclmuldq' => 1,
+            'pdpe1gb' => 1,
+            'pge' => 1,
+            'pku' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pschange-mc-no' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdctl-no' => 1,
+            'rdrand' => 1,
+            'rdseed' => 1,
+            'rdtscp' => 1,
+            'sep' => 1,
+            'skip-l1dfl-vmentry' => 1,
+            'smap' => 1,
+            'smep' => 1,
+            'spec-ctrl' => 1,
+            'ssbd' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'taa-no' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'umip' => 1,
+            'vaes' => 1,
+            'vme' => 1,
+            'vpclmulqdq' => 1,
+            'wbnoinvd' => 1,
+            'x2apic' => 1,
+            'xgetbv1' => 1,
+            'xsave' => 1,
+            'xsavec' => 1,
+            'xsaveopt' => 1,
+        },
+    },
+    'Icelake-Server-v4' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 134,
+        version => 4,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'adx' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'arch-capabilities' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'avx512-vpopcntdq' => 1,
+            'avx512bitalg' => 1,
+            'avx512bw' => 1,
+            'avx512cd' => 1,
+            'avx512dq' => 1,
+            'avx512f' => 1,
+            'avx512ifma' => 1,
+            'avx512vbmi' => 1,
+            'avx512vbmi2' => 1,
+            'avx512vl' => 1,
+            'avx512vnni' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'clflushopt' => 1,
+            'clwb' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fsrm' => 1,
+            'fxsr' => 1,
+            'gfni' => 1,
+            'ibrs-all' => 1,
+            'invpcid' => 1,
+            'la57' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mds-no' => 1,
+            'mmx' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pcid' => 1,
+            'pclmuldq' => 1,
+            'pdpe1gb' => 1,
+            'pge' => 1,
+            'pku' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pschange-mc-no' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdctl-no' => 1,
+            'rdpid' => 1,
+            'rdrand' => 1,
+            'rdseed' => 1,
+            'rdtscp' => 1,
+            'sep' => 1,
+            'sha-ni' => 1,
+            'skip-l1dfl-vmentry' => 1,
+            'smap' => 1,
+            'smep' => 1,
+            'spec-ctrl' => 1,
+            'ssbd' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'taa-no' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'umip' => 1,
+            'vaes' => 1,
+            'vme' => 1,
+            'vpclmulqdq' => 1,
+            'wbnoinvd' => 1,
+            'x2apic' => 1,
+            'xgetbv1' => 1,
+            'xsave' => 1,
+            'xsavec' => 1,
+            'xsaveopt' => 1,
+        },
+    },
+    'Icelake-Server-v5' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 134,
+        version => 5,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'adx' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'arch-capabilities' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'avx512-vpopcntdq' => 1,
+            'avx512bitalg' => 1,
+            'avx512bw' => 1,
+            'avx512cd' => 1,
+            'avx512dq' => 1,
+            'avx512f' => 1,
+            'avx512ifma' => 1,
+            'avx512vbmi' => 1,
+            'avx512vbmi2' => 1,
+            'avx512vl' => 1,
+            'avx512vnni' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'clflushopt' => 1,
+            'clwb' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fsrm' => 1,
+            'fxsr' => 1,
+            'gfni' => 1,
+            'ibrs-all' => 1,
+            'invpcid' => 1,
+            'la57' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mds-no' => 1,
+            'mmx' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pcid' => 1,
+            'pclmuldq' => 1,
+            'pdpe1gb' => 1,
+            'pge' => 1,
+            'pku' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pschange-mc-no' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdctl-no' => 1,
+            'rdpid' => 1,
+            'rdrand' => 1,
+            'rdseed' => 1,
+            'rdtscp' => 1,
+            'sep' => 1,
+            'sha-ni' => 1,
+            'skip-l1dfl-vmentry' => 1,
+            'smap' => 1,
+            'smep' => 1,
+            'spec-ctrl' => 1,
+            'ssbd' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'taa-no' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'umip' => 1,
+            'vaes' => 1,
+            'vme' => 1,
+            'vpclmulqdq' => 1,
+            'wbnoinvd' => 1,
+            'x2apic' => 1,
+            'xgetbv1' => 1,
+            'xsave' => 1,
+            'xsavec' => 1,
+            'xsaveopt' => 1,
+            'xsaves' => 1,
+        },
+    },
+    'Icelake-Server-v6' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 134,
+        version => 6,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'adx' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'arch-capabilities' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'avx512-vpopcntdq' => 1,
+            'avx512bitalg' => 1,
+            'avx512bw' => 1,
+            'avx512cd' => 1,
+            'avx512dq' => 1,
+            'avx512f' => 1,
+            'avx512ifma' => 1,
+            'avx512vbmi' => 1,
+            'avx512vbmi2' => 1,
+            'avx512vl' => 1,
+            'avx512vnni' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'clflushopt' => 1,
+            'clwb' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fsrm' => 1,
+            'fxsr' => 1,
+            'gfni' => 1,
+            'ibrs-all' => 1,
+            'invpcid' => 1,
+            'la57' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mds-no' => 1,
+            'mmx' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pcid' => 1,
+            'pclmuldq' => 1,
+            'pdpe1gb' => 1,
+            'pge' => 1,
+            'pku' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pschange-mc-no' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdctl-no' => 1,
+            'rdpid' => 1,
+            'rdrand' => 1,
+            'rdseed' => 1,
+            'rdtscp' => 1,
+            'sep' => 1,
+            'sha-ni' => 1,
+            'skip-l1dfl-vmentry' => 1,
+            'smap' => 1,
+            'smep' => 1,
+            'spec-ctrl' => 1,
+            'ssbd' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'taa-no' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'umip' => 1,
+            'vaes' => 1,
+            'vme' => 1,
+            'vpclmulqdq' => 1,
+            'wbnoinvd' => 1,
+            'x2apic' => 1,
+            'xgetbv1' => 1,
+            'xsave' => 1,
+            'xsavec' => 1,
+            'xsaveopt' => 1,
+            'xsaves' => 1,
+        },
+    },
+    'SapphireRapids' => {
+        vendor => 'GenuineIntel',
+	family => 6,
+        model => 143,
+        version => 1,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'adx' => 1,
+            'aes' => 1,
+            'amx-bf16' => 1,
+            'amx-int8' => 1,
+            'amx-tile' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'arch-capabilities' => 1,
+            'avx' => 1,
+            'avx-vnni' => 1,
+            'avx2' => 1,
+            'avx512-bf16' => 1,
+            'avx512-fp16' => 1,
+            'avx512-vpopcntdq' => 1,
+            'avx512bitalg' => 1,
+            'avx512bw' => 1,
+            'avx512cd' => 1,
+            'avx512dq' => 1,
+            'avx512f' => 1,
+            'avx512ifma' => 1,
+            'avx512vbmi' => 1,
+            'avx512vbmi2' => 1,
+            'avx512vl' => 1,
+            'avx512vnni' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'bus-lock-detect' => 1,
+            'clflush' => 1,
+            'clflushopt' => 1,
+            'clwb' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fsrc' => 1,
+            'fsrm' => 1,
+            'fsrs' => 1,
+            'fxsr' => 1,
+            'fzrm' => 1,
+            'gfni' => 1,
+            'hle' => 1,
+            'ibrs-all' => 1,
+            'invpcid' => 1,
+            'la57' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mds-no' => 1,
+            'mmx' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pcid' => 1,
+            'pclmuldq' => 1,
+            'pdpe1gb' => 1,
+            'pge' => 1,
+            'pku' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pschange-mc-no' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdctl-no' => 1,
+            'rdpid' => 1,
+            'rdrand' => 1,
+            'rdseed' => 1,
+            'rdtscp' => 1,
+            'rtm' => 1,
+            'sep' => 1,
+            'serialize' => 1,
+            'sha-ni' => 1,
+            'skip-l1dfl-vmentry' => 1,
+            'smap' => 1,
+            'smep' => 1,
+            'spec-ctrl' => 1,
+            'ssbd' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'ssse3' => 1,
+            'syscall' => 1,
+            'taa-no' => 1,
+            'tsc' => 1,
+            'tsc-deadline' => 1,
+            'tsx-ldtrk' => 1,
+            'umip' => 1,
+            'vaes' => 1,
+            'vme' => 1,
+            'vpclmulqdq' => 1,
+            'wbnoinvd' => 1,
+            'x2apic' => 1,
+            'xfd' => 1,
+            'xgetbv1' => 1,
+            'xsave' => 1,
+            'xsavec' => 1,
+            'xsaveopt' => 1,
+            'xsaves' => 1,
+        },
+    },
+    'Opteron_G1' => {
+        vendor => 'AuthenticAMD',
+	family => 15,
+        model => 6,
+        version => 1,
+        flags => {
+            'apic' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'fpu' => 1,
+            'fxsr' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'sep' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'vme' => 1,
+        },
+    },
+    'Opteron_G2' => {
+        vendor => 'AuthenticAMD',
+	family => 16,
+        model => 6,
+        version => 1,
+        flags => {
+            'apic' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'fpu' => 1,
+            'fxsr' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'mmx' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'sep' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'svm' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'vme' => 1,
+        },
+    },
+    'Opteron_G3' => {
+        vendor => 'AuthenticAMD',
+	family => 16,
+        model => 2,
+        version => 1,
+        flags => {
+            'abm' => 1,
+            'apic' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'fpu' => 1,
+            'fxsr' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'misalignsse' => 1,
+            'mmx' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdtscp' => 1,
+            'sep' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4a' => 1,
+            'svm' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'vme' => 1,
+        },
+    },
+    'Opteron_G4' => {
+        vendor => 'AuthenticAMD',
+	family => 21,
+        model => 1,
+        version => 1,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'avx' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'fma4' => 1,
+            'fpu' => 1,
+            'fxsr' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'misalignsse' => 1,
+            'mmx' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'npt' => 1,
+            'nrip-save' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pclmuldq' => 1,
+            'pdpe1gb' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdtscp' => 1,
+            'sep' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'sse4a' => 1,
+            'ssse3' => 1,
+            'svm' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'vme' => 1,
+            'xop' => 1,
+            'xsave' => 1,
+        },
+    },
+    'Opteron_G5' => {
+        vendor => 'AuthenticAMD',
+	family => 21,
+        model => 2,
+        version => 1,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'avx' => 1,
+            'clflush' => 1,
+            'cmov' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fma4' => 1,
+            'fpu' => 1,
+            'fxsr' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'misalignsse' => 1,
+            'mmx' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'npt' => 1,
+            'nrip-save' => 1,
+            'nx' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pclmuldq' => 1,
+            'pdpe1gb' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdtscp' => 1,
+            'sep' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'sse4a' => 1,
+            'ssse3' => 1,
+            'svm' => 1,
+            'syscall' => 1,
+            'tbm' => 1,
+            'tsc' => 1,
+            'vme' => 1,
+            'xop' => 1,
+            'xsave' => 1,
+        },
+    },
+    'EPYC' => {
+        vendor => 'AuthenticAMD',
+	family => 23,
+        model => 1,
+        version => 1,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'adx' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'clflushopt' => 1,
+            'cmov' => 1,
+            'cr8legacy' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'fxsr_opt' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'misalignsse' => 1,
+            'mmx' => 1,
+            'mmxext' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'npt' => 1,
+            'nrip-save' => 1,
+            'nx' => 1,
+            'osvw' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pclmuldq' => 1,
+            'pdpe1gb' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdrand' => 1,
+            'rdseed' => 1,
+            'rdtscp' => 1,
+            'sep' => 1,
+            'sha-ni' => 1,
+            'smap' => 1,
+            'smep' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'sse4a' => 1,
+            'ssse3' => 1,
+            'svm' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'vme' => 1,
+            'xgetbv1' => 1,
+            'xsave' => 1,
+            'xsavec' => 1,
+            'xsaveopt' => 1,
+        },
+    },
+    'EPYC-IBPB' => {
+        vendor => 'AuthenticAMD',
+	family => 23,
+        model => 1,
+        version => 2,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'adx' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'clflushopt' => 1,
+            'cmov' => 1,
+            'cr8legacy' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'fxsr_opt' => 1,
+            'ibpb' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'misalignsse' => 1,
+            'mmx' => 1,
+            'mmxext' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'npt' => 1,
+            'nrip-save' => 1,
+            'nx' => 1,
+            'osvw' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pclmuldq' => 1,
+            'pdpe1gb' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdrand' => 1,
+            'rdseed' => 1,
+            'rdtscp' => 1,
+            'sep' => 1,
+            'sha-ni' => 1,
+            'smap' => 1,
+            'smep' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'sse4a' => 1,
+            'ssse3' => 1,
+            'svm' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'vme' => 1,
+            'xgetbv1' => 1,
+            'xsave' => 1,
+            'xsavec' => 1,
+            'xsaveopt' => 1,
+        },
+    },
+    'EPYC-v3' => {
+        vendor => 'AuthenticAMD',
+	family => 23,
+        model => 1,
+        version => 3,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'adx' => 1,
+            'aes' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'clflushopt' => 1,
+            'clzero' => 1,
+            'cmov' => 1,
+            'cr8legacy' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'fxsr_opt' => 1,
+            'ibpb' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'misalignsse' => 1,
+            'mmx' => 1,
+            'mmxext' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'npt' => 1,
+            'nrip-save' => 1,
+            'nx' => 1,
+            'osvw' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pclmuldq' => 1,
+            'pdpe1gb' => 1,
+            'perfctr_core' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdrand' => 1,
+            'rdseed' => 1,
+            'rdtscp' => 1,
+            'sep' => 1,
+            'sha-ni' => 1,
+            'smap' => 1,
+            'smep' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'sse4a' => 1,
+            'ssse3' => 1,
+            'svm' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'vme' => 1,
+            'xgetbv1' => 1,
+            'xsave' => 1,
+            'xsavec' => 1,
+            'xsaveerptr' => 1,
+            'xsaveopt' => 1,
+            'xsaves' => 1,
+        },
+    },
+    'EPYC-Rome' => {
+        vendor => 'AuthenticAMD',
+	family => 23,
+        model => 49,
+        version => 1,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'adx' => 1,
+            'aes' => 1,
+            'amd-stibp' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'clflushopt' => 1,
+            'clwb' => 1,
+            'clzero' => 1,
+            'cmov' => 1,
+            'cr8legacy' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'fxsr_opt' => 1,
+            'ibpb' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'misalignsse' => 1,
+            'mmx' => 1,
+            'mmxext' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'npt' => 1,
+            'nrip-save' => 1,
+            'nx' => 1,
+            'osvw' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pclmuldq' => 1,
+            'pdpe1gb' => 1,
+            'perfctr_core' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdpid' => 1,
+            'rdrand' => 1,
+            'rdseed' => 1,
+            'rdtscp' => 1,
+            'sep' => 1,
+            'sha-ni' => 1,
+            'smap' => 1,
+            'smep' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'sse4a' => 1,
+            'ssse3' => 1,
+            'svm' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'umip' => 1,
+            'vme' => 1,
+            'wbnoinvd' => 1,
+            'xgetbv1' => 1,
+            'xsave' => 1,
+            'xsavec' => 1,
+            'xsaveerptr' => 1,
+            'xsaveopt' => 1,
+            'xsaves' => 1,
+        },
+    },
+    'EPYC-Rome-v2' => {
+        vendor => 'AuthenticAMD',
+	family => 23,
+        model => 49,
+        version => 2,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'adx' => 1,
+            'aes' => 1,
+            'amd-ssbd' => 1,
+            'amd-stibp' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'clflushopt' => 1,
+            'clwb' => 1,
+            'clzero' => 1,
+            'cmov' => 1,
+            'cr8legacy' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fxsr' => 1,
+            'fxsr_opt' => 1,
+            'ibpb' => 1,
+            'ibrs' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'misalignsse' => 1,
+            'mmx' => 1,
+            'mmxext' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'npt' => 1,
+            'nrip-save' => 1,
+            'nx' => 1,
+            'osvw' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pclmuldq' => 1,
+            'pdpe1gb' => 1,
+            'perfctr_core' => 1,
+            'pge' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdpid' => 1,
+            'rdrand' => 1,
+            'rdseed' => 1,
+            'rdtscp' => 1,
+            'sep' => 1,
+            'sha-ni' => 1,
+            'smap' => 1,
+            'smep' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'sse4a' => 1,
+            'ssse3' => 1,
+            'svm' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'umip' => 1,
+            'vme' => 1,
+            'wbnoinvd' => 1,
+            'xgetbv1' => 1,
+            'xsave' => 1,
+            'xsavec' => 1,
+            'xsaveerptr' => 1,
+            'xsaveopt' => 1,
+            'xsaves' => 1,
+        },
+    },
+    'EPYC-Milan' => {
+        vendor => 'AuthenticAMD',
+	family => 25,
+        model => 1,
+        version => 1,
+        flags => {
+            '3dnowprefetch' => 1,
+            'abm' => 1,
+            'adx' => 1,
+            'aes' => 1,
+            'amd-ssbd' => 1,
+            'amd-stibp' => 1,
+            'apic' => 1,
+            'arat' => 1,
+            'avx' => 1,
+            'avx2' => 1,
+            'bmi1' => 1,
+            'bmi2' => 1,
+            'clflush' => 1,
+            'clflushopt' => 1,
+            'clwb' => 1,
+            'clzero' => 1,
+            'cmov' => 1,
+            'cr8legacy' => 1,
+            'cx16' => 1,
+            'cx8' => 1,
+            'de' => 1,
+            'erms' => 1,
+            'f16c' => 1,
+            'fma' => 1,
+            'fpu' => 1,
+            'fsgsbase' => 1,
+            'fsrm' => 1,
+            'fxsr' => 1,
+            'fxsr_opt' => 1,
+            'ibpb' => 1,
+            'ibrs' => 1,
+            'invpcid' => 1,
+            'lahf_lm' => 1,
+            'lm' => 1,
+            'mca' => 1,
+            'mce' => 1,
+            'misalignsse' => 1,
+            'mmx' => 1,
+            'mmxext' => 1,
+            'movbe' => 1,
+            'msr' => 1,
+            'mtrr' => 1,
+            'npt' => 1,
+            'nrip-save' => 1,
+            'nx' => 1,
+            'osvw' => 1,
+            'pae' => 1,
+            'pat' => 1,
+            'pcid' => 1,
+            'pclmuldq' => 1,
+            'pdpe1gb' => 1,
+            'perfctr_core' => 1,
+            'pge' => 1,
+            'pku' => 1,
+            'pni' => 1,
+            'popcnt' => 1,
+            'pse' => 1,
+            'pse36' => 1,
+            'rdpid' => 1,
+            'rdrand' => 1,
+            'rdseed' => 1,
+            'rdtscp' => 1,
+            'sep' => 1,
+            'sha-ni' => 1,
+            'smap' => 1,
+            'smep' => 1,
+            'sse' => 1,
+            'sse2' => 1,
+            'sse4.1' => 1,
+            'sse4.2' => 1,
+            'sse4a' => 1,
+            'ssse3' => 1,
+            'svm' => 1,
+            'svme-addr-chk' => 1,
+            'syscall' => 1,
+            'tsc' => 1,
+            'umip' => 1,
+            'vme' => 1,
+            'wbnoinvd' => 1,
+            'xgetbv1' => 1,
+            'xsave' => 1,
+            'xsavec' => 1,
+            'xsaveerptr' => 1,
+            'xsaveopt' => 1,
+            'xsaves' => 1,
+        },
+    },
+};
+
+
+sub get_default_cpu_models {
+    return $cpumodels;
+}
+
+1;
\ No newline at end of file
diff --git a/PVE/QemuServer/Makefile b/PVE/QemuServer/Makefile
index e4ed184..97540af 100644
--- a/PVE/QemuServer/Makefile
+++ b/PVE/QemuServer/Makefile
@@ -9,6 +9,7 @@ SOURCES=PCI.pm		\
 	Monitor.pm	\
 	Machine.pm	\
 	CPUConfig.pm	\
+	CPUModels.pm	\
 	CGroup.pm	\
 	Drive.pm	\
 
-- 
2.30.2




^ permalink raw reply	[flat|nested] 37+ messages in thread

* [pve-devel] [PATCH v3 qemu-server 3/7] cpumodel: compute qemu supported flags
  2023-05-22 10:25 [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel Alexandre Derumier
                   ` (3 preceding siblings ...)
  2023-05-22 10:25 ` [pve-devel] [PATCH v3 qemu-server 2/7] cpumodel: add cpu models with flags Alexandre Derumier
@ 2023-05-22 10:25 ` Alexandre Derumier
  2023-05-22 10:25 ` [pve-devel] [PATCH v3 qemu-server 4/7] cpuconfig: add get_host_cpu_flags Alexandre Derumier
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 37+ messages in thread
From: Alexandre Derumier @ 2023-05-22 10:25 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 PVE/QemuServer/CPUConfig.pm |  2 +-
 PVE/QemuServer/CPUModels.pm | 12 +++++++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/PVE/QemuServer/CPUConfig.pm b/PVE/QemuServer/CPUConfig.pm
index 758f93f..64be1f4 100644
--- a/PVE/QemuServer/CPUConfig.pm
+++ b/PVE/QemuServer/CPUConfig.pm
@@ -57,7 +57,7 @@ my $depreacated_cpu_map = {
     'Icelake-Client-noTSX' => 'Icelake-Server-noTSX',
 };
 
-my $qemu_cpu_models = get_default_cpu_models();
+my ($qemu_cpu_models, $qemu_supported_flags) = get_default_cpu_models();
 
 my @supported_cpu_flags = (
     'pcid',
diff --git a/PVE/QemuServer/CPUModels.pm b/PVE/QemuServer/CPUModels.pm
index 20aacb1..e838b0c 100644
--- a/PVE/QemuServer/CPUModels.pm
+++ b/PVE/QemuServer/CPUModels.pm
@@ -4205,7 +4205,17 @@ my $cpumodels = {
 
 
 sub get_default_cpu_models {
-    return $cpumodels;
+    my $supported_flags = {};
+
+    foreach my $model (keys %$cpumodels) {
+	my $flags = $cpumodels->{$model}->{flags};
+	next if !$flags;
+	foreach my $flag (keys %$flags) {
+	    $supported_flags->{$flag} = 1;
+	}
+    }
+
+    return ($cpumodels, $supported_flags);
 }
 
 1;
\ No newline at end of file
-- 
2.30.2




^ permalink raw reply	[flat|nested] 37+ messages in thread

* [pve-devel] [PATCH v3 qemu-server 4/7] cpuconfig: add get_host_cpu_flags
  2023-05-22 10:25 [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel Alexandre Derumier
                   ` (4 preceding siblings ...)
  2023-05-22 10:25 ` [pve-devel] [PATCH v3 qemu-server 3/7] cpumodel: compute qemu supported flags Alexandre Derumier
@ 2023-05-22 10:25 ` Alexandre Derumier
  2023-05-22 10:25 ` [pve-devel] [PATCH v3 qemu-server 5/7] cpuconfig: add find_best_cpumodel Alexandre Derumier
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 37+ messages in thread
From: Alexandre Derumier @ 2023-05-22 10:25 UTC (permalink / raw)
  To: pve-devel

parse cpuinfo flags && msr and create an hash with all flags

convert to qemu naming if needed

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 PVE/QemuServer/CPUConfig.pm | 70 +++++++++++++++++++++++++++++++++++++
 1 file changed, 70 insertions(+)

diff --git a/PVE/QemuServer/CPUConfig.pm b/PVE/QemuServer/CPUConfig.pm
index 64be1f4..45bf26f 100644
--- a/PVE/QemuServer/CPUConfig.pm
+++ b/PVE/QemuServer/CPUConfig.pm
@@ -13,6 +13,7 @@ use base qw(PVE::SectionConfig Exporter);
 our @EXPORT_OK = qw(
 print_cpu_device
 get_cpu_options
+get_host_cpu_flags
 );
 
 # under certain race-conditions, this module might be loaded before pve-cluster
@@ -626,6 +627,75 @@ sub get_cpu_from_running_vm {
     return $1;
 }
 
+sub get_host_cpu_flags {
+    my ($cpuinfo) = @_;
+
+    my $res = {};
+
+    #some qemu flag have different name than cpuinfo
+    my $map = {
+	'sse4_1' => 'sse4.1',
+	'sse4_2' => 'sse4.2',
+	'tsc_deadline_timer' => 'tsc-deadline',
+	'pclmulqdq' => 'pclmuldq',
+	'arch_capabilities' => 'arch-capabilities',
+	'avx512_vnni' => 'avx512vnni',
+	'avx512_bf16' => 'avx512-bf16',
+	'avx512_vpopcntdq' => 'avx512-vpopcntdq',
+	'avx512_vbmi2' => 'avx512vbmi2',
+	'avx512_bitalg' => 'avx512bitalg',
+	'avx512_fp16' => 'avx512-fp16',
+	'sha_ni' => 'sha-ni',
+	'cr8_legacy' => 'cr8legacy',
+	'nrip_save' => 'nrip-save',
+	'amx_bf16' => 'amx-bf16',
+	'avx_vnni' => 'avx-vnni',
+	'amx_int8' => 'amx-int8',
+	'amx_tile' => 'amx-tile',
+	'bus_lock_detect' => 'bus-lock-detect',
+	'tsxldtrk' => 'tsx-ldtrk',
+    };
+
+    if ($cpuinfo->{vendor} eq 'AuthenticAMD') {
+	$map->{ssbd} = 'amd-ssbd';
+	$map->{stibp} = 'amd-stibp';
+    }
+
+    my @flags = split ' ', $cpuinfo->{'flags'};
+    foreach my $flag (@flags) {
+	$flag = $map->{$flag} if $map->{$flag};
+	next if !$qemu_supported_flags->{$flag};
+        $res->{$flag} = 1;
+    }
+
+    #spec-ctrl msr
+    my $spectre_msr = $cpuinfo->{msr}->{'spec-ctrl'};
+    $res->{'spec-ctrl'} = 1 if defined($spectre_msr) && $spectre_msr == 0;
+
+    #arch-capabilities msr
+    my $capabilities = {
+	'rdctl-no' => 0,
+	'ibrs-all' => 1,
+	'rsba' => 2,
+	'skip-l1dfl-vmentry' => 3,
+	'ssb-no' => 4,
+	'mds-no' => 5,
+	'pschange-mc-no' => 6,
+	'tsx-ctrl' => 7,
+	'taa-no' => 8,
+	'fb-clear' => 17
+    };
+
+    if ($cpuinfo->{msr}->{'arch-capabilities'}) {
+	foreach my $capabilitie (keys %$capabilities) {
+	    my $value = $capabilities->{$capabilitie};
+	    $res->{$capabilitie} = 1 if $cpuinfo->{msr}->{'arch-capabilities'} >> $value & 1;
+	}
+    }
+
+    return $res;
+}
+
 __PACKAGE__->register();
 __PACKAGE__->init();
 
-- 
2.30.2




^ permalink raw reply	[flat|nested] 37+ messages in thread

* [pve-devel] [PATCH v3 qemu-server 5/7] cpuconfig: add find_best_cpumodel
  2023-05-22 10:25 [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel Alexandre Derumier
                   ` (5 preceding siblings ...)
  2023-05-22 10:25 ` [pve-devel] [PATCH v3 qemu-server 4/7] cpuconfig: add get_host_cpu_flags Alexandre Derumier
@ 2023-05-22 10:25 ` Alexandre Derumier
  2023-05-22 10:25 ` [pve-devel] [PATCH v3 qemu-server 6/7] cpuconfig: add find_hosts_common_flags Alexandre Derumier
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 37+ messages in thread
From: Alexandre Derumier @ 2023-05-22 10:25 UTC (permalink / raw)
  To: pve-devel

return the more recent cpu model compatible with host cpu

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 PVE/QemuServer/CPUConfig.pm | 46 +++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/PVE/QemuServer/CPUConfig.pm b/PVE/QemuServer/CPUConfig.pm
index 45bf26f..63e57d4 100644
--- a/PVE/QemuServer/CPUConfig.pm
+++ b/PVE/QemuServer/CPUConfig.pm
@@ -14,6 +14,7 @@ our @EXPORT_OK = qw(
 print_cpu_device
 get_cpu_options
 get_host_cpu_flags
+find_best_cpumodel
 );
 
 # under certain race-conditions, this module might be loaded before pve-cluster
@@ -696,6 +697,51 @@ sub get_host_cpu_flags {
     return $res;
 }
 
+sub find_best_cpumodel {
+    my ($host_flags, $vendor) = @_;
+
+    my $res = {};
+
+    #flags in qemu model but not in cpuinfo
+    my $missing_flag = {
+	#qemu internal
+	'svme-addr-chk' => 1,
+	#TCG exposes CPUID flags FSRM, FZRM, FSRS, FSRC.
+	#These do not correspond to any new instructions; 
+	#they only direct software to use string operations even if the length is zero or short.
+	fzrm => 1,
+	fsrc => 1,
+	fsr => 1,
+	fsrs => 1,
+	#masked from cpuinfo
+	xfd => 1,
+    };
+
+    foreach my $cpu (keys %$qemu_cpu_models) {
+	next if $qemu_cpu_models->{$cpu}->{vendor} ne $vendor;
+	next if $qemu_cpu_models->{$cpu}->{model} == 0;
+	$res->{$cpu} = $qemu_cpu_models->{$cpu};
+	my $flags = $qemu_cpu_models->{$cpu}->{'flags'};
+	next if !$flags;
+	foreach my $flag (keys %$flags) {
+	    next if $missing_flag->{$flag};
+	    if (!$host_flags->{$flag}) {
+		#print"$cpu unsupported flag: $flag\n";
+		delete $res->{$cpu};
+	    }
+	}
+    }
+
+    foreach my $name (sort {
+			$res->{$b}->{family} <=> $res->{$a}->{family} ||
+			$res->{$b}->{model} <=> $res->{$a}->{model} ||
+			$res->{$b}->{version} <=> $res->{$a}->{version}
+		    } keys %$res) {
+	return $name;
+    }
+}
+
+
 __PACKAGE__->register();
 __PACKAGE__->init();
 
-- 
2.30.2




^ permalink raw reply	[flat|nested] 37+ messages in thread

* [pve-devel] [PATCH v3 qemu-server 6/7] cpuconfig: add find_hosts_common_flags
  2023-05-22 10:25 [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel Alexandre Derumier
                   ` (6 preceding siblings ...)
  2023-05-22 10:25 ` [pve-devel] [PATCH v3 qemu-server 5/7] cpuconfig: add find_best_cpumodel Alexandre Derumier
@ 2023-05-22 10:25 ` Alexandre Derumier
  2023-05-22 10:25 ` [pve-devel] [PATCH v3 qemu-server 7/7] add best cpu model detection tests Alexandre Derumier
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 37+ messages in thread
From: Alexandre Derumier @ 2023-05-22 10:25 UTC (permalink / raw)
  To: pve-devel

find common flags && vendor between differents hosts

if vendor are different (amd/intel), return default vendor

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 PVE/QemuServer/CPUConfig.pm | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/PVE/QemuServer/CPUConfig.pm b/PVE/QemuServer/CPUConfig.pm
index 63e57d4..3f24b31 100644
--- a/PVE/QemuServer/CPUConfig.pm
+++ b/PVE/QemuServer/CPUConfig.pm
@@ -741,6 +741,38 @@ sub find_best_cpumodel {
     }
 }
 
+sub find_hosts_common_flags {
+    my ($hosts_cpuinfo) = @_;
+
+    my $common_vendor = undef;
+    my $common_flags = {};
+
+    my $hosts_flags = {};
+    my $last_vendor = undef;
+    foreach my $cpuinfo (@$hosts_cpuinfo) {
+	my $flags = get_host_cpu_flags($cpuinfo);
+	foreach my $flag (keys %$flags) {
+	    $hosts_flags->{$flag}++;
+	}
+
+	if ($last_vendor && $cpuinfo->{vendor} ne $last_vendor) {
+	    $common_vendor = 'default';
+	} else {
+	    $last_vendor = $cpuinfo->{vendor};
+	    $common_vendor = $last_vendor;
+	}
+    }
+
+    my $nb_hosts = @{$hosts_cpuinfo};
+    foreach my $flag (keys %$hosts_flags) {
+	if ($hosts_flags->{$flag} == $nb_hosts) {
+	    $common_flags->{$flag} = 1;
+	}
+    }
+
+    return ($common_flags, $common_vendor);
+}
+
 
 __PACKAGE__->register();
 __PACKAGE__->init();
-- 
2.30.2




^ permalink raw reply	[flat|nested] 37+ messages in thread

* [pve-devel] [PATCH v3 qemu-server 7/7] add best cpu model detection tests
  2023-05-22 10:25 [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel Alexandre Derumier
                   ` (7 preceding siblings ...)
  2023-05-22 10:25 ` [pve-devel] [PATCH v3 qemu-server 6/7] cpuconfig: add find_hosts_common_flags Alexandre Derumier
@ 2023-05-22 10:25 ` Alexandre Derumier
  2023-05-31 11:36 ` [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel Fiona Ebner
  2023-06-01  9:34 ` Fiona Ebner
  10 siblings, 0 replies; 37+ messages in thread
From: Alexandre Derumier @ 2023-05-22 10:25 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 test/Makefile              |   5 +-
 test/run_cpumodel_tests.pl | 272 +++++++++++++++++++++++++++++++++++++
 2 files changed, 276 insertions(+), 1 deletion(-)
 create mode 100755 test/run_cpumodel_tests.pl

diff --git a/test/Makefile b/test/Makefile
index 7a8487c..390b332 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -3,7 +3,7 @@ MIGRATION_TEST_TARGETS := $(addprefix test_migration_,$(MIGRATION_TEST_NAMES))
 
 all: test
 
-test: test_snapshot test_ovf test_cfg_to_cmd test_pci_addr_conflicts test_qemu_img_convert test_migration test_restore_config
+test: test_snapshot test_ovf test_cfg_to_cmd test_pci_addr_conflicts test_qemu_img_convert test_migration test_restore_config test_cpumodel
 
 test_snapshot: run_snapshot_tests.pl
 	./run_snapshot_tests.pl
@@ -12,6 +12,9 @@ test_snapshot: run_snapshot_tests.pl
 test_ovf: run_ovf_tests.pl
 	./run_ovf_tests.pl
 
+test_cpumodel: run_cpumodel_tests.pl
+	./run_cpumodel_tests.pl
+
 test_cfg_to_cmd: run_config2command_tests.pl cfg2cmd/*.conf
 	perl -I../ ./run_config2command_tests.pl
 
diff --git a/test/run_cpumodel_tests.pl b/test/run_cpumodel_tests.pl
new file mode 100755
index 0000000..76d8ce4
--- /dev/null
+++ b/test/run_cpumodel_tests.pl
@@ -0,0 +1,272 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use lib qw(..); # prepend .. to @INC so we use the local version of PVE packages
+
+use PVE::QemuServer::CPUConfig;
+use Test::More;
+
+use Data::Dumper;
+
+
+print "test parsing cpumodel\n";
+
+my $cpus = [
+    {
+	expected_model => 'IvyBridge',
+	name => 'Intel(R) Xeon(R) CPU E5-2603 v2 @ 1.80GHz',
+	vendor => 'GenuineIntel',
+	model => 1,
+	flags => "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm cpuid_fault pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms xsaveopt dtherm arat pln pts md_clear flush_l1d"
+    },
+    {
+	expected_model => 'Haswell-noTSX-IBRS',
+	name => 'Intel(R) Xeon(R) CPU E5-2687W v3 @ 3.10GHz',
+	vendor => 'GenuineIntel',
+	model => 1,
+	msr => {
+	    'spec-ctrl' => 0,
+	},
+	flags => "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm xsaveopt cqm_llc cqm_occup_llc dtherm ida arat pln pts md_clear flush_l1d",
+    },
+    {
+	expected_model => 'Haswell-noTSX',
+	name => 'Intel(R) Xeon(R) CPU E5-2687W v3 @ 3.10GHz',
+	vendor => 'GenuineIntel',
+	model => 1,
+	flags => "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm xsaveopt cqm_llc cqm_occup_llc dtherm ida arat pln pts md_clear flush_l1d",
+    },
+    {
+	expected_model => 'Broadwell-noTSX',  #model is Broadwell, but best compatible version is notsx
+	name => 'Intel(R) Xeon(R) CPU E5-2687W v4 @ 3.00GHz',
+	vendor => 'GenuineIntel',
+	model => 1,
+	flags => "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a rdseed adx smap intel_pt xsaveopt cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts md_clear flush_l1d"
+    },
+    {
+	expected_model => 'Broadwell-noTSX-IBRS',
+	name => 'Intel(R) Xeon(R) CPU E5-2687W v4 @ 3.00GHz',
+	vendor => 'GenuineIntel',
+	model => 1,
+	msr => {
+	    'spec-ctrl' => 0,
+	    'arch-capabilities' => 511,
+	},
+	flags => "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a rdseed adx smap intel_pt xsaveopt cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts md_clear flush_l1d"
+    },
+    {
+	expected_model => 'Broadwell-noTSX-IBRS',
+	name => 'Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz',
+	vendor => 'GenuineIntel',
+	model => 1,
+	msr => {
+	    'spec-ctrl' => 0,
+	},
+	flags => "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch ida arat epb invpcid_single pln pts dtherm hwp hwp_notify hwp_act_window hwp_epp intel_pt rsb_ctxsw spec_ctrl retpoline kaiser tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt xsaveopt xsavec xgetbv1"
+    },
+    {
+	expected_model => 'Skylake-Server',
+	name => 'Intel(R) Xeon(R) Gold 6136 CPU @ 3.00GHz',
+	vendor => 'GenuineIntel',
+	model => 1,
+	flags => "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single pti intel_ppin ssbd mba ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts pku ospke md_clear flush_l1d arch_capabilities"
+    },
+    {
+	expected_model => 'Skylake-Server-v5',
+	name => 'Intel(R) Xeon(R) Gold 6136 CPU @ 3.00GHz',
+	vendor => 'GenuineIntel',
+	model => 1,
+	msr => {
+	    'spec-ctrl' => 0,
+	},
+	flags => "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single pti intel_ppin ssbd mba ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts pku ospke md_clear flush_l1d arch_capabilities"
+    },
+    {
+	expected_model => 'Cascadelake-Server',
+	name => 'Intel(R) Xeon(R) Gold 6240R CPU @ 2.40GHz',
+	vendor => 'GenuineIntel',
+	model => 1,
+	msr => {
+	    'spec-ctrl' => 0,
+	},
+	flags => "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single intel_ppin ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts pku ospke avx512_vnni md_clear flush_l1d arch_capabilities"
+    },
+    {
+	expected_model => 'Cascadelake-Server-v5',
+	name => 'Intel(R) Xeon(R) Gold 6240R CPU @ 2.40GHz',
+	vendor => 'GenuineIntel',
+	model => 1,
+	msr => {
+	    'spec-ctrl' => 0,
+	    'arch-capabilities' => 511,
+	},
+	flags => "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single intel_ppin ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts pku ospke avx512_vnni md_clear flush_l1d arch_capabilities"
+    },
+    {
+	expected_model => 'Cooperlake-v2',
+	name => 'Intel(R) Xeon(R) Gold 5318H CPU @ 2.50GHz',
+	vendor => 'GenuineIntel',
+	model => 1,
+	msr => {
+	    'spec-ctrl' => 0,
+	    'arch-capabilities' => 511,
+	},
+	flags => "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single intel_ppin ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local avx512_bf16 dtherm ida arat pln pts pku ospke avx512_vnni md_clear flush_l1d arch_capabilities"
+    },
+    {
+	expected_model => 'Icelake-Server-v3',
+	name => 'Intel(R) Xeon(R) Gold 6354 CPU @ 3.00GHz',
+	vendor => 'GenuineIntel',
+	model => 1,
+	msr => {
+	    'spec-ctrl' => 0,
+	    'arch-capabilities' => 511,
+	},
+	flags => "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 invpcid_single ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local wbnoinvd dtherm ida arat pln pts avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq la57 rdpid md_clear pconfig flush_l1d arch_capabilities"
+    },
+    {
+	expected_model => 'SapphireRapids',
+	name => 'Intel(R) Xeon(R) Gold 6430',
+	vendor => 'GenuineIntel',
+	model => 1,
+	msr => {
+	    'spec-ctrl' => 0,
+	    'arch-capabilities' => 511,
+	},
+	flags => "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor hle rtm ds_cpl smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cat_l2 cdp_l3 invpcid_single cdp_l2 ssbd mba ibrs ibpb stibp ibrs_enhanced fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local split_lock_detect avx_vnni avx512_bf16 wbnoinvd dtherm ida arat pln pts avx512vbmi umip pku ospke waitpkg avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq la57 rdpid bus_lock_detect cldemote movdiri movdir64b enqcmd fsrm md_clear serialize tsxldtrk pconfig arch_lbr amx_bf16 avx512_fp16 amx_tile amx_int8 flush_l1d arch_capabilities"
+    },
+    {
+	expected_model => 'EPYC-v3',
+	name => 'AMD EPYC 7251 8-Core Processor',
+	vendor => 'AuthenticAMD',
+	model => 1,
+	flags => "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid amd_dcm aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb hw_pstate sme ssbd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca"
+    },
+    {
+	expected_model => 'EPYC-Rome-v2',
+	name => 'AMD EPYC 7542 32-Core Processor',
+	vendor => 'AuthenticAMD',
+	model => 1,
+	flags => "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd amd_ppin arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl umip rdpid overflow_recov succor smca sme sev sev_es"
+    },
+    {
+	expected_model => 'EPYC-Rome-v2',
+	name => 'AMD Ryzen 7 PRO 6850U',
+	vendor => 'AuthenticAMD',
+	model => 1,
+	flags => "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd cppc arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl umip pku ospke vaes vpclmulqdq rdpid overflow_recov succor smca fsrm"
+    },
+    {
+	expected_model => 'EPYC-Milan',
+	name => 'AMD EPYC 7543 32-Core Processor',
+	vendor => 'AuthenticAMD',
+	model => 1,
+	flags => "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 invpcid_single hw_pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd amd_ppin arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold v_vmsave_vmload vgif v_spec_ctrl umip pku ospke vaes vpclmulqdq rdpid overflow_recov succor smca fsrm"
+    },
+];
+
+
+foreach my $cpuinfo (@$cpus) {
+    my $host_flags = PVE::QemuServer::CPUConfig::get_host_cpu_flags($cpuinfo);
+    my $model = PVE::QemuServer::CPUConfig::find_best_cpumodel($host_flags, $cpuinfo->{vendor});
+    my $expected_model = $cpuinfo->{expected_model};
+    is($model, $expected_model, $expected_model);
+}
+
+
+my $cpus_groups = [
+    {
+	expected_model => 'IvyBridge',
+	group => [
+	    {
+		qemu_model => 'IvyBridge',
+		name => 'Intel(R) Xeon(R) CPU E5-2603 v2 @ 1.80GHz',
+		vendor => 'GenuineIntel',
+		model => 1,
+		flags => "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm cpuid_fault pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms xsaveopt dtherm arat pln pts md_clear flush_l1d"
+	    },
+	    {
+		qemu_model => 'Haswell-noTSX-IBRS',
+		name => 'Intel(R) Xeon(R) CPU E5-2687W v3 @ 3.10GHz',
+		vendor => 'GenuineIntel',
+		model => 1,
+		msr => {
+		    'spec-ctrl' => 0,
+		},
+		flags => "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm xsaveopt cqm_llc cqm_occup_llc dtherm ida arat pln pts md_clear flush_l1d",
+	    },
+	]
+    },
+    {
+	expected_model => 'EPYC-v3',
+	group => [
+	    {
+		expected_model => 'EPYC-v3',
+		name => 'AMD EPYC 7251 8-Core Processor',
+		vendor => 'AuthenticAMD',
+		model => 1,
+		flags => "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid amd_dcm aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb hw_pstate sme ssbd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca"
+	    },
+	    {
+		qemu_model => 'EPYC-Rome-v2',
+		name => 'AMD Ryzen 7 PRO 6850U',
+		vendor => 'AuthenticAMD',
+		model => 1,
+		flags => "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd cppc arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl umip pku ospke vaes vpclmulqdq rdpid overflow_recov succor smca fsrm"
+	    },
+	]
+    },
+    {
+	expected_model => 'x86-64-v2',
+	group => [
+	    {
+		qemu_model => 'IvyBridge',
+		name => 'Intel(R) Xeon(R) CPU E5-2603 v2 @ 1.80GHz',
+		vendor => 'GenuineIntel',
+		model => 1,
+		flags => "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm cpuid_fault pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms xsaveopt dtherm arat pln pts md_clear flush_l1d"
+	    },
+	    {
+		qemu_model => 'EPYC-Rome-v2',
+		name => 'AMD Ryzen 7 PRO 6850U',
+		vendor => 'AuthenticAMD',
+		model => 1,
+		flags => "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd cppc arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl umip pku ospke vaes vpclmulqdq rdpid overflow_recov succor smca fsrm"
+	    },
+	]
+    },
+    {
+	expected_model => 'x86-64-v3',
+	group => [
+	    {
+		qemu_model => 'Icelake-Server-v3',
+		name => 'Intel(R) Xeon(R) Gold 6354 CPU @ 3.00GHz',
+		vendor => 'GenuineIntel',
+		model => 1,
+		msr => {
+		    'spec-ctrl' => 0,
+		    'arch-capabilities' => 511,
+		},
+		flags => "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 invpcid_single ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local wbnoinvd dtherm ida arat pln pts avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq la57 rdpid md_clear pconfig flush_l1d arch_capabilities"
+	    },
+	    {
+		qemu_model => 'EPYC-Rome-v2',
+		name => 'AMD Ryzen 7 PRO 6850U',
+		vendor => 'AuthenticAMD',
+		model => 1,
+		flags => "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd cppc arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl umip pku ospke vaes vpclmulqdq rdpid overflow_recov succor smca fsrm"
+	    },
+	]
+    }
+];
+
+foreach my $group (@$cpus_groups) {
+
+    my ($common_flags, $common_vendor) = PVE::QemuServer::CPUConfig::find_hosts_common_flags($group->{group});
+    my $model = PVE::QemuServer::CPUConfig::find_best_cpumodel($common_flags, $common_vendor);
+    my $expected_model = $group->{expected_model};
+    is($model, $expected_model, $expected_model);
+}
+
+done_testing();
-- 
2.30.2




^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [pve-devel] [PATCH v3 qemu-server 1/7] cpuconfig: add new x86-64-vX models
  2023-05-22 10:25 ` [pve-devel] [PATCH v3 qemu-server 1/7] cpuconfig: add new x86-64-vX models Alexandre Derumier
@ 2023-05-31 11:08   ` Fiona Ebner
  2023-05-31 15:08     ` DERUMIER, Alexandre
  0 siblings, 1 reply; 37+ messages in thread
From: Fiona Ebner @ 2023-05-31 11:08 UTC (permalink / raw)
  To: Proxmox VE development discussion, Alexandre Derumier

Am 22.05.23 um 12:25 schrieb Alexandre Derumier:
> https://lore.kernel.org/all/20210526144038.278899-1-berrange@redhat.com/T/

Can we reference v3 instead?
https://lists.gnu.org/archive/html/qemu-devel/2021-06/msg01592.html

> "
> In 2020, AMD, Intel, Red Hat, and SUSE worked together to define
> three microarchitecture levels on top of the historical x86-64
> baseline:
> 
>   * x86-64:    original x86_64 baseline instruction set
>   * x86-64-v2: vector instructions up to Streaming SIMD
>                Extensions 4.2 (SSE4.2)  and Supplemental
>                Streaming SIMD Extensions 3 (SSSE3), the
>                POPCNT instruction, and CMPXCHG16B
>   * x86-64-v3: vector instructions up to AVX2, MOVBE,
>                and additional bit-manipulation instructions.
>   * x86-64-v4: vector instructions from some of the
>                AVX-512 variants.
> "

The mail goes on, here I'm quoting v3:

> More precisely the models were defined as:
>
>  * x86-64-abi1: close match for Opteron_G1, minus
>                 vme
>  * x86-64-abi2: perfect match for Nehalem
>  * x86-64-abi3: close match of Haswell-noTSX, minus
>                 aes pcid erms invpcid tsc-deadline
>                 x2apic pclmulqdq
>  * x86-64-abi4: close match of Skylake-Server-noTSX-IBRS, minus
>                 spec-ctrl

But what you write below is different:

> This patch add new builtin model derivated from original models,
> to be compatible between intel/amd.
> 
> x86-64-v1 : Derived from Opteron_G1, minus vme
> x86-64-v2 : Derived from Nehalem, -vme,+aes

Why the additional flags? Above says it's exactly Nehalem. And below,
you don't do "-vme".

> min intel: Westmere (because of aes)
> min amd : Opteron_G3
> 
> x86-64-v3 : Derived from Haswell-noTSX, -pcid,-erms,-invpcid,-tsc-deadline,-x2apic,-pclmulqdq,+aes

It should be -aes according to the above.

> min intel: Haswell
> min amd : EPYC_v1
> 
> x86-64-v4 : Derived from Skylake-Server-noTSX-IBRS, -spec-ctrl
> 
> min intel: Skylake
> min amd : EPYC_v4
> 
> (v4 model not yet exposed, because not yet tested, other models have been tested)
> Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
> ---
>  PVE/QemuServer/CPUConfig.pm | 33 +++++++++++++++++++++++++++++++--
>  1 file changed, 31 insertions(+), 2 deletions(-)
> 
> diff --git a/PVE/QemuServer/CPUConfig.pm b/PVE/QemuServer/CPUConfig.pm
> index fb0861b..54bbd55 100644
> --- a/PVE/QemuServer/CPUConfig.pm
> +++ b/PVE/QemuServer/CPUConfig.pm
> @@ -31,6 +31,25 @@ sub load_custom_model_conf {
>      return cfs_read_file($default_filename);
>  }
>  
> +my $builtin_models = {
> +    'x86-64-v1' => {
> +	'reported-model' => 'Opteron_G1',

It's unfortunate that we'll report this model and hence also AMD as
vendor even on Intel hosts and vice versa for the other models. We could
set the vendor to the host's vendor (in get_cpu_options() handle getting
the vendor for the built-in models differently), but that's also
strange, because then it would be Opteron_G1 with vendor GenuineIntel :/
So maybe better to just leave it?

> +	flags => "-vme;-svm;-vmx",

Why remove the svm and vmx flags? They are not exposed by us, so a user
cannot even enable them back if needed, but needs to switch to a
different CPU type.

> +    },
> +    'x86-64-v2' => {
> +	'reported-model' => 'Nehalem',
> +	flags => "+aes;-svm;-vmx",
> +    },
> +    'x86-64-v3' => {
> +	'reported-model' => 'Haswell-noTSX',
> +	flags => "+aes;-pcid;-erms;-invpcid;-tsc-deadline;-x2apic;-pclmulqdq;-svm;-vmx",
> +    },
> +#    'x86-64-v4' => {
> +#	'reported-model' => 'Skylake-Server-noTSX-IBRS',
> +#	flags => "+aes;-spec-ctrl;-svm;-vmx",
> +#    },

Even if you didn't test it, should we just take it in? Also, neither the
original mail nor your commit message mention "+aes" for this one.

> +};
> +
>  my $depreacated_cpu_map = {
>      # there never was such a client CPU, so map it to the server one for backward compat
>      'Icelake-Client' => 'Icelake-Server',
> @@ -96,6 +115,9 @@ my $cpu_vendor_list = {
>      kvm64 => 'default',
>      qemu32 => 'default',
>      qemu64 => 'default',
> +    'x86-64-v1' => 'default',
> +    'x86-64-v2' => 'default',
> +    'x86-64-v3' => 'default',


Currently all of the others are actual models we can pass directly to
QEMU/KVM. I'd rather not add these custom built-in ones here. You'll
need to adapt validate_vm_cpu_conf() of course, to also accept the
built-in ones.

Because of adding them here, I can also set them as the 'reported-model'
for a custom CPU in /etc/pve/virtual-guest/cpu-models.conf and parsing
the file will work, but then starting a VM with that custom CPU will
fail with kvm: unable to find CPU model 'x86-64-v1'.

If we'd like to enable using the built-in ones as base for custom CPU
models, we'll need to handle them differently, but I'm not sure we
should until there is enough user demand.

>      max => 'default',
>  };
>  
> @@ -359,7 +381,10 @@ sub print_cpu_device {
>  	    or die "Cannot parse cpu description: $cputype\n";
>  	$cpu = $cpuconf->{cputype};
>  
> -	if (is_custom_model($cpu)) {
> +	if (my $model = $builtin_models->{$cpu}) {
> +	    $cpu = $model->{'reported-model'} // $cpu_fmt->{'reported-model'}->{default};
> +	}

using elsif seems cleaner

> +	if (is_custom_model($cputype)) {
>  	    my $custom_cpu = get_custom_model($cpu);
>  
>  	    $cpu = $custom_cpu->{'reported-model'} // $cpu_fmt->{'reported-model'}->{default};
> @@ -474,7 +499,11 @@ sub get_cpu_options {
>  	    or die "Cannot parse cpu description: $cpu_prop_str\n";
>  
>  	$cputype = $cpu->{cputype};
> -
> +	if (my $model = $builtin_models->{$cputype}) {
> +	    my $model = $builtin_models->{$cputype};
> +	    $cputype = $model->{'reported-model'} // $cpu_fmt->{'reported-model'}->{default};
> +	    $custom_cpu->{flags} = $model->{'flags'};

It's not a custom_cpu, but a built-in one. Please define a new variable
for this instead and pass it to resolve_cpu_flags() below.

> +	}

Again using elsif seems cleaner

>  	if (is_custom_model($cputype)) {
>  	    $custom_cpu = get_custom_model($cputype);
>  






^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel
  2023-05-22 10:25 [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel Alexandre Derumier
                   ` (8 preceding siblings ...)
  2023-05-22 10:25 ` [pve-devel] [PATCH v3 qemu-server 7/7] add best cpu model detection tests Alexandre Derumier
@ 2023-05-31 11:36 ` Fiona Ebner
  2023-05-31 14:34   ` DERUMIER, Alexandre
  2023-06-01  9:34 ` Fiona Ebner
  10 siblings, 1 reply; 37+ messages in thread
From: Fiona Ebner @ 2023-05-31 11:36 UTC (permalink / raw)
  To: Proxmox VE development discussion, Alexandre Derumier

Am 22.05.23 um 12:25 schrieb Alexandre Derumier:
> In addition to theses model, I have enabled aes too.
> I think it's really important, because a lot of users use default values and have
> bad performance with ssl and other crypto stuffs.
> 

So there is the answer to my aes question :) But shouldn't we rather set
it via the UI as a default than change the CPU definition itself? That
feels cleaner as we'd not diverge from how they defined the ABI.

> 
> This was discussed on the qemu mailing
> 
> "
> Crypto accelerator caveats
> ==========================
> 
> Similarly I'm not a huge fan of leaving out the "aes"
> instruction for accelerated crypto, as missing "aes" is
> also one of the key factors in making qemu64 a bad choice.
> 
> If we include 'aes' in x86-64-v2, then we loose support
> for Nehalem hosts.
> 
> If we include 'aes' in x86-64-v3 then we further loose
> support for Dhyana hosts (an EPYC derived CPU).
> "
> 
> Nahelemn is a 2008 cpu, so I think it's ok, we are in 2013 ;)
> (and user can disable aes flag in gui too)
> 
> That mean than the minimum compatible cpu for v2 is Intel Westmere (2010)
> and Amd Bulldozer (2011).


> Additionnaly, it could be great to use a real cpu model when we don't have
> mixed intel/amd cluster, to have spectre/meltdown/.... mitigations enabled.
> 
> I have added initial code for best model detection based on host cpuflags
> vs qemu models flags.
> 
> Not yet plugged, I'm not sure what is the best way, only at vm create,
> or at vm start to auto upgrade vm cpu to last version ?
> I'm not sure with cluster, if user add a new older node.
> (vmware have a feature called EVC, compute the best model when node join/leave)
> 

If we do this, then only at VM create. Changing the CPU at VM start is
just too much magic and can break things, because we don't know what the
guest is fine with. Much of the problem would already be solved by
having something like https://bugzilla.proxmox.com/show_bug.cgi?id=3500
where the admin can select a sane default for their cluster and we can
help them choose a default with some guidance in the documentation.

A way to calculate the best model in the cluster can be fine, but seems
to be quite an effort. If we deem it worth it, we can still have a
separate "calculate best model" tool/command. Changing such things
automatically just leads to unexpected surprises.




^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel
  2023-05-31 11:36 ` [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel Fiona Ebner
@ 2023-05-31 14:34   ` DERUMIER, Alexandre
  2023-06-01  8:34     ` Fiona Ebner
  0 siblings, 1 reply; 37+ messages in thread
From: DERUMIER, Alexandre @ 2023-05-31 14:34 UTC (permalink / raw)
  To: pve-devel, aderumier, f.ebner

Le mercredi 31 mai 2023 à 13:36 +0200, Fiona Ebner a écrit :
> Am 22.05.23 um 12:25 schrieb Alexandre Derumier:
> > In addition to theses model, I have enabled aes too.
> > I think it's really important, because a lot of users use default
> > values and have
> > bad performance with ssl and other crypto stuffs.
> > 
> 
> So there is the answer to my aes question :) But shouldn't we rather
> set
> it via the UI as a default than change the CPU definition itself?
> That
> feels cleaner as we'd not diverge from how they defined the ABI.

I don't have looked pve-manager code yet, but do you think it's easy
to auto enable/disable the aes flag in the grid when we choose theses
models ?

Maybe could it be better to have 2 differents models, with/without aes
(like some qemu models versions like -IBRS,  
here we could have

x86-64-v2
x86-64-v2-aes   (default)
x86-64-v3
x86-64-v3-aes






> If we do this, then only at VM create. Changing the CPU at VM start
> is
> just too much magic and can break things, because we don't know what
> the
> guest is fine with.
yes, agreed.

>  Much of the problem would already be solved by
> having something like 
> where the admin can select a sane default for their cluster and we
> can
> help them choose a default with some guidance in the documentation.
> 
> A way to calculate the best model in the cluster can be fine, but
> seems
> to be quite an effort. If we deem it worth it, we can still have a
> separate "calculate best model" tool/command. Changing such things
> automatically just leads to unexpected surprises.
> 
I think that at minimum a tool/command to generate a default value or
give a hint to the admin could be great, because new Intel cpu names
since skylake are really really a mess. (
 (+ the revisions/microcode where you can have up to 6 differents
version, it's almost impossible to do it without testing all versions,
and all flags are not available in /proc/cpu  (you need to read
specific msr like in my patch).







^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [pve-devel] [PATCH v3 qemu-server 1/7] cpuconfig: add new x86-64-vX models
  2023-05-31 11:08   ` Fiona Ebner
@ 2023-05-31 15:08     ` DERUMIER, Alexandre
  2023-06-01  9:17       ` Fiona Ebner
  0 siblings, 1 reply; 37+ messages in thread
From: DERUMIER, Alexandre @ 2023-05-31 15:08 UTC (permalink / raw)
  To: pve-devel, aderumier, f.ebner


> 
> But what you write below is different:
> 
> > This patch add new builtin model derivated from original models,
> > to be compatible between intel/amd.
> > 
> > x86-64-v1 : Derived from Opteron_G1, minus vme
> > x86-64-v2 : Derived from Nehalem, -vme,+aes
> 
> Why the additional flags? Above says it's exactly Nehalem. And below,
> you don't do "-vme".
> 
Sorry, indeed the -vme is not done for Nehalem in the patch (wrong
description in the mail message).
For aes see my reply in the other patch.


> 
> > 
> > (v4 model not yet exposed, because not yet tested, other models
> > have been tested)
> > Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
> > ---
> >  PVE/QemuServer/CPUConfig.pm | 33 +++++++++++++++++++++++++++++++--
> >  1 file changed, 31 insertions(+), 2 deletions(-)
> > 
> > diff --git a/PVE/QemuServer/CPUConfig.pm
> > b/PVE/QemuServer/CPUConfig.pm
> > index fb0861b..54bbd55 100644
> > --- a/PVE/QemuServer/CPUConfig.pm
> > +++ b/PVE/QemuServer/CPUConfig.pm
> > @@ -31,6 +31,25 @@ sub load_custom_model_conf {
> >      return cfs_read_file($default_filename);
> >  }
> >  
> > +my $builtin_models = {
> > +    'x86-64-v1' => {
> > +       'reported-model' => 'Opteron_G1',
> 
> It's unfortunate that we'll report this model and hence also AMD as
> vendor even on Intel hosts and vice versa for the other models. We
> could
> set the vendor to the host's vendor (in get_cpu_options() handle
> getting
> the vendor for the built-in models differently), 
I think it'll break if you migrate between intel/amd host anyway ?

> but that's also
> strange, because then it would be Opteron_G1 with vendor GenuineIntel
> :/
> So maybe better to just leave it?
Well, kvm64 guest have vendor Authentic amd (even on intel host;), with
modelname "common kvm processor")
cat /proc/cpuinfo
vendor_id	: AuthenticAmd
model name	: "Common KVM processor"


If we don't want to expose the original modelname from where we
derivate, afaik, the only way is to patch qemu directly (like in my
v1).



> 
> > +       flags => "-vme;-svm;-vmx",
> 
> Why remove the svm and vmx flags? They are not exposed by us, so a
> user
> cannot even enable them back if needed, but needs to switch to a
> different CPU type.
yes, that's was the idea to forbid user to enable them, as it's
breaking livemigration, so it don't make any sense to use this model
instead host model.

But I can remove them, no problem.

> 
> > +    },
> > +    'x86-64-v2' => {
> > +       'reported-model' => 'Nehalem',
> > +       flags => "+aes;-svm;-vmx",
> > +    },
> > +    'x86-64-v3' => {
> > +       'reported-model' => 'Haswell-noTSX',
> > +       flags => "+aes;-pcid;-erms;-invpcid;-tsc-deadline;-x2apic;-
> > pclmulqdq;-svm;-vmx",
> > +    },
> > +#    'x86-64-v4' => {
> > +#      'reported-model' => 'Skylake-Server-noTSX-IBRS',
> > +#      flags => "+aes;-spec-ctrl;-svm;-vmx",
> > +#    },
> 
> Even if you didn't test it, should we just take it in? Also, neither
> the
> original mail nor your commit message mention "+aes" for this one.
> 
> > +};
> > +
> >  my $depreacated_cpu_map = {
> >      # there never was such a client CPU, so map it to the server
> > one for backward compat
> >      'Icelake-Client' => 'Icelake-Server',
> > @@ -96,6 +115,9 @@ my $cpu_vendor_list = {
> >      kvm64 => 'default',
> >      qemu32 => 'default',
> >      qemu64 => 'default',
> > +    'x86-64-v1' => 'default',
> > +    'x86-64-v2' => 'default',
> > +    'x86-64-v3' => 'default',
> 
> 
> Currently all of the others are actual models we can pass directly to
> QEMU/KVM. I'd rather not add these custom built-in ones here. You'll
> need to adapt validate_vm_cpu_conf() of course, to also accept the
> built-in ones.
> 
> Because of adding them here, I can also set them as the 'reported-
> model'
> for a custom CPU in /etc/pve/virtual-guest/cpu-models.conf and
> parsing
> the file will work, but then starting a VM with that custom CPU will
> fail with kvm: unable to find CPU model 'x86-64-v1'.
> 
> If we'd like to enable using the built-in ones as base for custom CPU
> models, we'll need to handle them differently, but I'm not sure we
> should until there is enough user demand.
> 
Maybe it could be simplier to really add true build-model in qemu ?
(The qemu patch is pretty small, and shouldn't be difficult to
maintain)

I'm not sure, but maybe user will think that it's strange than x86-64-
v2 will display nahelem in guest && in qemu command line ?



> >      max => 'default',
> >  };
> >  
> > @@ -359,7 +381,10 @@ sub print_cpu_device {
> >             or die "Cannot parse cpu description: $cputype\n";
> >         $cpu = $cpuconf->{cputype};
> >  
> > -       if (is_custom_model($cpu)) {
> > +       if (my $model = $builtin_models->{$cpu}) {
> > +           $cpu = $model->{'reported-model'} // $cpu_fmt-
> > >{'reported-model'}->{default};
> > +       }
> 
> using elsif seems cleaner
> 
> > +       if (is_custom_model($cputype)) {
> >             my $custom_cpu = get_custom_model($cpu);
> >  
> >             $cpu = $custom_cpu->{'reported-model'} // $cpu_fmt-
> > >{'reported-model'}->{default};
> > @@ -474,7 +499,11 @@ sub get_cpu_options {
> >             or die "Cannot parse cpu description: $cpu_prop_str\n";
> >  
> >         $cputype = $cpu->{cputype};
> > -
> > +       if (my $model = $builtin_models->{$cputype}) {
> > +           my $model = $builtin_models->{$cputype};
> > +           $cputype = $model->{'reported-model'} // $cpu_fmt-
> > >{'reported-model'}->{default};
> > +           $custom_cpu->{flags} = $model->{'flags'};
> 
> It's not a custom_cpu, but a built-in one. Please define a new
> variable
> for this instead and pass it to resolve_cpu_flags() below.
> 
> > +       }
> 
> Again using elsif seems cleaner
> 
> >         if (is_custom_model($cputype)) {
> >             $custom_cpu = get_custom_model($cputype);
> >  
> 
> 
> 


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel
  2023-05-31 14:34   ` DERUMIER, Alexandre
@ 2023-06-01  8:34     ` Fiona Ebner
  2023-06-01  9:06       ` DERUMIER, Alexandre
  2023-06-03 14:05       ` Thomas Lamprecht
  0 siblings, 2 replies; 37+ messages in thread
From: Fiona Ebner @ 2023-06-01  8:34 UTC (permalink / raw)
  To: DERUMIER, Alexandre, pve-devel, aderumier

Am 31.05.23 um 16:34 schrieb DERUMIER, Alexandre:
> Le mercredi 31 mai 2023 à 13:36 +0200, Fiona Ebner a écrit :
>> Am 22.05.23 um 12:25 schrieb Alexandre Derumier:
>>> In addition to theses model, I have enabled aes too.
>>> I think it's really important, because a lot of users use default
>>> values and have
>>> bad performance with ssl and other crypto stuffs.
>>>
>>
>> So there is the answer to my aes question :) But shouldn't we rather
>> set
>> it via the UI as a default than change the CPU definition itself?
>> That
>> feels cleaner as we'd not diverge from how they defined the ABI.
> 
> I don't have looked pve-manager code yet, but do you think it's easy
> to auto enable/disable the aes flag in the grid when we choose theses
> models ?

I also haven't looked at the code, but yeah, it is an issue that it's in
the advanced part and we shouldn't hide it from the user that it's on.

> Maybe could it be better to have 2 differents models, with/without aes
> (like some qemu models versions like -IBRS,  
> here we could have
> 
> x86-64-v2
> x86-64-v2-aes   (default)
> x86-64-v3
> x86-64-v3-aes

That might work, but if we do that, please only in the UI. Also not
ideal, because how would interaction with the flag in the grid work?
E.g. don't show it, force it on if an -aes model is selected?

Maybe the easiest would be to extract the aes flag out of the grid into
the non-advanced part?




^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel
  2023-06-01  8:34     ` Fiona Ebner
@ 2023-06-01  9:06       ` DERUMIER, Alexandre
  2023-06-03 14:14         ` Thomas Lamprecht
  2023-06-03 14:05       ` Thomas Lamprecht
  1 sibling, 1 reply; 37+ messages in thread
From: DERUMIER, Alexandre @ 2023-06-01  9:06 UTC (permalink / raw)
  To: pve-devel, aderumier, f.ebner

Le jeudi 01 juin 2023 à 10:34 +0200, Fiona Ebner a écrit :
> Am 31.05.23 um 16:34 schrieb DERUMIER, Alexandre:
> > Le mercredi 31 mai 2023 à 13:36 +0200, Fiona Ebner a écrit :
> > > Am 22.05.23 um 12:25 schrieb Alexandre Derumier:
> > > > In addition to theses model, I have enabled aes too.
> > > > I think it's really important, because a lot of users use
> > > > default
> > > > values and have
> > > > bad performance with ssl and other crypto stuffs.
> > > > 
> > > 
> > > So there is the answer to my aes question :) But shouldn't we
> > > rather
> > > set
> > > it via the UI as a default than change the CPU definition itself?
> > > That
> > > feels cleaner as we'd not diverge from how they defined the ABI.
> > 
> > I don't have looked pve-manager code yet, but do you think it's
> > easy
> > to auto enable/disable the aes flag in the grid when we choose
> > theses
> > models ?
> 
> I also haven't looked at the code, but yeah, it is an issue that it's
> in
> the advanced part and we shouldn't hide it from the user that it's
> on.
> 
> > Maybe could it be better to have 2 differents models, with/without
> > aes
> > (like some qemu models versions like -IBRS,  
> > here we could have
> > 
> > x86-64-v2
> > x86-64-v2-aes   (default)
> > x86-64-v3
> > x86-64-v3-aes
> 
> That might work, but if we do that, please only in the UI. Also not
> ideal, because how would interaction with the flag in the grid work?
> E.g. don't show it, force it on if an -aes model is selected?
> 
mmm, yes, maybe it'll be confusing. (But note that for example we don't
hide -ibrs model, if user disable spectre flag for example)

> Maybe the easiest would be to extract the aes flag out of the grid
> into
> the non-advanced part?
> 
Couldn't be easier to keep aes enable by default in a single model
(even if it's doesn't match the x86-64 spec). and allow user to optin
disable it.
The only server where you need to disable aes if for nahelem, and I
don't think that a lot of users still have this cpu in production.
(so keeping the aes flag in advanced section make sense).
Also, user with really old servers, could keep to use kvm64 model,
where aes is not enabled.




^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [pve-devel] [PATCH v3 qemu-server 1/7] cpuconfig: add new x86-64-vX models
  2023-05-31 15:08     ` DERUMIER, Alexandre
@ 2023-06-01  9:17       ` Fiona Ebner
  2023-06-01 11:27         ` DERUMIER, Alexandre
  0 siblings, 1 reply; 37+ messages in thread
From: Fiona Ebner @ 2023-06-01  9:17 UTC (permalink / raw)
  To: DERUMIER, Alexandre, pve-devel, aderumier

Am 31.05.23 um 17:08 schrieb DERUMIER, Alexandre:
>>>  
>>> +my $builtin_models = {
>>> +    'x86-64-v1' => {
>>> +       'reported-model' => 'Opteron_G1',
>>
>> It's unfortunate that we'll report this model and hence also AMD as
>> vendor even on Intel hosts and vice versa for the other models. We
>> could
>> set the vendor to the host's vendor (in get_cpu_options() handle
>> getting
>> the vendor for the built-in models differently), 
> I think it'll break if you migrate between intel/amd host anyway ?

That's true :)

>> but that's also
>> strange, because then it would be Opteron_G1 with vendor GenuineIntel
>> :/
>> So maybe better to just leave it?
> Well, kvm64 guest have vendor Authentic amd (even on intel host;), with
> modelname "common kvm processor")
> cat /proc/cpuinfo
> vendor_id	: AuthenticAmd
> model name	: "Common KVM processor"

Are you sure? Or was this a migrated machine?

We have this comment

>     # generic types, use vendor from host node
>     host => 'default',
>     kvm32 => 'default',
>     kvm64 => 'default',

and for a colleague, it is GenuineIntel with kvm64 on an Intel host.

> If we don't want to expose the original modelname from where we
> derivate, afaik, the only way is to patch qemu directly (like in my
> v1).

We can actually just use the model-id option for -cpu and I think we
should for these built-in models. I.e. set the vendor to the one from
the host and the model-id to something generic too. Maybe "Common
x86_64-abi1-compatible processor", but that feels involved, or maybe
just "Common KVM processor" again?

>>
>>> +       flags => "-vme;-svm;-vmx",
>>
>> Why remove the svm and vmx flags? They are not exposed by us, so a
>> user
>> cannot even enable them back if needed, but needs to switch to a
>> different CPU type.
> yes, that's was the idea to forbid user to enable them, as it's
> breaking livemigration, so it don't make any sense to use this model
> instead host model.
> 
> But I can remove them, no problem.

Oh, I missed the following in the referenced mail:

> None of the CPU models declare any VMX/SVM capability features.
> IOW, even if a "vmx"/"svm" flag is added, it will still be unsafe
> to attempt to live migrate the L1 guest if there are any L2
> guests running with hardware virtualization.

Please keep them off then.

>>> @@ -96,6 +115,9 @@ my $cpu_vendor_list = {
>>>      kvm64 => 'default',
>>>      qemu32 => 'default',
>>>      qemu64 => 'default',
>>> +    'x86-64-v1' => 'default',
>>> +    'x86-64-v2' => 'default',
>>> +    'x86-64-v3' => 'default',
>>
>>
>> Currently all of the others are actual models we can pass directly to
>> QEMU/KVM. I'd rather not add these custom built-in ones here. You'll
>> need to adapt validate_vm_cpu_conf() of course, to also accept the
>> built-in ones.
>>
>> Because of adding them here, I can also set them as the 'reported-
>> model'
>> for a custom CPU in /etc/pve/virtual-guest/cpu-models.conf and
>> parsing
>> the file will work, but then starting a VM with that custom CPU will
>> fail with kvm: unable to find CPU model 'x86-64-v1'.
>>
>> If we'd like to enable using the built-in ones as base for custom CPU
>> models, we'll need to handle them differently, but I'm not sure we
>> should until there is enough user demand.
>>
> Maybe it could be simplier to really add true build-model in qemu ?
> (The qemu patch is pretty small, and shouldn't be difficult to
> maintain)
> 
> I'm not sure, but maybe user will think that it's strange than x86-64-
> v2 will display nahelem in guest && in qemu command line ?
> 

Yes, for this it would be easier, but I also don't think we need to
allow these as a base for custom models (at least not until there is
enough user demand). And we can still switch later to make them true
QEMU models if we really need to.




^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel
  2023-05-22 10:25 [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel Alexandre Derumier
                   ` (9 preceding siblings ...)
  2023-05-31 11:36 ` [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel Fiona Ebner
@ 2023-06-01  9:34 ` Fiona Ebner
  2023-06-01 11:37   ` DERUMIER, Alexandre
  10 siblings, 1 reply; 37+ messages in thread
From: Fiona Ebner @ 2023-06-01  9:34 UTC (permalink / raw)
  To: Proxmox VE development discussion, Alexandre Derumier

Am 22.05.23 um 12:25 schrieb Alexandre Derumier:> Nahelemn is a 2008
cpu, so I think it's ok, we are in 2013 ;)
> (and user can disable aes flag in gui too)
> 
> That mean than the minimum compatible cpu for v2 is Intel Westmere (2010)
> and Amd Bulldozer (2011).
> 
Unfortunately, it doesn't seem to be rock stable on AMD hosts :( When
using Nehalem on my AMD Ryzen Threadripper 2920X, I get hangs during
installation of Debian 11 and for an already existing one, crashes
during boot. This is with or without AES flag. Colleagues with AMD CPUs
also ran into similar issues when using CPU type Nehalem.

Note that these were not server CPUs, Aaron said, he'll test those later
(please reply to here with the results :)).

It would be bad if too many AMD CPUs aren't happy with the new default
:/ In the worst case, we'd only be able to switch to the new default for
Intel hosts.

What AMD CPUs did you try it on?




^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [pve-devel] [PATCH v3 qemu-server 1/7] cpuconfig: add new x86-64-vX models
  2023-06-01  9:17       ` Fiona Ebner
@ 2023-06-01 11:27         ` DERUMIER, Alexandre
  0 siblings, 0 replies; 37+ messages in thread
From: DERUMIER, Alexandre @ 2023-06-01 11:27 UTC (permalink / raw)
  To: pve-devel, aderumier, f.ebner

Le jeudi 01 juin 2023 à 11:17 +0200, Fiona Ebner a écrit :
> Am 31.05.23 um 17:08 schrieb DERUMIER, Alexandre:
> > > >  
> > > > +my $builtin_models = {
> > > > +    'x86-64-v1' => {
> > > > +       'reported-model' => 'Opteron_G1',
> > > 
> > > It's unfortunate that we'll report this model and hence also AMD
> > > as
> > > vendor even on Intel hosts and vice versa for the other models.
> > > We
> > > could
> > > set the vendor to the host's vendor (in get_cpu_options() handle
> > > getting
> > > the vendor for the built-in models differently), 
> > I think it'll break if you migrate between intel/amd host anyway ?
> 
> That's true :)
> 
> > > but that's also
> > > strange, because then it would be Opteron_G1 with vendor
> > > GenuineIntel
> > > :/
> > > So maybe better to just leave it?
> > Well, kvm64 guest have vendor Authentic amd (even on intel host;),
> > with
> > modelname "common kvm processor")
> > cat /proc/cpuinfo
> > vendor_id       : AuthenticAmd
> > model name      : "Common KVM processor"
> 
> Are you sure? Or was this a migrated machine?
> 
> We have this comment
> 
> >     # generic types, use vendor from host node
> >     host => 'default',
> >     kvm32 => 'default',
> >     kvm64 => 'default',
> 
> and for a colleague, it is GenuineIntel with kvm64 on an Intel host.
> 
oh, you are right, it's indeed inherit the vendorid from the host
(tested with kvm64 && qemu64).
Maybe they are some specific trick for theses model in qemu
(because in cpu definition, the vendor is really intel for kvm64 && amd
for qemu64. Maybe they are some other part in code to inherit from the
host vendor)
https://github.com/qemu/qemu/blob/master/target/i386/cpu.c

> > If we don't want to expose the original modelname from where we
> > derivate, afaik, the only way is to patch qemu directly (like in my
> > v1).
> 
> We can actually just use the model-id option for -cpu and I think we
> should for these built-in models. I.e. set the vendor to the one from
> the host and the model-id to something generic too. Maybe "Common
> x86_64-abi1-compatible processor", but that feels involved, or maybe
> just "Common KVM processor" again?
ah ok, i wasn't aware of model-id. don't have preference, can be
"Common KVM processor" or "specific version". 
just tested it, vendor can also be specified
",model-id="Common KVM processor",vendor=GenuineIntel"

(I think it shouldn't break live migration if it's working with kvm64,
I think that vendor is not changing until the guest is restart.)


> 
> > > 
> > > > +       flags => "-vme;-svm;-vmx",
> > > 
> > > Why remove the svm and vmx flags? They are not exposed by us, so
> > > a
> > > user
> > > cannot even enable them back if needed, but needs to switch to a
> > > different CPU type.
> > yes, that's was the idea to forbid user to enable them, as it's
> > breaking livemigration, so it don't make any sense to use this
> > model
> > instead host model.
> > 
> > But I can remove them, no problem.
> 
> Oh, I missed the following in the referenced mail:
> 
> > None of the CPU models declare any VMX/SVM capability features.
> > IOW, even if a "vmx"/"svm" flag is added, it will still be unsafe
> > to attempt to live migrate the L1 guest if there are any L2
> > guests running with hardware virtualization.
> 
> Please keep them off then.
> 
ok, no problem

> > > > @@ -96,6 +115,9 @@ my $cpu_vendor_list = {
> > > >      kvm64 => 'default',
> > > >      qemu32 => 'default',
> > > >      qemu64 => 'default',
> > > > +    'x86-64-v1' => 'default',
> > > > +    'x86-64-v2' => 'default',
> > > > +    'x86-64-v3' => 'default',
> > > 
> > > 
> > > Currently all of the others are actual models we can pass
> > > directly to
> > > QEMU/KVM. I'd rather not add these custom built-in ones here.
> > > You'll
> > > need to adapt validate_vm_cpu_conf() of course, to also accept
> > > the
> > > built-in ones.
> > > 
> > > Because of adding them here, I can also set them as the
> > > 'reported-
> > > model'
> > > for a custom CPU in /etc/pve/virtual-guest/cpu-models.conf and
> > > parsing
> > > the file will work, but then starting a VM with that custom CPU
> > > will
> > > fail with kvm: unable to find CPU model 'x86-64-v1'.
> > > 
> > > If we'd like to enable using the built-in ones as base for custom
> > > CPU
> > > models, we'll need to handle them differently, but I'm not sure
> > > we
> > > should until there is enough user demand.
> > > 
> > Maybe it could be simplier to really add true build-model in qemu ?
> > (The qemu patch is pretty small, and shouldn't be difficult to
> > maintain)
> > 
> > I'm not sure, but maybe user will think that it's strange than x86-
> > 64-
> > v2 will display nahelem in guest && in qemu command line ?
> > 
> 
> Yes, for this it would be easier, but I also don't think we need to
> allow these as a base for custom models (at least not until there is
> enough user demand). And we can still switch later to make them true
> QEMU models if we really need to.
> 
ok,no problem, I'll rework my patch with model/vendor and all your
comments.

Thanks for your review !


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel
  2023-06-01  9:34 ` Fiona Ebner
@ 2023-06-01 11:37   ` DERUMIER, Alexandre
  2023-06-01 13:53     ` DERUMIER, Alexandre
       [not found]     ` <8277a27b-a70f-b731-69f7-fc9ae69b2da2@binovo.es>
  0 siblings, 2 replies; 37+ messages in thread
From: DERUMIER, Alexandre @ 2023-06-01 11:37 UTC (permalink / raw)
  To: pve-devel, aderumier, f.ebner

Le jeudi 01 juin 2023 à 11:34 +0200, Fiona Ebner a écrit :
> Am 22.05.23 um 12:25 schrieb Alexandre Derumier:> Nahelemn is a 2008
> cpu, so I think it's ok, we are in 2013 ;)
> > (and user can disable aes flag in gui too)
> > 
> > That mean than the minimum compatible cpu for v2 is Intel Westmere
> > (2010)
> > and Amd Bulldozer (2011).
> > 
> Unfortunately, it doesn't seem to be rock stable on AMD hosts :( When
> using Nehalem on my AMD Ryzen Threadripper 2920X, I get hangs during
> installation of Debian 11 and for an already existing one, crashes
> during boot. This is with or without AES flag. Colleagues with AMD
> CPUs
> also ran into similar issues when using CPU type Nehalem.
> 
damned :( .  Do you known which true qemu amd cpumodel is working
without any problem ?

I only have epyc v2/v3 to test on my side, and my don't have my older
opteron g4/g5 anymore.


> Note that these were not server CPUs, Aaron said, he'll test those
> later
> (please reply to here with the results :)).
> 
> It would be bad if too many AMD CPUs aren't happy with the new
> default
> :/ In the worst case, we'd only be able to switch to the new default
> for
> Intel hosts.
> 
> What AMD CPUs did you try it on?
> 
epyc v2/v3 with last microcodes


does it work with x86-64-v3 ?  (because the other patch of the series
could autofind the best new model if it's working)

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel
  2023-06-01 11:37   ` DERUMIER, Alexandre
@ 2023-06-01 13:53     ` DERUMIER, Alexandre
  2023-06-01 15:56       ` Fiona Ebner
       [not found]     ` <8277a27b-a70f-b731-69f7-fc9ae69b2da2@binovo.es>
  1 sibling, 1 reply; 37+ messages in thread
From: DERUMIER, Alexandre @ 2023-06-01 13:53 UTC (permalink / raw)
  To: pve-devel, aderumier, f.ebner

> > 
> > What AMD CPUs did you try it on?
> > 
> epyc v2/v3 with last microcodes
> 
> 
> does it work with x86-64-v3 ?  (because the other patch of the series
> could autofind the best new model if it's working)

Looking at linux kernel code, they have some quirks based on cpu model
number && vendor

nehalem is .family = 6, .model = 26,

kvm64 is .family = 15, .model = 6

qemu64 is.family = 15, .model = 107,



maybe it could be interesting to test with adding flags from
qemu64/kvm4  to see if it's the same behaviour ?


from kvm64, xf86-64-v2 is

'+lahf_lm,+popcnt, +sse4.1,sse4.2, +ssse3'     (and optionnal +aes)


(and we already enable lahf_lm by default in QemuServer/CPUConfig.pm )




^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel
  2023-06-01 13:53     ` DERUMIER, Alexandre
@ 2023-06-01 15:56       ` Fiona Ebner
  2023-06-01 21:15         ` DERUMIER, Alexandre
  0 siblings, 1 reply; 37+ messages in thread
From: Fiona Ebner @ 2023-06-01 15:56 UTC (permalink / raw)
  To: DERUMIER, Alexandre, pve-devel, aderumier

Am 01.06.23 um 15:53 schrieb DERUMIER, Alexandre:
>>>
>>> What AMD CPUs did you try it on?
>>>
>> epyc v2/v3 with last microcodes
>>
>>
>> does it work with x86-64-v3 ?  (because the other patch of the series
>> could autofind the best new model if it's working)
> 
> Looking at linux kernel code, they have some quirks based on cpu model
> number && vendor
> 
> nehalem is .family = 6, .model = 26,
> 
> kvm64 is .family = 15, .model = 6
> 
> qemu64 is.family = 15, .model = 107,
> 

Yeah, could be.

I did try today with

qm set 102 -args '-cpu Nehalem,+aes,-svm,-vmx,model-id="foo
bar",vendor="AuthenticAMD"'

and couldn't trigger the issue getting stuck during installation
anymore. Switching back to manually selected Nehalem in the UI with the
generated

-cpu Nehalem,+aes,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,vendor=GenuineIntel

I got the hang during my first installation attempt again.

Then I tried around a bit more and now I'm suspecting it is something in
combination with the +kvm_pv_unhalt flag. I got a hang with just

qm set 102 -args '-cpu Nehalem,+kvm_pv_unhalt,vendor=GenuineIntel

And I didn't ever get a hang without that flag yet. Aaron had also only
had hangs with that flag. But it's not like it hangs every time with the
flag either.

> 
> maybe it could be interesting to test with adding flags from
> qemu64/kvm4  to see if it's the same behaviour ?
> 
> 
> from kvm64, xf86-64-v2 is
> 
> '+lahf_lm,+popcnt, +sse4.1,sse4.2, +ssse3'     (and optionnal +aes)

Yes, let's do that! It does sound cleaner than to base it off Nehalem.

FWIW,
qm set 102 -args '-cpu
kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+sep,+lahf_lm,+popcnt,+sse4.1,+sse4.2,+ssse3'
worked just now, but will need to test more tomorrow.


> does it work with x86-64-v3 ?  (because the other patch of the series
> could autofind the best new model if it's working)

I didn't test, but I'd be careful with bumping it even more. I'd like to
focus on getting the new default in for the next major release. The best
model selection needs more consideration and can always be added after
the release.




^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel
       [not found]     ` <8277a27b-a70f-b731-69f7-fc9ae69b2da2@binovo.es>
@ 2023-06-01 16:00       ` Fiona Ebner
  2023-06-02 12:41         ` Aaron Lauterer
       [not found]         ` <fa3565e5-3a9c-9348-f291-554a0e0d6628@binovo.es>
  0 siblings, 2 replies; 37+ messages in thread
From: Fiona Ebner @ 2023-06-01 16:00 UTC (permalink / raw)
  To: Eneko Lacunza, Proxmox VE development discussion, DERUMIER,
	Alexandre, aderumier

Am 01.06.23 um 14:02 schrieb Eneko Lacunza:
> Hi,
> 
> We have Ryzen 1700, 2600X, 3700 and 5950X machines here, I can test on
> them if that helps (please detail tests to perform).
> 
> Thanks
> 

Hi,
thank you for the offer. It would be interesting to see if you have any
issues with the following:

> qm set <ID> -args '-cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+sep,+lahf_lm,+popcnt,+sse4.1,+sse4.2,+ssse3'

If you like you can also test

> qm set <ID> -args '-cpu Nehalem,enforce,+aes,-svm,-vmx,+kvm_pv_eoi,+kvm_pv_unhalt,vendor="GenuineIntel"'

After testing use

> qm set <ID> --delete args

to get rid of the modification again.

Make sure to stop/start the VM fresh after each modification.

As for what to test, installing Debian 11 would be nice just for
comparison, but other than that, just do what you like, shouldn't really
matter too much :)

Best Regards,
Fiona




^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel
  2023-06-01 15:56       ` Fiona Ebner
@ 2023-06-01 21:15         ` DERUMIER, Alexandre
  2023-06-02  7:28           ` Fiona Ebner
  0 siblings, 1 reply; 37+ messages in thread
From: DERUMIER, Alexandre @ 2023-06-01 21:15 UTC (permalink / raw)
  To: pve-devel, aderumier, f.ebner

Hi,
I found an interesting thread on the forum about kvm_pv_unhalt

https://forum.proxmox.com/threads/live-migration-between-intel-xeon-and-amd-epyc2-linux-guests.68663/


Sounds good. Please also take a look at the default flag
"kvm_pv_unhalt". As I mentioned, it would cause a kernel crash in
paravirtualized unhalt code sooner or later in a migrated VM (started
on Intel, migrated to AMD).

Please note that according to our tests simply leaving the CPU type
empty in the GUI (leading to the qemu command line argument of -cpu
kvm64,+sep,+lahf_lm,+kvm_pv_unhalt,+kvm_pv_eoi,enforce), while
seemingly working at first, will after some load and idle time in the
VM result in a crash involving kvm_kick_cpu function somewhere inside
of the paravirtualized halt/unhalt code. Linux kernels tested ranged
from Debian's 4.9.210-1 to Ubuntu's 5.3.0-46 (and some in between).
Therefore the Proxmox default seems to be unsafe and apparently the
very minimum working command line probably would be args: -cpu
kvm64,+sep,+lahf_lm,+kvm_pv_eoi.




So,it sound like it's crash if it's defined with a cpu vendor not
matching the real hardware ?

as it's break migration between intel && amd, maybe we shouldn't add
it to the new x86-64-vx model ?



a discussion on qemu-devel mailing is talking about performance
with/witout it
https://lists.nongnu.org/archive/html/qemu-devel/2017-10/msg01816.html

and it's seem to help when you have a lot of cores/numa nodes in guest,
but can slowdown small vms. 


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel
  2023-06-01 21:15         ` DERUMIER, Alexandre
@ 2023-06-02  7:28           ` Fiona Ebner
  2023-06-02  9:13             ` DERUMIER, Alexandre
  0 siblings, 1 reply; 37+ messages in thread
From: Fiona Ebner @ 2023-06-02  7:28 UTC (permalink / raw)
  To: DERUMIER, Alexandre, pve-devel, aderumier

Am 01.06.23 um 23:15 schrieb DERUMIER, Alexandre:
> Hi,
> I found an interesting thread on the forum about kvm_pv_unhalt
> 
> https://forum.proxmox.com/threads/live-migration-between-intel-xeon-and-amd-epyc2-linux-guests.68663/
> 
> 
> Sounds good. Please also take a look at the default flag
> "kvm_pv_unhalt". As I mentioned, it would cause a kernel crash in
> paravirtualized unhalt code sooner or later in a migrated VM (started
> on Intel, migrated to AMD).
> 
> Please note that according to our tests simply leaving the CPU type
> empty in the GUI (leading to the qemu command line argument of -cpu
> kvm64,+sep,+lahf_lm,+kvm_pv_unhalt,+kvm_pv_eoi,enforce), while
> seemingly working at first, will after some load and idle time in the
> VM result in a crash involving kvm_kick_cpu function somewhere inside
> of the paravirtualized halt/unhalt code. Linux kernels tested ranged
> from Debian's 4.9.210-1 to Ubuntu's 5.3.0-46 (and some in between).
> Therefore the Proxmox default seems to be unsafe and apparently the
> very minimum working command line probably would be args: -cpu
> kvm64,+sep,+lahf_lm,+kvm_pv_eoi.
> 
> 
> 
> 
> So,it sound like it's crash if it's defined with a cpu vendor not
> matching the real hardware ?
> 
> as it's break migration between intel && amd, maybe we shouldn't add
> it to the new x86-64-vx model ?
> 
> 
> 
> a discussion on qemu-devel mailing is talking about performance
> with/witout it
> https://lists.nongnu.org/archive/html/qemu-devel/2017-10/msg01816.html
> 
> and it's seem to help when you have a lot of cores/numa nodes in guest,
> but can slowdown small vms. 
> 

Note that migration between CPUs of different vendors is not a supported
use case (it will always depend on specific models, kernel versions,
etc.), so we can only justify not adding it to the new default model if
it doesn't make life worse for everybody else.

And I'd be a bit careful to jump to general conclusions just from one
forum post.

It seems like you were the one adding the flag ;)

https://git.proxmox.com/?p=qemu-server.git;a=commitdiff;h=117a041466b3af8368506ae3ab7b8d26fc07d9b7

and the LWN-archived mail linked in the commit message says

> Ticket locks have an inherent problem in a virtualized case, because
> the vCPUs are scheduled rather than running concurrently (ignoring
> gang scheduled vCPUs).  This can result in catastrophic performance
> collapses when the vCPU scheduler doesn't schedule the correct "next"
> vCPU, and ends up scheduling a vCPU which burns its entire timeslice
> spinning.  (Note that this is not the same problem as lock-holder
> preemption, which this series also addresses; that's also a problem,
> but not catastrophic).

"catastrophic performance collapses" doesn't sound very promising :/

But if we find that
kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+sep,+lahf_lm,+popcnt,+sse4.1,+sse4.2,+ssse3
causes issues (even if not cross-vendor live-migrating) with the
+kvm_pv_unhalt flag, but not without, it would be a much more convincing
reason against adding the flag for the new default.




^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel
  2023-06-02  7:28           ` Fiona Ebner
@ 2023-06-02  9:13             ` DERUMIER, Alexandre
  2023-06-02 11:13               ` Fiona Ebner
  2023-06-03 14:21               ` Thomas Lamprecht
  0 siblings, 2 replies; 37+ messages in thread
From: DERUMIER, Alexandre @ 2023-06-02  9:13 UTC (permalink / raw)
  To: pve-devel, aderumier, f.ebner

> 
> Note that migration between CPUs of different vendors is not a
> supported
> use case (it will always depend on specific models, kernel versions,
> etc.), so we can only justify not adding it to the new default model
> if
> it doesn't make life worse for everybody else.
> 
> And I'd be a bit careful to jump to general conclusions just from one
> forum post.
> 
> It seems like you were the one adding the flag ;)
> 
> 
yes, I known ^_^   (It's the default too on rhev, but they are not
supporting amd-intel migration too).



> and the LWN-archived mail linked in the commit message says
> 
> > Ticket locks have an inherent problem in a virtualized case,
> > because
> > the vCPUs are scheduled rather than running concurrently (ignoring
> > gang scheduled vCPUs).  This can result in catastrophic performance
> > collapses when the vCPU scheduler doesn't schedule the correct
> > "next"
> > vCPU, and ends up scheduling a vCPU which burns its entire
> > timeslice
> > spinning.  (Note that this is not the same problem as lock-holder
> > preemption, which this series also addresses; that's also a
> > problem,
> > but not catastrophic).
> 
> "catastrophic performance collapses" doesn't sound very promising :/
> 

I have found another thread here:
https://lore.kernel.org/all/0484ea3f-4ba7-4b93-e976-098c5717166e@redhat.com/
where paolo have done benchmark with only 3% difference.
but yes, still slower anyway.

at minimum, it could be interesting to expose the flag in the gui, for
users really needed intel-amd migration.



> But if we find that
> kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+sep,+lahf_lm,+popcnt,+sse4.
> 1,+sse4.2,+ssse3
> causes issues (even if not cross-vendor live-migrating) with the
> +kvm_pv_unhalt flag, but not without, it would be a much more
> convincing
> reason against adding the flag for the new default.
> 
ok ! (I will send a new patch version today)




^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel
  2023-06-02  9:13             ` DERUMIER, Alexandre
@ 2023-06-02 11:13               ` Fiona Ebner
  2023-06-02 11:44                 ` DERUMIER, Alexandre
  2023-06-03 14:21               ` Thomas Lamprecht
  1 sibling, 1 reply; 37+ messages in thread
From: Fiona Ebner @ 2023-06-02 11:13 UTC (permalink / raw)
  To: DERUMIER, Alexandre, pve-devel, aderumier

Am 02.06.23 um 11:13 schrieb DERUMIER, Alexandre:
>>
>> "catastrophic performance collapses" doesn't sound very promising :/
>>
> 
> I have found another thread here:
> https://lore.kernel.org/all/0484ea3f-4ba7-4b93-e976-098c5717166e@redhat.com/
> where paolo have done benchmark with only 3% difference.
> but yes, still slower anyway.

So the "catastrophic performance collapses" might be a bit over the top
or the situation has improved since then for non-paravirtualized locks.
> at minimum, it could be interesting to expose the flag in the gui, for
> users really needed intel-amd migration.
> 

I'm not opposed to that. We could also add a short note to the docs that
it might be worth a try to disable the flag if you need cross-vendor
migration and the default model causes issues. IIRC, from some forum
threads, other people did have success with cross-vendor migration just
selecting kvm64 or Nehalem in the UI, i.e. even with the flag. Likely
depends on concrete host CPU models/kernels whether it's an issue or not.




^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel
  2023-06-02 11:13               ` Fiona Ebner
@ 2023-06-02 11:44                 ` DERUMIER, Alexandre
  0 siblings, 0 replies; 37+ messages in thread
From: DERUMIER, Alexandre @ 2023-06-02 11:44 UTC (permalink / raw)
  To: pve-devel, aderumier, f.ebner

> > 
> > at minimum, it could be interesting to expose the flag in the gui,
> > for
> > users really needed intel-amd migration.
> > 
> 
> I'm not opposed to that. We could also add a short note to the docs
> that
> it might be worth a try to disable the flag if you need cross-vendor
> migration and the default model causes issues. IIRC, from some forum
> threads, other people did have success with cross-vendor migration
> just
> selecting kvm64 or Nehalem in the UI, i.e. even with the flag. Likely
> depends on concrete host CPU models/kernels whether it's an issue or
> not.
> 
ok thanks.I'll look to add it in gui, and also make doc.

I'll add also new cpu model description in doc, and also other vendor
models and revisions.


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel
  2023-06-01 16:00       ` Fiona Ebner
@ 2023-06-02 12:41         ` Aaron Lauterer
  2023-06-02 14:15           ` DERUMIER, Alexandre
       [not found]         ` <fa3565e5-3a9c-9348-f291-554a0e0d6628@binovo.es>
  1 sibling, 1 reply; 37+ messages in thread
From: Aaron Lauterer @ 2023-06-02 12:41 UTC (permalink / raw)
  To: Proxmox VE development discussion, Fiona Ebner, Eneko Lacunza,
	DERUMIER, Alexandre, aderumier

For the record, I tested on:

AMD Ryzen 9 7900X 12-Core Processor
AMD EPYC 7302P 16-Core Processor (Rome)
AMD EPYC 7313 16-Core Processor (Milan)

VMs were all with 2 or 4 cores, q35 and UEFI boot.

 >> qm set <ID> -args '-cpu 
kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+sep,+lahf_lm,+popcnt,+sse4.1,+sse4.2,+ssse3'

all VMs installed nicely without a problem

 >> qm set <ID> -args '-cpu 
Nehalem,enforce,+aes,-svm,-vmx,+kvm_pv_eoi,+kvm_pv_unhalt,vendor="GenuineIntel"'

VMs got stuck during the Debian installer at some point, some were able to 
switch to another TTY, but I don't think that is deterministic.

On the Ryzen 7900X machine, I even saw a crash and kernel trace once when 
starting the installer. It didn't show up again after a reset and cold boot of 
the VM :-/


On 6/1/23 18:00, Fiona Ebner wrote:
> Am 01.06.23 um 14:02 schrieb Eneko Lacunza:
>> Hi,
>>
>> We have Ryzen 1700, 2600X, 3700 and 5950X machines here, I can test on
>> them if that helps (please detail tests to perform).
>>
>> Thanks
>>
> 
> Hi,
> thank you for the offer. It would be interesting to see if you have any
> issues with the following:
> 
>> qm set <ID> -args '-cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+sep,+lahf_lm,+popcnt,+sse4.1,+sse4.2,+ssse3'
> 
> If you like you can also test
> 
>> qm set <ID> -args '-cpu Nehalem,enforce,+aes,-svm,-vmx,+kvm_pv_eoi,+kvm_pv_unhalt,vendor="GenuineIntel"'
> 
> After testing use
> 
>> qm set <ID> --delete args
> 
> to get rid of the modification again.
> 
> Make sure to stop/start the VM fresh after each modification.
> 
> As for what to test, installing Debian 11 would be nice just for
> comparison, but other than that, just do what you like, shouldn't really
> matter too much :)
> 
> Best Regards,
> Fiona
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 




^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel
  2023-06-02 12:41         ` Aaron Lauterer
@ 2023-06-02 14:15           ` DERUMIER, Alexandre
  2023-06-02 16:09             ` Aaron Lauterer
  0 siblings, 1 reply; 37+ messages in thread
From: DERUMIER, Alexandre @ 2023-06-02 14:15 UTC (permalink / raw)
  To: pve-devel, a.lauterer, aderumier, f.ebner, elacunza

Thanks Aeron.

I'll try to reproduce on my side on epyc milan. 
AMD EPYC 7543 32-Core Processor microcode patch_level=0x0a0011ce
(I just tried again with q35, but I'm still not able de reproduce)


can you share your full vmid.conf ?  (numa ?  vga ?..).

do you use debian graphical install or console install ?

host kernel version ? (I'm still testing on 5.15 / qemu 7.4)

my last patch version use qemu64 as base without specifify the vendor,
so I think it should ok, but I would like to find what happend exactly
:)




Le vendredi 02 juin 2023 à 14:41 +0200, Aaron Lauterer a écrit :
> For the record, I tested on:
> 
> AMD Ryzen 9 7900X 12-Core Processor
> AMD EPYC 7302P 16-Core Processor (Rome)
> AMD EPYC 7313 16-Core Processor (Milan)
> 
> VMs were all with 2 or 4 cores, q35 and UEFI boot.
> 
>  >> qm set <ID> -args '-cpu 
> kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+sep,+lahf_lm,+popcnt,+sse4.
> 1,+sse4.2,+ssse3'
> 
> all VMs installed nicely without a problem
> 
>  >> qm set <ID> -args '-cpu 
> Nehalem,enforce,+aes,-svm,-
> vmx,+kvm_pv_eoi,+kvm_pv_unhalt,vendor="GenuineIntel"'
> 
> VMs got stuck during the Debian installer at some point, some were
> able to 
> switch to another TTY, but I don't think that is deterministic.
> 
> On the Ryzen 7900X machine, I even saw a crash and kernel trace once
> when 
> starting the installer. It didn't show up again after a reset and
> cold boot of 
> the VM :-/
> 
> 
> On 6/1/23 18:00, Fiona Ebner wrote:
> > Am 01.06.23 um 14:02 schrieb Eneko Lacunza:
> > > Hi,
> > > 
> > > We have Ryzen 1700, 2600X, 3700 and 5950X machines here, I can
> > > test on
> > > them if that helps (please detail tests to perform).
> > > 
> > > Thanks
> > > 
> > 
> > Hi,
> > thank you for the offer. It would be interesting to see if you have
> > any
> > issues with the following:
> > 
> > > qm set <ID> -args '-cpu
> > > kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+sep,+lahf_lm,+popcnt,+s
> > > se4.1,+sse4.2,+ssse3'
> > 
> > If you like you can also test
> > 
> > > qm set <ID> -args '-cpu Nehalem,enforce,+aes,-svm,-
> > > vmx,+kvm_pv_eoi,+kvm_pv_unhalt,vendor="GenuineIntel"'
> > 
> > After testing use
> > 
> > > qm set <ID> --delete args
> > 
> > to get rid of the modification again.
> > 
> > Make sure to stop/start the VM fresh after each modification.
> > 
> > As for what to test, installing Debian 11 would be nice just for
> > comparison, but other than that, just do what you like, shouldn't
> > really
> > matter too much :)
> > 
> > Best Regards,
> > Fiona
> > 
> > 
> > _______________________________________________
> > pve-devel mailing list
> > pve-devel@lists.proxmox.com
> > https://antiphishing.cetsi.fr/proxy/v3?i=SGI0YVJGNmxZNE90Z2thMFYLWSxJOfIERJocpmb73Vs&r=SW5LV3JodE9QZkRVZ3JEYaKhfBhKBzRXSL89azwXC1T82d4SHYTQZhKJK2pOWOed&f=bnJjU3hQT3pQSmNQZVE3aOBk4INl-9oWq-3WY1DAs1r4EwFE_F3He2PZuXGJPKRN&u=https%3A//lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel&k=dFBm
> > 
> > 
> 


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel
  2023-06-02 14:15           ` DERUMIER, Alexandre
@ 2023-06-02 16:09             ` Aaron Lauterer
  2023-06-02 16:27               ` DERUMIER, Alexandre
  0 siblings, 1 reply; 37+ messages in thread
From: Aaron Lauterer @ 2023-06-02 16:09 UTC (permalink / raw)
  To: DERUMIER, Alexandre, pve-devel, aderumier, f.ebner, elacunza



On 6/2/23 16:15, DERUMIER, Alexandre wrote:
> Thanks Aeron.
> 
> I'll try to reproduce on my side on epyc milan.
> AMD EPYC 7543 32-Core Processor microcode patch_level=0x0a0011ce
> (I just tried again with q35, but I'm still not able de reproduce)
> 
> 
> can you share your full vmid.conf ?  (numa ?  vga ?..).


On the Epyc Systems:

args: -cpu 
Nehalem,enforce,+aes,-svm,-vmx,+kvm_pv_eoi,+kvm_pv_unhalt,vendor="GenuineIntel"
bios: ovmf
boot: order=scsi0;ide2;net0
cores: 2
cpu: host,flags=+aes
efidisk0: local-storage:vm-104-disk-0,efitype=4m,size=1M
ide2: iso-images:iso/debian-11.7.0-amd64-netinst.iso,media=cdrom,size=389M
machine: q35
memory: 2048
meta: creation-qemu=7.2.0,ctime=1685631249
name: tmp-debtest
net0: virtio=26:A2:08:6B:00:8F,bridge=vmbr0,firewall=1
numa: 0
ostype: l26
scsi0: local-storage:vm-104-disk-1,discard=on,iothread=1,size=8G
scsihw: virtio-scsi-single
smbios1: uuid=ef95de37-c93f-4987-820d-4f969913b03d
sockets: 1
vmgenid: cb42b08c-9448-4821-b1e6-d018150de807


On the Ryzen system:

args: -cpu 
kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+sep,+lahf_lm,+popcnt,+sse4.1,+sse4.2,+ssse3
bios: ovmf
boot: order=scsi0;ide2;net0
cores: 4
cpu: kvm64
efidisk0: local-zfs:vm-115-disk-1,efitype=4m,size=1M
ide2: iso:iso/debian-11.6.0-amd64-netinst.iso,media=cdrom,size=388M
machine: q35
memory: 2048
meta: creation-qemu=7.2.0,ctime=1685537448
name: debtest
net0: virtio=AA:AA:7A:3A:F5:94,bridge=vmbr0,firewall=1
numa: 0
ostype: l26
scsi0: local-zfs:vm-115-disk-0,iothread=1,size=32G
scsihw: virtio-scsi-single
smbios1: uuid=05785fd0-69b7-4df7-a96e-962e030cdbca
sockets: 1
vmgenid: 869bd693-3560-4cd1-a5be-f61ec158acef


The CPU args are different, depending on what I tested last tested.
> 
> do you use debian graphical install or console install ?

the cli installer

> 
> host kernel version ? (I'm still testing on 5.15 / qemu 7.4)

On the Epyc Systems:
$ pveversion -v
proxmox-ve: 7.4-1 (running kernel: 6.2.6-1-pve)
pve-manager: 7.4-3 (running version: 7.4-3/9002ab8a)
pve-kernel-6.2: 7.3-8
pve-kernel-5.15: 7.3-3
pve-kernel-6.2.6-1-pve: 6.2.6-1
pve-kernel-5.15.102-1-pve: 5.15.102-1
pve-kernel-5.15.5-1-pve: 5.15.5-1
(…)
qemu-server: 7.4-3

On the Ryzen System:
$ pveversion -v
proxmox-ve: 7.4-1 (running kernel: 6.2.11-2-pve)
pve-manager: 7.4-4 (running version: 7.4-4/4a8501a8)
pve-kernel-6.2: 7.4-3
pve-kernel-5.15: 7.4-3
pve-kernel-6.2.11-2-pve: 6.2.11-2
pve-kernel-6.2.11-1-pve: 6.2.11-1
pve-kernel-5.15.107-2-pve: 5.15.107-2
(…)
qemu-server: 7.4-3

> 
> my last patch version use qemu64 as base without specifify the vendor,
> so I think it should ok, but I would like to find what happend exactly
> :)
> 
> 
> 




^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel
  2023-06-02 16:09             ` Aaron Lauterer
@ 2023-06-02 16:27               ` DERUMIER, Alexandre
  0 siblings, 0 replies; 37+ messages in thread
From: DERUMIER, Alexandre @ 2023-06-02 16:27 UTC (permalink / raw)
  To: pve-devel, a.lauterer, aderumier, f.ebner, elacunza

Thanks!

I'll try to upgrade to 6.2 kernel, this is the only difference

Le vendredi 02 juin 2023 à 18:09 +0200, Aaron Lauterer a écrit :
> 
> 
> On 6/2/23 16:15, DERUMIER, Alexandre wrote:
> > Thanks Aeron.
> > 
> > I'll try to reproduce on my side on epyc milan.
> > AMD EPYC 7543 32-Core Processor microcode patch_level=0x0a0011ce
> > (I just tried again with q35, but I'm still not able de reproduce)
> > 
> > 
> > can you share your full vmid.conf ?  (numa ?  vga ?..).
> 
> 
> On the Epyc Systems:
> 
> args: -cpu 
> Nehalem,enforce,+aes,-svm,-
> vmx,+kvm_pv_eoi,+kvm_pv_unhalt,vendor="GenuineIntel"
> bios: ovmf
> boot: order=scsi0;ide2;net0
> cores: 2
> cpu: host,flags=+aes
> efidisk0: local-storage:vm-104-disk-0,efitype=4m,size=1M
> ide2: iso-images:iso/debian-11.7.0-amd64-
> netinst.iso,media=cdrom,size=389M
> machine: q35
> memory: 2048
> meta: creation-qemu=7.2.0,ctime=1685631249
> name: tmp-debtest
> net0: virtio=26:A2:08:6B:00:8F,bridge=vmbr0,firewall=1
> numa: 0
> ostype: l26
> scsi0: local-storage:vm-104-disk-1,discard=on,iothread=1,size=8G
> scsihw: virtio-scsi-single
> smbios1: uuid=ef95de37-c93f-4987-820d-4f969913b03d
> sockets: 1
> vmgenid: cb42b08c-9448-4821-b1e6-d018150de807
> 
> 
> On the Ryzen system:
> 
> args: -cpu 
> kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+sep,+lahf_lm,+popcnt,+sse4.
> 1,+sse4.2,+ssse3
> bios: ovmf
> boot: order=scsi0;ide2;net0
> cores: 4
> cpu: kvm64
> efidisk0: local-zfs:vm-115-disk-1,efitype=4m,size=1M
> ide2: iso:iso/debian-11.6.0-amd64-netinst.iso,media=cdrom,size=388M
> machine: q35
> memory: 2048
> meta: creation-qemu=7.2.0,ctime=1685537448
> name: debtest
> net0: virtio=AA:AA:7A:3A:F5:94,bridge=vmbr0,firewall=1
> numa: 0
> ostype: l26
> scsi0: local-zfs:vm-115-disk-0,iothread=1,size=32G
> scsihw: virtio-scsi-single
> smbios1: uuid=05785fd0-69b7-4df7-a96e-962e030cdbca
> sockets: 1
> vmgenid: 869bd693-3560-4cd1-a5be-f61ec158acef
> 
> 
> The CPU args are different, depending on what I tested last tested.
> > 
> > do you use debian graphical install or console install ?
> 
> the cli installer
> 
> > 
> > host kernel version ? (I'm still testing on 5.15 / qemu 7.4)
> 
> On the Epyc Systems:
> $ pveversion -v
> proxmox-ve: 7.4-1 (running kernel: 6.2.6-1-pve)
> pve-manager: 7.4-3 (running version: 7.4-3/9002ab8a)
> pve-kernel-6.2: 7.3-8
> pve-kernel-5.15: 7.3-3
> pve-kernel-6.2.6-1-pve: 6.2.6-1
> pve-kernel-5.15.102-1-pve: 5.15.102-1
> pve-kernel-5.15.5-1-pve: 5.15.5-1
> (…)
> qemu-server: 7.4-3
> 
> On the Ryzen System:
> $ pveversion -v
> proxmox-ve: 7.4-1 (running kernel: 6.2.11-2-pve)
> pve-manager: 7.4-4 (running version: 7.4-4/4a8501a8)
> pve-kernel-6.2: 7.4-3
> pve-kernel-5.15: 7.4-3
> pve-kernel-6.2.11-2-pve: 6.2.11-2
> pve-kernel-6.2.11-1-pve: 6.2.11-1
> pve-kernel-5.15.107-2-pve: 5.15.107-2
> (…)
> qemu-server: 7.4-3
> 
> > 
> > my last patch version use qemu64 as base without specifify the
> > vendor,
> > so I think it should ok, but I would like to find what happend
> > exactly
> > :)
> > 
> > 
> > 
> 


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel
  2023-06-01  8:34     ` Fiona Ebner
  2023-06-01  9:06       ` DERUMIER, Alexandre
@ 2023-06-03 14:05       ` Thomas Lamprecht
  1 sibling, 0 replies; 37+ messages in thread
From: Thomas Lamprecht @ 2023-06-03 14:05 UTC (permalink / raw)
  To: Proxmox VE development discussion, Fiona Ebner, DERUMIER,
	Alexandre, aderumier

Am 01/06/2023 um 10:34 schrieb Fiona Ebner:
> Am 31.05.23 um 16:34 schrieb DERUMIER, Alexandre:
>> Le mercredi 31 mai 2023 à 13:36 +0200, Fiona Ebner a écrit :
>>> Am 22.05.23 um 12:25 schrieb Alexandre Derumier:
>>>> In addition to theses model, I have enabled aes too.
>>>> I think it's really important, because a lot of users use default
>>>> values and have
>>>> bad performance with ssl and other crypto stuffs.
>>>>
>>>
>>> So there is the answer to my aes question :) But shouldn't we rather
>>> set
>>> it via the UI as a default than change the CPU definition itself?
>>> That
>>> feels cleaner as we'd not diverge from how they defined the ABI.
>>
>> I don't have looked pve-manager code yet, but do you think it's easy
>> to auto enable/disable the aes flag in the grid when we choose theses
>> models ?
> 
> I also haven't looked at the code, but yeah, it is an issue that it's in
> the advanced part and we shouldn't hide it from the user that it's on.
> 
>> Maybe could it be better to have 2 differents models, with/without aes
>> (like some qemu models versions like -IBRS,  
>> here we could have
>>
>> x86-64-v2
>> x86-64-v2-aes   (default)
>> x86-64-v3
>> x86-64-v3-aes
> 
> That might work, but if we do that, please only in the UI. Also not
> ideal, because how would interaction with the flag in the grid work?
> E.g. don't show it, force it on if an -aes model is selected?

Please no, I would find it very odd to see a CPU model in the Web UI that
doesn't exist in the API/Backend.

> 
> Maybe the easiest would be to extract the aes flag out of the grid into
> the non-advanced part?

Yes, rather that – but possibly without the radio-group UI but simply a
combobox with "Yes" <- default, "Auto (CPU model)" or "no" options




^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel
  2023-06-01  9:06       ` DERUMIER, Alexandre
@ 2023-06-03 14:14         ` Thomas Lamprecht
  2023-06-04  6:29           ` DERUMIER, Alexandre
  0 siblings, 1 reply; 37+ messages in thread
From: Thomas Lamprecht @ 2023-06-03 14:14 UTC (permalink / raw)
  To: Proxmox VE development discussion, DERUMIER, Alexandre,
	aderumier, f.ebner

Am 01/06/2023 um 11:06 schrieb DERUMIER, Alexandre:
>> Maybe the easiest would be to extract the aes flag out of the grid
>> into
>> the non-advanced part?
>>
> Couldn't be easier to keep aes enable by default in a single model
> (even if it's doesn't match the x86-64 spec). and allow user to optin
> disable it.
> The only server where you need to disable aes if for nahelem, and I
> don't think that a lot of users still have this cpu in production.
> (so keeping the aes flag in advanced section make sense).
> Also, user with really old servers, could keep to use kvm64 model,
> where aes is not enabled.


I also think that we should not bend to much for Nehalem, and fwiw if
we go for a v2+aes CPU model (which IMO is one of the easies solutions)
we would only need that for v2, as v3 could always have that enabled by
default FWIWCT?

So:

x86-64-v2
x86-64-v2-aes   (UI default)
x86-64-v3

(and that as real models, not just UI fakery) would work,

But tbh., I'd not be completely against just enabling it for v2 and warning,
or even erroring, if the VM gets created on a host that doesn't supports it
(which might be a good idea for any vX level); as Alexandre is right, a lot of
users needlessly get slower VMs that they could be and production setups with
a 14 year old CPU are just very unlikely, and they simply can disable AES again...




^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel
  2023-06-02  9:13             ` DERUMIER, Alexandre
  2023-06-02 11:13               ` Fiona Ebner
@ 2023-06-03 14:21               ` Thomas Lamprecht
  1 sibling, 0 replies; 37+ messages in thread
From: Thomas Lamprecht @ 2023-06-03 14:21 UTC (permalink / raw)
  To: Proxmox VE development discussion, DERUMIER, Alexandre,
	aderumier, f.ebner

Am 02/06/2023 um 11:13 schrieb DERUMIER, Alexandre:
> at minimum, it could be interesting to expose the flag in the gui, for
> users really needed intel-amd migration.

acked also from my side, we can use the flag description for the a note
that it might benefit cross vendor migration (with some overal slowdown).




^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel
  2023-06-03 14:14         ` Thomas Lamprecht
@ 2023-06-04  6:29           ` DERUMIER, Alexandre
  0 siblings, 0 replies; 37+ messages in thread
From: DERUMIER, Alexandre @ 2023-06-04  6:29 UTC (permalink / raw)
  To: pve-devel, t.lamprecht, aderumier, f.ebner

Le samedi 03 juin 2023 à 16:14 +0200, Thomas Lamprecht a écrit :
> Am 01/06/2023 um 11:06 schrieb DERUMIER, Alexandre:
> > > Maybe the easiest would be to extract the aes flag out of the
> > > grid
> > > into
> > > the non-advanced part?
> > > 
> > Couldn't be easier to keep aes enable by default in a single model
> > (even if it's doesn't match the x86-64 spec). and allow user to
> > optin
> > disable it.
> > The only server where you need to disable aes if for nahelem, and I
> > don't think that a lot of users still have this cpu in production.
> > (so keeping the aes flag in advanced section make sense).
> > Also, user with really old servers, could keep to use kvm64 model,
> > where aes is not enabled.
> 
> 
> I also think that we should not bend to much for Nehalem, and fwiw if
> we go for a v2+aes CPU model (which IMO is one of the easies
> solutions)
> we would only need that for v2, as v3 could always have that enabled
> by
> default FWIWCT?
> 
> So:
> 
> x86-64-v2
> x86-64-v2-aes   (UI default)
> x86-64-v3
> 
> (and that as real models, not just UI fakery) would work,
> 
That's exactly what I have done for the v4 patch series ;)



> But tbh., I'd not be completely against just enabling it for v2 and
> warning,
> or even erroring, if the VM gets created on a host that doesn't
> supports it
> (which might be a good idea for any vX level); as Alexandre is right,
> a lot of
> users needlessly get slower VMs that they could be and production
> setups with
> a 14 year old CPU are just very unlikely, and they simply can disable
> AES again...
> 
I have see that with a lot of my customers, (and also with some
benchmark on the net), where admins don't even known what AES is ^_^


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel
       [not found]         ` <fa3565e5-3a9c-9348-f291-554a0e0d6628@binovo.es>
@ 2023-06-06  9:15           ` Fiona Ebner
  0 siblings, 0 replies; 37+ messages in thread
From: Fiona Ebner @ 2023-06-06  9:15 UTC (permalink / raw)
  To: Eneko Lacunza, Proxmox VE development discussion

Am 05.06.23 um 17:20 schrieb Eneko Lacunza:
> Hi,
> 
> I'm sorry I could only test for Ryzen 1700, 2600X and 5950X - our 3700X
> is offline, pending some upgrades. I hope it will be back again in some
> days.
> 
> Tested installation of Debian 11.1.0 ISO with GUI installer upto first
> boot to GUI login to installed system:
> 
> 
> El 1/6/23 a las 18:00, Fiona Ebner escribió:
>>> qm set <ID> -args '-cpu
>>> kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+sep,+lahf_lm,+popcnt,+sse4.1,+sse4.2,+ssse3'
> 
> This was good for all 1700, 2600X and 5950X.
> 
>> If you like you can also test
>>
>>> qm set <ID> -args '-cpu
>>> Nehalem,enforce,+aes,-svm,-vmx,+kvm_pv_eoi,+kvm_pv_unhalt,vendor="GenuineIntel"'
> This was good for 1700, but I suspect it may hang later, will check
> tomorrow.
> 
> 2600X: install was good, but after booting to GUI login screen, it froze
> with ~50% CPU use. A reset booted well, no hang for now.
> 5950X hung during installation, no CPU use. Reset + reinstall worked OK
> 
> 3 VMs are left running in login screen to check tomorrow.
> 

Thank you for testing! This is consistent with what Aaron and I
experienced. So there is an issue with basing the CPU off Nehalem (in
combination with the kvm_pv_unhalt flag), but basing off kvm64 seems to
work just fine :)

If you'd like to further test, please use

qm set <ID> -args '-cpu
qemu64,+aes,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+pni,+popcnt,+sse4.1,+sse4.2,+ssse3'

as that's the default proposed in the latest version.

Best Regards,
Fiona




^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2023-06-06  9:15 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-22 10:25 [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel Alexandre Derumier
2023-05-22 10:25 ` [pve-devel] [PATCH v3 qemu-server 1/7] cpuconfig: add new x86-64-vX models Alexandre Derumier
2023-05-31 11:08   ` Fiona Ebner
2023-05-31 15:08     ` DERUMIER, Alexandre
2023-06-01  9:17       ` Fiona Ebner
2023-06-01 11:27         ` DERUMIER, Alexandre
2023-05-22 10:25 ` [pve-devel] [PATCH v2 pve-manager 1/1] qemu: processor : set x86-64-v2 as default cputype for create wizard Alexandre Derumier
2023-05-22 10:25 ` [pve-devel] [PATCH pve-common 1/1] read_cpuinfo: add msr support Alexandre Derumier
2023-05-22 10:25 ` [pve-devel] [PATCH v3 qemu-server 2/7] cpumodel: add cpu models with flags Alexandre Derumier
2023-05-22 10:25 ` [pve-devel] [PATCH v3 qemu-server 3/7] cpumodel: compute qemu supported flags Alexandre Derumier
2023-05-22 10:25 ` [pve-devel] [PATCH v3 qemu-server 4/7] cpuconfig: add get_host_cpu_flags Alexandre Derumier
2023-05-22 10:25 ` [pve-devel] [PATCH v3 qemu-server 5/7] cpuconfig: add find_best_cpumodel Alexandre Derumier
2023-05-22 10:25 ` [pve-devel] [PATCH v3 qemu-server 6/7] cpuconfig: add find_hosts_common_flags Alexandre Derumier
2023-05-22 10:25 ` [pve-devel] [PATCH v3 qemu-server 7/7] add best cpu model detection tests Alexandre Derumier
2023-05-31 11:36 ` [pve-devel] [PATCH-SERIES v3 qemu-server/manager/common] add and set x86-64-v2 as default model for new vms and detect best cpumodel Fiona Ebner
2023-05-31 14:34   ` DERUMIER, Alexandre
2023-06-01  8:34     ` Fiona Ebner
2023-06-01  9:06       ` DERUMIER, Alexandre
2023-06-03 14:14         ` Thomas Lamprecht
2023-06-04  6:29           ` DERUMIER, Alexandre
2023-06-03 14:05       ` Thomas Lamprecht
2023-06-01  9:34 ` Fiona Ebner
2023-06-01 11:37   ` DERUMIER, Alexandre
2023-06-01 13:53     ` DERUMIER, Alexandre
2023-06-01 15:56       ` Fiona Ebner
2023-06-01 21:15         ` DERUMIER, Alexandre
2023-06-02  7:28           ` Fiona Ebner
2023-06-02  9:13             ` DERUMIER, Alexandre
2023-06-02 11:13               ` Fiona Ebner
2023-06-02 11:44                 ` DERUMIER, Alexandre
2023-06-03 14:21               ` Thomas Lamprecht
     [not found]     ` <8277a27b-a70f-b731-69f7-fc9ae69b2da2@binovo.es>
2023-06-01 16:00       ` Fiona Ebner
2023-06-02 12:41         ` Aaron Lauterer
2023-06-02 14:15           ` DERUMIER, Alexandre
2023-06-02 16:09             ` Aaron Lauterer
2023-06-02 16:27               ` DERUMIER, Alexandre
     [not found]         ` <fa3565e5-3a9c-9348-f291-554a0e0d6628@binovo.es>
2023-06-06  9:15           ` Fiona Ebner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal