Add option to skip cpu feature and model verification in libvirt and rely on qemu 'enforce' option

Jiri Denemark jdenemar at redhat.com
Thu Nov 24 12:10:14 UTC 2022


On Wed, Nov 23, 2022 at 18:34:38 +0530, manish.mishra wrote:
> oh i see you meant something like this,
> 
>    <cpu mode='custom' match='exact' check='none'>
>      <numa>
>        <cell id='0' cpus='0-239' memory='8388608' unit='KiB' memAccess='shared'/>
>      </numa>
>    </cpu>
> 
>    <qemu:commandline>
>      <qemu:arg value='-cpu'/>
>      <qemu:arg value='enforce,Icelake-v4,x2apic=on,hv-time,kvm-pv-eoi=on'/>
>    </qemu:commandline>

This won't work as libvirt should add a default CPU model there and
replace check='none' with check='full' once the domain starts.

But we actually have a way to do what you need even without any change
in libvirt:

  <cpu mode='host-passthrough' check='none'>
    <topology .../>
    <numa>
      ...
    </numa>
    ...
  </cpu>

  <qemu:commandline>
    <qemu:arg value='-cpu'/>
    <qemu:arg value='Icelake-Server-v4,enforce,x2apic=on,hv-time,kvm-pv-eoi=on'/>
  </qemu:commandline>

This will result in

  -cpu host,migratable=on
  ...
  -cpu Icelake-Server-v4,enforce,x2apic=on,hv-time,kvm-pv-eoi=on

and libvirt will not touch the check='none' attribute once the domain
starts and it would not complain about any unknown CPU features or
models as there's nothing to check in <cpu/>.

That is, there's no need to come up with anything special to support
passing arbitrary options to -cpu.

Jirka


More information about the libvir-list mailing list