Default CPU lacks features and speed

Bug #1869185 reported by Christian Ehrhardt 
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
uvtool (Ubuntu)
Fix Released
Wishlist
Unassigned

Bug Description

Currently uvtool sets no cpu at all.
That works as it is defined as the most compatible old qmeu64 type - that has the attribute to be "emulatable" so you could migrate it into a TCG based qemu.
But that is nothing anyone wants, instead we loose more and more features/speed by having such an old default.

host-model will be "as close as possible to the host cpu" while at the same time avoiding the issues of host-passthrough which is non-migratable and potentially dangerous features.

Host-model would be a nice default for uvtool that I'd like to implement in our templates.
Unfortunately too late for focal, but there always is a next release ...

Related branches

Revision history for this message
Robie Basak (racb) wrote :

+1 as a new default

Would it be useful to retain the current default as an option?

Changed in uvtool (Ubuntu):
status: New → Triaged
importance: Undecided → Wishlist
summary: - consider a faster default cpu
+ Default CPU lacks features and speed
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

I already added --host-passthrough in the past.
The new suggestion would be to make host-model the default and to add --model to allow inserting any other as needed.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote : Re: [Bug 1869185] Re: consider a faster default cpu

>
> Would it be useful to retain the current default as an option?
>

In my mind the old default could then be reached via
  --model qemu64

--model would also allow to set any other named type.
I see no need for *another* option.

If only I'd have thought about it earlier, I'd never have added
--host-passthrough as that could as well be "--model host-passthrough" then.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

[15:01] <rbasak> cpaelzer: uvtool> all sounds good to me. Thanks!
[15:02] <rbasak> I'm also happy to deprecate --host-passthrough
[15:02] <rbasak> With a warning, for eventual removal.
[15:03] <cpaelzer> rbasak: great

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

I have opened up a RFC MP https://code.launchpad.net/~paelzer/uvtool/+git/uvtool/+merge/382847 outlining how I think this could be done. But it is untested and testing cross arch will need a while, hence RFC for now.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

My laptop becomes auto-converted via host-model into:
  <cpu mode='custom' match='exact' check='full'>
    <model fallback='forbid'>Skylake-Client-IBRS</model>
    <vendor>Intel</vendor>
    <feature policy='require' name='ss'/>
    <feature policy='require' name='vmx'/>
    <feature policy='require' name='hypervisor'/>
    <feature policy='require' name='tsc_adjust'/>
    <feature policy='require' name='clflushopt'/>
    <feature policy='require' name='umip'/>
    <feature policy='require' name='md-clear'/>
    <feature policy='require' name='stibp'/>
    <feature policy='require' name='arch-capabilities'/>
    <feature policy='require' name='ssbd'/>
    <feature policy='require' name='xsaves'/>
    <feature policy='require' name='pdpe1gb'/>
    <feature policy='require' name='skip-l1dfl-vmentry'/>
    <feature policy='disable' name='hle'/>
    <feature policy='disable' name='rtm'/>
    <feature policy='disable' name='mpx'/>
  </cpu>

--host-passthrough becomes
  <cpu mode='host-passthrough' check='none'/>
That is fine as well.

--model Opteron_G1 becomes
  <cpu mode='custom' match='exact' check='full'>
    <model fallback='forbid'>Opteron_G1</model>
    <feature policy='require' name='vme'/>
    <feature policy='require' name='x2apic'/>
    <feature policy='require' name='hypervisor'/>
  </cpu>
Good as well it auto added the extra features as needed.

An unsupported type fails as expected:
--model Icelake-Server
uvt-kvm: error: libvirt: the CPU is incompatible with host CPU: Host CPU does not provide required features: hle, rtm, avx512f, avx512dq, clwb, avx512cd, avx512bw, avx512vl, avx512vbmi, pku, avx512vbmi2, gfni, vaes, vpclmulqdq, avx512vnni, avx512bitalg, avx512-vpopcntdq, la57, wbnoinvd
That is fair and correct

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Unknown CPU e.g. --model Icelake-Server on s390x:
uvt-kvm: error: libvirt: this function is not supported by the connection driver: cannot translate CPU model Icelake-Server to a supported model

Default on s390x (no arg but the same with --model host-model)
  <cpu mode='custom' match='exact' check='partial'>
    <model fallback='forbid'>z13-base</model>
    <feature policy='require' name='aen'/>
    <feature policy='require' name='aefsi'/>
    <feature policy='require' name='msa5'/>
    <feature policy='require' name='msa4'/>
...

--model host-passthrough @s390x
  <cpu mode='host-passthrough' check='none'/>

explcit model --model z196 @s390x
  <cpu mode='custom' match='exact' check='partial'>
    <model fallback='allow'>z196</model>
  </cpu>

Looks all good on non-x86 as well

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

found an issue when doing emulation, fixed int he MP now

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

On arm64 host-passthrough was already the default in the XML (and the only thing working reliable).

--host-model doesn't work as of today on arm64
uvt-kvm: error: libvirt: unsupported configuration: CPU mode 'host-model' for aarch64 kvm domain on aarch64 host is not supported by hypervisor

While --model host-passthrough as well as --host-passthrough work well.
So on arm64 that has to be the default.

no arg or --model host-passthrough as well as --host-passthrough become:
  <cpu mode='host-passthrough' check='none'/>

The cpu output lists all types as usable='unknown' \o/
People can still manually set something else on arm64 as well now, but it likely won't work.

That implementation now has safe defaults and would allow to not need to change uvtool if qemu/libvirt down the road will support host-model or named types on arm64.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package uvtool - 0~git178-0ubuntu1

---------------
uvtool (0~git178-0ubuntu1) jammy; urgency=medium

  [ Christian Ehrhardt ]
  * Default to "as close as possible to the host CPU" for the guest CPU model,
    and allow overriding it with --cpu-model (LP: #1869185).
  * Support ssh key types other than dsa for FIPS systems that do not permit it
    (LP: #1936473).
  * Switch IP guessing to libvirt-python.

  [ Andrea Righi ]
  * Drop 'ps2' from the armhf template since this bus is not available there
    (LP: #1956366).

 -- Robie Basak <email address hidden> Thu, 24 Feb 2022 22:02:02 +0000

Changed in uvtool (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.