From nobody Sun Mar 19 18:12:11 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 4PfmDP3WCdz40VHk for ; Sun, 19 Mar 2023 18:12:21 +0000 (UTC) (envelope-from SRS0=3sUP=7L=quip.cz=000.fbsd@elsa.codelab.cz) Received: from elsa.codelab.cz (elsa.codelab.cz [94.124.105.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4PfmDN2xnLz3F9Y for ; Sun, 19 Mar 2023 18:12:20 +0000 (UTC) (envelope-from SRS0=3sUP=7L=quip.cz=000.fbsd@elsa.codelab.cz) Authentication-Results: mx1.freebsd.org; dkim=none; spf=none (mx1.freebsd.org: domain of "SRS0=3sUP=7L=quip.cz=000.fbsd@elsa.codelab.cz" has no SPF policy when checking 94.124.105.4) smtp.mailfrom="SRS0=3sUP=7L=quip.cz=000.fbsd@elsa.codelab.cz"; dmarc=none Received: from elsa.codelab.cz (localhost [127.0.0.1]) by elsa.codelab.cz (Postfix) with ESMTP id 88186D788C; Sun, 19 Mar 2023 19:12:12 +0100 (CET) Received: from [192.168.145.50] (ip-89-177-27-225.bb.vodafone.cz [89.177.27.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by elsa.codelab.cz (Postfix) with ESMTPSA id D2BDCD7892; Sun, 19 Mar 2023 19:12:11 +0100 (CET) Message-ID: <343e827b-a1dc-b69b-9dcc-c6675deac070@quip.cz> Date: Sun, 19 Mar 2023 19:12:11 +0100 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 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: Bhyve process consumes way too much CPU To: =?UTF-8?Q?Julie_Koubov=c3=a1?= , freebsd-virtualization@freebsd.org References: Content-Language: cs-Cestina, en-US From: Miroslav Lachman <000.fbsd@quip.cz> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spamd-Result: default: False [-1.76 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; AUTH_NA(1.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.96)[-0.958]; FORGED_SENDER(0.30)[000.fbsd@quip.cz,SRS0=3sUP=7L=quip.cz=000.fbsd@elsa.codelab.cz]; MIME_GOOD(-0.10)[text/plain]; ASN(0.00)[asn:42000, ipnet:94.124.104.0/21, country:CZ]; MLMMJ_DEST(0.00)[freebsd-virtualization@freebsd.org]; RCVD_TLS_LAST(0.00)[]; R_SPF_NA(0.00)[no SPF record]; R_DKIM_NA(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; MIME_TRACE(0.00)[0:+]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FROM_HAS_DN(0.00)[]; DMARC_NA(0.00)[quip.cz]; TO_DN_SOME(0.00)[]; FROM_NEQ_ENVFROM(0.00)[000.fbsd@quip.cz,SRS0=3sUP=7L=quip.cz=000.fbsd@elsa.codelab.cz] X-Rspamd-Queue-Id: 4PfmDN2xnLz3F9Y X-Spamd-Bar: - X-ThisMailContainsUnwantedMimeParts: N On 18/03/2023 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. > > 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. I had similar problem few years ago. Never solved. Exhibited on bhyve and VirtualBox too. The problem was "the more vCPU for VM, the slower VM". Can you try to set just 1 vCPU to your VM? In my case, VM with 1 vCPU was fast, almost no overhead, 2 v CPUs slightly slower but 4 or more was slow as hell. I would also recommend not to overprovision real CPU core count to vCPU and not use multi/hyper threading cores as real cores. With your CPU, use only 4 cores to assign to all your VMs (4 VMs with 1 vCPU each, or 2 VMs with 2 vCPU each, 1 VM with 4 vCPU) Miroslav Lachman