Clear VM boot up time increased after virtio-rng-pci initialized

Hi community!
Currently I was using the KVM-Legacy image to boot up Clear VMs on my Ubuntu single host server. But I found the boot up time increased significantly after one Clear VM created.

For instance, the first Clear VM only took 2 seconds to boot up, the second took 13 seconds, and the third one took 73 seconds! After some digging, I found it got stuck with virtio_rng_driver_init process during the booting.

Current Findings

  1. The more VMs with -device virtio-rng-pci running, the longer time would be taken to boot up Clear Linux with -device virtio-rng-pci initialized, but it wouldn’t take longer time to boot up non Clear Linux OS, such as CentOS and Ubuntu OS even with -device virtio-rng-pci . This issue only happened in Clear Linux OS.

  2. I found the -device virtio-rng-pci initialization time increased every time after booted up Clear Linux VMs

Reproduce The Issue In Standard Environment

  • Ubuntu 18.04.2 LTS, single host server

  • clear-29850-legacy-kvm.img, KVM Legacy image used, official image, no modification

  • apt-get install qemu-system libvirt-daemon libvirt-clients libvirt-bin

  • use start_qemu.sh to start the VM ( doesn’t share the same image, each VM has its own image)

*qemu-system-x86_64 *

*-enable-kvm *

*-smp sockets=1,cpus=1,cores=1 -cpu host *

*-m 1024 *

*-vga none -nographic *

*-drive file="$IMAGE",if=virtio,aio=threads,format=qcow2 *

*-device virtio-rng-pci *

-debugcon file:debug.log -global isa-debugcon.iobase=0x402 $@

I’m not sure if it’s related to my configuration, appreciate if you could share some ideas.

Thanks in advance!

Hey, welcome! Thanks for sharing your findings.
Is your Ubuntu host a physical system or is it a VM/cloud instance?

Hi,
It’s a physical server running in our lab. We usually use it as a host server to boot VMs.

Looks like entropy issues. Make sure you run rngd on the host?

https://wiki.qemu.org/Features/VirtIORNG

Is relevant. Please read the TODO section at the bottom about performance issues.

Thanks for the info! After I rebooted the physical server, I wasn’t able to reproduce this issue, at least for now…

Before Host Reboot
There’s no output for “cat /dev/hwrng”, in the guest system.

After Host Reboot
I can see output for “cat /dev/hwrng”, in the guest system. And the rngd service is not running on the host server.

I’ll keep monitoring it.

Thanks for your support!

hello, since I rebooted the host server, I wasn’t be able to reproduce this issue with Clear Linux image. But after the host server running for a while, the Clear Linux image booting up issue appeared again. I also tested with other OS image(ubuntu and centos), they all booted up normally unlike Clear Linux.

Appreciate if you could share some thoughts.

Thanks in advance.