On 3/16/23 11:56, Jim Fehlig wrote:
On 3/15/23 08:40, Ján Tomko wrote:
> On a Monday in 2023, Jim Fehlig wrote:
>> If an explicit machine type is not specified in the VM config, the qemu
>> driver will select the first machine type in the list of machine types for
>> the specified accelerator. See virQEMUCapsGetPreferredMachine
>>
>>
https://gitlab.com/libvirt/libvirt/-/blob/master/src/qemu/qemu_capabiliti...
>>
>> On my test machines, this works reasonably well for x86_64 where the first
>> machine type is pc-i440fx-7.1. But for aarch64, the first machine is
>> integratorcp, which is not very useful with maxCpus=1 and other limitations.
>
> Is it possible to run such machine with libvirt?
I just did a quick check with libvirt 9.1.0 (qemu is a bit older, at 7.1.0):
# cat test.xml
<domain type='kvm'>
<name>test</name>
<memory unit='KiB'>2097152</memory>
<vcpu placement='static'>1</vcpu>
<os>
<type>hvm</type>
<loader readonly='yes'
type='pflash'>/usr/share/qemu/aavmf-aarch64-code.bin</loader>
<nvram template='/usr/share/qemu/aavmf-aarch64-vars.bin'/>
<boot dev='hd'/>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-aarch64</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' discard='unmap'/>
<source file='/var/lib/libvirt/images/test.qcow2'/>
<target dev='vda' bus='virtio'/>
</disk>
</devices>
</domain>
# virsh create test.xml
error: Failed to create domain from test.xml
error: internal error: Unexpected enum value 0 for virDomainDeviceAddressType
I don't _think_ it's a downstream bug, nor fixed in git in the meantime. It
appears running the old integratorcp machine with libivrt is not possible.
I trimmed the config to remove things like virtio devices that are not supported
by the default machine type, but still it does not work with libvirt:
# cat test.xml
<domain type='kvm'>
<name>test</name>
<memory unit='KiB'>2097152</memory>
<vcpu placement='static'>1</vcpu>
<os>
<type>hvm</type>
</os>
<devices>
<emulator>/usr/bin/qemu-system-aarch64</emulator>
</devices>
</domain>
# virsh create test.xml
error: Failed to create domain from test.xml
error: internal error: process exited while connecting to monitor:
2023-04-05T20:36:19.564896Z qemu-system-aarch64: Property
'integratorcp-machine.acpi' not found
For reference, the qemu cmdline produced by libvirt:
/usr/bin/qemu-system-aarch64 \
-name guest=test,debug-threads=on \
-S \
-object
'{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain-1-test/master-key.aes"}'
\
-machine integratorcp,usb=off,dump-guest-core=off,memory-backend=integrator.ram \
-accel kvm \
-m 2048 \
-object
'{"qom-type":"memory-backend-ram","id":"integrator.ram","size":2147483648}'
\
-overcommit mem-lock=off \
-smp 1,sockets=1,cores=1,threads=1 \
-uuid e6620a77-ca1c-476a-936e-d1c2d3bf0a49 \
-display none \
-no-user-config \
-nodefaults \
-chardev socket,id=charmonitor,fd=32,server=on,wait=off \
-mon chardev=charmonitor,id=monitor,mode=control \
-rtc base=utc \
-no-shutdown \
-no-acpi \
-boot strict=on \
-usb \
-audiodev
'{"id":"audio1","driver":"none"}' \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
-msg timestamp=on
IMO, this is the first reason we should consider changing the default. For the
second, do any board types other than virt support kvm acceleration? It appears
to be the only one
https://www.qemu.org/docs/master/system/target-arm.html
I guess it's a slippery slope. The virt board also requires specifying a cpu
model, with the only reasonable values being host and max
https://www.qemu.org/docs/master/system/arm/cpu-features.html#a-note-abou...
In fact, that doc implies host is the only choice: "but mostly if KVM is enabled
the host CPU type must be used". The status quo may by fine for domain type
qemu, but it seems there's room for improvement for kvm domains.
Regards,
Jim