Re: Bhyve process consumes way too much CPU

From: Guido Falsi <mad_at_madpilot.net>
Date: Sat, 18 Mar 2023 16:29:08 UTC
On 18/03/23 17:14, Guido Falsi wrote:
> 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.

BTW, I forgot to mention that any load average less than the number of 
available threads means the machine is not fully loaded, so 0.50 for a 4 
CPU, 8 threads machine is quite low by any measurements, while 0.50 on a 
machine with half the available CPUs/threads means double the actual 
load for that hardware. That should be accounted too.

-- 
Guido Falsi <mad@madpilot.net>