Source: qemu
Severity: wishlist

Hi.

I find myself sometimes running qemu-system-x86_64 and only minutes
later that something is kind of fast, but not super fast.
This usually is when I try complex desktop environments,
and I always attributed this to use of software rasterizer
in Mesa, and lack of virtgl.

But in fact I was simply assuming that qemu is using kvm by default
these days, even if -enable-kvm is not provided on command line.
And that assumption was wrong.

I wish qemu-system (and qemu-user) used kvm automatically.

Try to open /dev/kvm and if it successes just assume kvm to be used, if
it exist but can't be used, i.e. due to permissions emit a small warning
about callback CPU emulation. If runnig as superuser, emit an error and exit.

If -disable-kvm is used do not attempt to do that.

If explicit -enable-kvm is used and kvm fails (no kvm or kvm support not
built into binary, or missing kvm support on specific architecture), emit
an error and exit.

If -cpu XYZ or -machine xyz is used, or smp beyond what can be done on a 
machine,
and kvm can't be used, emit a warning to stderr approprietly
about using qemu emulation. If -disable-kvm is used, do not emit warning.
If -enable-kvm is used, and kvm fails, emit an error and exit.

To extend the wishlist, one could think about stuff like global config.
/etc/qemu.conf could be also used for defaults, with default ones being
cpu=host, enable-kvm, memory=xyz, smp=$(some_sane_number bigger than 1).
And if a user wants they can modify it to add proper  sound=ac97, [x86]
net=nic,model=virtio, etc, to simply invokation of qemu by default.
Configuration could have global, native and per-forgeing-target arch
sections.


Similalry I wish the default for qemu (when using with -kernel and
-initrd parameters), and use virtio-net-pci, virtio-blk,
virtio-scsi-pci (when passing block devices), virtio-serial-pci,
virtio-rng-pci by default. This is because when using -kernel most of the
time we are booting Linux, and most of the time we will have a virtio
support on a guest side (if new virtio device is introduced only enable
it by default after reasonable time ~2 years). Or a flag like
-virtio-all, to enable all virtio types on a host instead of specificing
a page long list of commands. Surely this can be done, but require a bit
more research and care to not make existing users of qemu break.


This would make use of manual flags unecassary in 95% of cases. I
personally never had a problem with kvm, that made me need to disable it.


I understand this might be going beyond what Debian can provide (that is
why the bug is about only kvm autodetection), but I hope I am not the
only one wanting this in qemu. Especially new users of qemu is going to
appreciate it.

Regards,
Witold



-- System Information:
Debian Release: buster/sid
  APT prefers testing-debug
  APT policy: (500, 'testing-debug'), (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.18.0-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Reply via email to