summaryrefslogtreecommitdiffstats
path: root/meta/conf/machine/qemuarm.conf
diff options
context:
space:
mode:
authorHongxu Jia <hongxu.jia@windriver.com>2018-10-29 22:22:49 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-11-14 11:14:40 +0000
commitbc0d9a1a5e6c56302be8ba9b37a66b90ac941056 (patch)
tree1ef378161755bc6649771b0a0081624b2762f58a /meta/conf/machine/qemuarm.conf
parent81fc280bae13c573d8b82b05ad5eb18e7882ad24 (diff)
downloadpoky-bc0d9a1a5e6c56302be8ba9b37a66b90ac941056.tar.gz
machine/qemu*: fix kernel finish crng init more and more slowly
Just adding `-device virtio-rng-pci' to the QEMU invocation will add the device with a default host backend. As of QEMU 1.3+, the default backend is to use the host's /dev/random as a source of entropy. [1] When the entropy pool is empty, reads from /dev/random will block until additional environmental noise is gathered. [2] For Yocto, if call runqemu frequently, it will consume lots of host's /dev/random, and kernel finish crng init in guest get more and more slowly. Here are 4 times runqemu boot test: [ 3.464432] random: crng init done [ 20.874030] random: crng init done [ 23.583589] random: crng init done [ 23.858945] random: crng init done Modify entropy source to /dev/urandom device on the host which returns random bytes using a pseudorandom number generator seeded from the entropy pool. Reads from this device do not block and kernel finish crng init in guest will not delay. Of course, the side effect is obviously, we lost the quality of randomness, but the modification is only on runqemu script rather than real embedded device, and it benefits oeqa efficiency in which many cases call runqemu especially multiple oeqa builds on one host. After apply the fix: [ 3.364670] random: crng init done [ 4.619061] random: crng init done [ 3.403897] random: crng init done [ 3.450717] random: crng init done [1] https://wiki.qemu.org/Features/VirtIORNG [2] http://man7.org/linux/man-pages/man4/random.4.html (From OE-Core rev: 853644f82eb3205ef3efc1ea3959c7225dfacf61) Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/conf/machine/qemuarm.conf')
-rw-r--r--meta/conf/machine/qemuarm.conf3
1 files changed, 2 insertions, 1 deletions
diff --git a/meta/conf/machine/qemuarm.conf b/meta/conf/machine/qemuarm.conf
index d2f2c85c3f..a544312627 100644
--- a/meta/conf/machine/qemuarm.conf
+++ b/meta/conf/machine/qemuarm.conf
@@ -14,7 +14,8 @@ SERIAL_CONSOLES ?= "115200;ttyAMA0 115200;ttyAMA1"
14QB_SYSTEM_NAME = "qemu-system-arm" 14QB_SYSTEM_NAME = "qemu-system-arm"
15QB_MACHINE = "-machine versatilepb" 15QB_MACHINE = "-machine versatilepb"
16QB_KERNEL_CMDLINE_APPEND = "console=ttyAMA0,115200 console=tty" 16QB_KERNEL_CMDLINE_APPEND = "console=ttyAMA0,115200 console=tty"
17QB_OPT_APPEND = "-show-cursor -usb -device usb-tablet"
17# Add the 'virtio-rng-pci' device otherwise the guest may run out of entropy 18# Add the 'virtio-rng-pci' device otherwise the guest may run out of entropy
18QB_OPT_APPEND = "-show-cursor -usb -device usb-tablet -device virtio-rng-pci" 19QB_OPT_APPEND += "-object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0"
19PREFERRED_VERSION_linux-yocto ??= "4.18%" 20PREFERRED_VERSION_linux-yocto ??= "4.18%"
20QB_DTB = "${@oe.utils.version_less_or_equal('PREFERRED_VERSION_linux-yocto', '4.7', '', 'zImage-versatile-pb.dtb', d)}" 21QB_DTB = "${@oe.utils.version_less_or_equal('PREFERRED_VERSION_linux-yocto', '4.7', '', 'zImage-versatile-pb.dtb', d)}"