[OE-core] [PATCH] machine/qemu*: fix kernel finish crng init more and more slowly

richard.purdie at linuxfoundation.org richard.purdie at linuxfoundation.org
Mon Oct 29 15:07:11 UTC 2018


On Fri, 2018-10-26 at 09:59 -0400, Hongxu Jia wrote:
> 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
> 
> Signed-off-by: Hongxu Jia <hongxu.jia at windriver.com>
> ---
>  meta/conf/machine/include/qemuboot-mips.inc | 3 ++-
>  meta/conf/machine/include/qemuboot-x86.inc  | 3 ++-
>  meta/conf/machine/qemuarm.conf              | 3 ++-
>  meta/conf/machine/qemuarm64.conf            | 4 +++-
>  meta/conf/machine/qemuppc.conf              | 3 ++-
>  5 files changed, 11 insertions(+), 5 deletions(-)

Doesn't work unfortunately, e.g.:

https://autobuilder.yoctoproject.org/typhoon/#/builders/21/builds/155/steps/7/logs/step1c


Cheers,

Richard






More information about the Openembedded-core mailing list