Unable to enable specific CPU flag using cpu-models.conf

proxale

Active Member
May 24, 2020
43
4
28
113
Using PVE 7.2. For max live migration compatibility I had been sticking to kvm64 but some requirements now need some VMs to use x86-64v2 spec.

The flags used for the cpu model inside cpu-models.conf are:
flags: +cx16;+lahf-lm;+popcnt;+sse4.1;+sse4.2;+ssse3

I was able to enable all the other flags except lahf_lm for some reason
lahf_lm is from lscpu output but I understand we need to use the string from qemu/kvm which uses a dash, i.e. lahf-lm

However, neither worked when I tried. Anybody has any suggestions?

Alternatively, would it be better to pick an old v2 model like Nehalem but what would the impact be on live migration especially since my base hardware are currently all Epyc?
 
Hi,
it's highly recommended to upgrade to at least 7.4 (if you want to go all the way to Proxmox VE 8, here is the guide). There may have been fixes in the meantime. What is the exact error you get? Please share the VM config qm config <ID> and the full CPU configuration file.
 
Using PVE 7.2. For max live migration compatibility I had been sticking to kvm64 but some requirements now need some VMs to use x86-64v2 spec.

The flags used for the cpu model inside cpu-models.conf are:
flags: +cx16;+lahf-lm;+popcnt;+sse4.1;+sse4.2;+ssse3

I was able to enable all the other flags except lahf_lm for some reason
lahf_lm is from lscpu output but I understand we need to use the string from qemu/kvm which uses a dash, i.e. lahf-lm

However, neither worked when I tried. Anybody has any suggestions?

Alternatively, would it be better to pick an old v2 model like Nehalem but what would the impact be on live migration especially since my base hardware are currently all Epyc?
When all are EPYC, why not set it to Epyc? And you should realy go to PVE 8.....
1700663435400.png
 
Hi,
it's highly recommended to upgrade to at least 7.4 (if you want to go all the way to Proxmox VE 8, here is the guide). There may have been fixes in the meantime. What is the exact error you get? Please share the VM config qm config <ID> and the full CPU configuration file.
There is no error. The VM can be started up but when I check the output of lscpu, there lafh-lm flag is missing. The rest of the additional flags appear as expected.
 
What do you see when you check the QEMU command-line: qm showcmd <ID> --pretty or after starting the VM: ps aux | grep $(cat /run/qemu-server/<ID>.pid). Is there any message in the host's system log or VM <ID> - Start (bottom panel or VM's Task History in the UI, double click to see output)?
 
What do you see when you check the QEMU command-line: qm showcmd <ID> --pretty or after starting the VM: ps aux | grep $(cat /run/qemu-server/<ID>.pid). Is there any message in the host's system log or VM <ID> - Start (bottom panel or VM's Task History in the UI, double click to see output)?
Using qm showcmd when the CPU is set to default kvm64, I see that the lafh_lm flag is actually configured already:

Code:
-cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep \
lscpu inside VM
Code:
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 lm rep_good nopl cpuid extd_apicid tsc_known_freq pni cx16 x2apic hypervisor cmp_legacy 3dnowprefetch vmmcall

After switching to custom cpu-model with
Code:
flags +sse4.1;+lahf-lm;+sse4.2
I get
Code:
-cpu 'kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf-lm,+lahf_lm,+sep,+sse4.1,+sse4.2,host-phys-bits=true' \

lscpu inside VM shows the added sse4.1 and sse4.2 but not lahf_lm
Code:
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 lm rep_good nopl cpuid extd_apicid tsc_known_freq pni cx16 sse4_1 sse4_2 x2apic hypervisor cmp_legacy 3dnowprefetch vmmcall

In both cases, the Task History only shows "TASK OK"


I was only able to get lahf_lm flag in the VM if I switch to the inbuilt qemu64
Code:
-cpu qemu64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt \
lscpu inside VM
Code:
fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm rep_good nopl cpuid extd_apicid tsc_known_freq pni cx16 x2apic hypervisor [b]lahf_lm[/b] cmp_legacy 3dnowprefetch vmmcall
 
Using qm showcmd when the CPU is set to default kvm64, I see that the lafh_lm flag is actually configured already:

Code:
-cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep \
lscpu inside VM
Code:
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 lm rep_good nopl cpuid extd_apicid tsc_known_freq pni cx16 x2apic hypervisor cmp_legacy 3dnowprefetch vmmcall

After switching to custom cpu-model with
Code:
flags +sse4.1;+lahf-lm;+sse4.2
I get
Code:
-cpu 'kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf-lm,+lahf_lm,+sep,+sse4.1,+sse4.2,host-phys-bits=true' \

lscpu inside VM shows the added sse4.1 and sse4.2 but not lahf_lm
Code:
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 lm rep_good nopl cpuid extd_apicid tsc_known_freq pni cx16 sse4_1 sse4_2 x2apic hypervisor cmp_legacy 3dnowprefetch vmmcall

In both cases, the Task History only shows "TASK OK"


I was only able to get lahf_lm flag in the VM if I switch to the inbuilt qemu64
Code:
-cpu qemu64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt \
lscpu inside VM
Code:
fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm rep_good nopl cpuid extd_apicid tsc_known_freq pni cx16 x2apic hypervisor [b]lahf_lm[/b] cmp_legacy 3dnowprefetch vmmcall
Interesting. Maybe there's an incompatibility with the flag and kvm64 or maybe it's just not shown for some reason. In any case, qemu64 is recommended over kvm64 (kvm64 is unfortunately the old default that needs to stay for backwards-compat reasons). In Proxmox VE 8, the UI will default to x86-64-v2-AES which is qemu64 with additional flags to comply with the standard.
 
Interesting. Maybe there's an incompatibility with the flag and kvm64 or maybe it's just not shown for some reason. In any case, qemu64 is recommended over kvm64 (kvm64 is unfortunately the old default that needs to stay for backwards-compat reasons). In Proxmox VE 8, the UI will default to x86-64-v2-AES which is qemu64 with additional flags to comply with the standard.
Thanks for the reply, that is basically what I did after discovering that qemu64 enables the lafh-lm flag. I changed the custom CPU model from reporting as kvm64 to qemu64 and all the flags for x86-64v2 showed up correctly inside the VM.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!