From nobody Sat Mar 18 16:29:08 2023 X-Original-To: freebsd-virtualization@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pf5zs3BWlz3ylbd for ; Sat, 18 Mar 2023 16:29:13 +0000 (UTC) (envelope-from mad@madpilot.net) Received: from mail.madpilot.net (vogon.madpilot.net [159.69.1.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Pf5zr2Wz5z3Grn for ; Sat, 18 Mar 2023 16:29:12 +0000 (UTC) (envelope-from mad@madpilot.net) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=madpilot.net header.s=bjowvop61wgh header.b="J pqiVV3"; spf=pass (mx1.freebsd.org: domain of mad@madpilot.net designates 159.69.1.99 as permitted sender) smtp.mailfrom=mad@madpilot.net; dmarc=pass (policy=quarantine) header.from=madpilot.net Received: from mail (mail [192.168.254.3]) by mail.madpilot.net (Postfix) with ESMTP id 4Pf5zq0r6Jz6ddR; Sat, 18 Mar 2023 17:29:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=madpilot.net; h= content-transfer-encoding:content-type:content-type:in-reply-to :content-language:references:from:from:subject:subject:date:date :message-id:received; s=bjowvop61wgh; t=1679156949; x= 1680971350; bh=SMD/qVztp//05j+/VTM3S5YSooYMu/BgjEiBMbKlCJA=; b=J pqiVV3LG8dIteNDDX28wrrcvDXQWiIzkKYHkv5KfPbW3j1QS8nspPvSz3K/xPh3k c3JjKMt5ETJtjOQSQ5FyKOlSUHlxBnYNK5rUg+lr2VzXns0poUUnlWtKuGaPapYh ggct600x2x8F9T2JEP6lAiayqEUodid2MLO5RHPT+MGReJJabf73xYLtzATK3NXC I8IFl3qVNFkcacR9cVoq/baLyliaEeIZLqM6toLls5vJ8fyqq8ma4dbL/u2hN0JL hob7HMv/2AGpJQx8njaIIcyY7YMWlcd+FRT87YKvn3eiEJw2Qnnfwp8GG6FBXcGv 2xnXrc5TGp5Aeaxta1sZQ== Received: from mail.madpilot.net ([192.168.254.3]) by mail (mail.madpilot.net [192.168.254.3]) (amavisd-new, port 10026) with ESMTP id QHE3BBPuSzwj; Sat, 18 Mar 2023 17:29:09 +0100 (CET) Message-ID: <80da3a32-4c4c-5135-88b5-99419709ede9@madpilot.net> Date: Sat, 18 Mar 2023 17:29:08 +0100 Subject: Re: Bhyve process consumes way too much CPU From: Guido Falsi To: =?UTF-8?Q?Julie_Koubov=c3=a1?= , freebsd-virtualization@freebsd.org References: Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spamd-Result: default: False [-1.99 / 15.00]; MISSING_MIME_VERSION(2.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.99)[-0.992]; DMARC_POLICY_ALLOW(-0.50)[madpilot.net,quarantine]; R_SPF_ALLOW(-0.20)[+mx]; R_DKIM_ALLOW(-0.20)[madpilot.net:s=bjowvop61wgh]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; MLMMJ_DEST(0.00)[freebsd-virtualization@freebsd.org]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[madpilot.net:+]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; TO_DN_SOME(0.00)[]; ASN(0.00)[asn:24940, ipnet:159.69.0.0/16, country:DE]; RCVD_COUNT_THREE(0.00)[3]; MID_RHS_MATCH_FROM(0.00)[] X-Rspamd-Queue-Id: 4Pf5zr2Wz5z3Grn X-Spamd-Bar: - X-ThisMailContainsUnwantedMimeParts: N List-Id: Discussion List-Archive: https://lists.freebsd.org/archives/freebsd-virtualization List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-virtualization@freebsd.org X-BeenThere: freebsd-virtualization@freebsd.org 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