Re: Bhyve process consumes way too much CPU

From: Guido Falsi <mad_at_madpilot.net>
Date: Sat, 18 Mar 2023 16:14:58 UTC
On 18/03/23 14:59, Julie Koubová wrote:
> Hey everyone,
> 
> I'm running Linux (Home Assistant OS) in Bhyve on FreeBSD 13.1. I use 
> PCI passthrough to allow the VM to access a USB card with a couple of 
> radio dongles. The host machine is an Intel Core i3 13100 with 64 GB of 
> RAM. The CPU has 4 physical cores (8 hyper-threaded). The virtual 
> machine is assigned four cores.
> 
> The host load averages are 0.39 0.39 0.40 right now, which seems way too 
> much. The same workload was previously handled by a Raspberry Pi 4, and 
> the CPU usage there was under 10% when not doing anything special. 
> Inside the guest OS, the CPU usage is reported around 5%, which seems 
> reasonable.

I cannot give any definitive information, and know nothing about Home 
Assistant OS but I see a problem with your reasoning here, you're 
comparing CPU usage with system load, which is apples to oranges; they 
are measuring two different things (albeit related to each other).

It is quite possible to have a relatively high load with low CPU usage, 
in fact I think I can see that happen when using virtual machines, since 
they also have to handle their own internal interrupts and the like and 
will be often ready to run, adding to the load, but actually doing very 
little CPU work.

So you should compare load to load and CPU usage to CPU usage. In 
relation to a raspberry I expect load to not be significantly lower for 
this kind of work, but actual CPU usage to be noticeably lower, but not 
near zero.

> 
> What's wrong? How can I start debugging this issue? I use ZFS on the 
> host, vm-bhyve to manage the virtual machines, and I don't have a swap 
> partition.

ZFS is going to add some load too, since it is a very complex filesystem 
and does a lot of work behind the scenes. Especially if you're using 
file system compression.

-- 
Guido Falsi <mad@madpilot.net>