From nobody Wed Oct 9 11:20:17 2024 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 4XNr651mTWz5YQ5s for ; Wed, 09 Oct 2024 11:20:29 +0000 (UTC) (envelope-from SRS0=jGWV=RF=freebsd.org=grehan@iredmail.onthenet.com.au) Received: from alto.onthenet.com.au (alto.OntheNet.com.au [203.13.68.12]) (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 4XNr614PXmz4Pr0 for ; Wed, 9 Oct 2024 11:20:24 +0000 (UTC) (envelope-from SRS0=jGWV=RF=freebsd.org=grehan@iredmail.onthenet.com.au) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=nt.com.au header.s=dkim header.b=qQ8Rpf50; spf=pass (mx1.freebsd.org: domain of "SRS0=jGWV=RF=freebsd.org=grehan@iredmail.onthenet.com.au" designates 203.13.68.12 as permitted sender) smtp.mailfrom="SRS0=jGWV=RF=freebsd.org=grehan@iredmail.onthenet.com.au"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=freebsd.org (policy=none) Received: from iredmail.onthenet.com.au (iredmail.onthenet.com.au [203.13.68.150]) by alto.onthenet.com.au (Postfix) with ESMTPS id 592C020B49AC for ; Wed, 9 Oct 2024 21:20:18 +1000 (AEST) Received: from iredmail.onthenet.com.au (iredmail.onthenet.com.au [127.0.0.1]) by iredmail.onthenet.com.au (Postfix) with ESMTP id 535D52127CB9 for ; Wed, 9 Oct 2024 21:20:18 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nt.com.au; h= content-transfer-encoding:content-type:content-type:in-reply-to :from:from:references:to:content-language:subject:subject :user-agent:mime-version:date:date:message-id; s=dkim; t= 1728472818; x=1731064819; bh=wlNrALY7DURxv7Xij0Y5eQ/k6wSkYNTfcMB zSO1Rfb4=; b=qQ8Rpf50LbSdIriPelD+qPcBmsqUdUHmhj/mCBjlHWiVYWL3tR+ LwxQAVMhu7nsjuG6q4tu1mQ/nT+mhIsgABGz0bXgl9hIftGQA6vHcB0zp+QdQHWa dQwpFbmlwsFVqN2O1AOq0JBAFrF2m5yyyt2ISok+vg4D82XuUfBwxYM0= Received: from iredmail.onthenet.com.au ([127.0.0.1]) by iredmail.onthenet.com.au (iredmail.onthenet.com.au [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id q7pGFfOcO9YS for ; Wed, 9 Oct 2024 21:20:18 +1000 (AEST) Received: from [192.168.1.101] (otn-120-29-24-249.broadband.onthenet.net [120.29.24.249]) by iredmail.onthenet.com.au (Postfix) with ESMTPSA id 2CC0D2127CB7; Wed, 9 Oct 2024 21:20:18 +1000 (AEST) Message-ID: <17f4077d-647d-4848-9d6f-97f9886ef636@freebsd.org> Date: Wed, 9 Oct 2024 21:20:17 +1000 List-Id: Discussion List-Archive: https://lists.freebsd.org/archives/freebsd-virtualization List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: freebsd-virtualization@freebsd.org Sender: owner-freebsd-virtualization@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Running Mezzano in bhyve Content-Language: en-US To: Vasily Postnicov References: Cc: freebsd-virtualization@freebsd.org From: Peter Grehan In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CMAE-Score: 0 X-CMAE-Analysis: v=2.4 cv=Fu4D/Xrq c=1 sm=1 tr=0 ts=670666f2 a=A6CF0fG5TOl4vs6YHvqXgw==:117 a=0UtLtLgMz4NvdyIsuxvgLw==:17 a=IkcTkHD0fZMA:10 a=DAUX931o1VcA:10 a=bi0XHdcepdgA:10 a=H7MLjYanAAAA:8 a=NEAV23lmAAAA:8 a=6I5d2MoRAAAA:8 a=mIvVm0WCNU7gLV3VHwkA:9 a=QEXdDO2ut3YA:10 a=f_Ahs_8vY64A:10 a=bgSlMGY6Cwri7Y-TTqhu:22 X-Spamd-Result: default: False [-3.28 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.99)[-0.992]; FORGED_SENDER(0.30)[grehan@freebsd.org,SRS0=jGWV=RF=freebsd.org=grehan@iredmail.onthenet.com.au]; R_SPF_ALLOW(-0.20)[+ip4:203.13.68.0/24]; R_DKIM_ALLOW(-0.20)[nt.com.au:s=dkim]; RCVD_IN_DNSWL_LOW(-0.10)[203.13.68.12:from]; RWL_MAILSPIKE_GOOD(-0.10)[203.13.68.12:from]; MIME_GOOD(-0.10)[text/plain]; DMARC_POLICY_SOFTFAIL(0.10)[freebsd.org : SPF not aligned (relaxed), DKIM not aligned (relaxed),none]; XM_UA_NO_VERSION(0.01)[]; ARC_NA(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; RCPT_COUNT_TWO(0.00)[2]; FREEMAIL_TO(0.00)[gmail.com]; RCVD_TLS_LAST(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; PREVIOUSLY_DELIVERED(0.00)[freebsd-virtualization@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FROM_NEQ_ENVFROM(0.00)[grehan@freebsd.org,SRS0=jGWV=RF=freebsd.org=grehan@iredmail.onthenet.com.au]; DKIM_TRACE(0.00)[nt.com.au:+]; MLMMJ_DEST(0.00)[freebsd-virtualization@freebsd.org]; TAGGED_RCPT(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; ASN(0.00)[asn:9313, ipnet:203.13.68.0/24, country:AU]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[] X-Rspamd-Queue-Id: 4XNr614PXmz4Pr0 X-Spamd-Bar: --- > Hi! Mezzano is an operating system written in Common lisp. I would like > to test it in bhyve. When I launch it, it spins infinitely in a loop > measuring how many CPU cycles it makes in a unit of time (I understood > it by adding various debug messages). > > The timer it uses is something called a PIT: > https://wiki.osdev.org/Programmable_Interval_Timer > > > The problem is, once the timer is configured it fires an interrupt only > once, while it obviously must fire interrupts constantly at some > frequency (100 Hz, as I understand from the code). > > Is the PIT supported by bhyve? Does FreeBSD use it anywhere in its kernel? Yes, though mode 3 of the timer isn't supported by the device emulation. It appears that Mezzano uses that mode https://github.com/froggey/Mezzano/blob/master/supervisor/x86-64/time.lisp#L20 Try this patch to the PIT code to see if it helps https://people.freebsd.org/~grehan/bhyve_vatpit.diff later, Peter.