NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: NetBSD vs. VirtualBox



At Sat, 22 Aug 2026 07:40:19 -0000 (UTC), mlelstv%serpens.de@localhost (Michael van Elst) wrote:
Subject: Re: NetBSD vs. VirtualBox
>
> woods%planix.ca@localhost ("Greg A. Woods") writes:
>
> >I've probably also mentioned that so far I've been unable to get a
> >NetBSD VirtualBox VM to maintain anything even close to accurate time,
> >even with ntpd running.  Up for 15 minutes and it's already almost 3m
> >behind!
>
> Time keeping is a common problem of emulators.
>
> Maybe changing kern.timecounter.hardware helps.
> Virtualbox also has multiple options.
>
> As a wild guess (I'm not using virtualbox), enabling HPET
> in virtualbox and ensuring that the NetBSD timecounter
> is also using HPET sounds like a working option.

This is what I see initially:

kern.timecounter.choice = TSC(q=3000, f=3871211000 Hz) clockinterrupt(q=0, f=100 Hz) lapic(q=-100, f=1214876000 Hz) ichlpcib0(q=1000, f=3579545 Hz) hpet0(q=2000, f=14318180 Hz) ACPI-Safe(q=900, f=3579545 Hz) i8254(q=100, f=1193182 Hz) dummy(q=-1000000, f=1000000 Hz)
kern.timecounter.hardware = TSC
kern.timecounter.timestepwarnings = 1

When I force it to use hpet0 then things do indeed stabilize!  Thanks!

     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*xenful.local    206.108.0.131    2 u    7   64  377    0.500   +7.593   5.289
+xentastic.local 192.75.191.6     3 u    4   64  377    0.216   -1.812   5.165



As others have mentioned the VirtualBox guest extensions might have some
benefit for timekeeping, though last time I got close enough to the code
for this to see what it might be doing I was unconvinced.  The
documentation says "The Oracle VM VirtualBox Guest Additions ensure that
the guest's system time is synchronized with the host time.", and there
are various tuning parameters for this.  Dunno -- maybe it would help,
though just avoiding the TSC timecounter seems to work OK too.


BTW, under UTM/QEMU (running on the same Mac Pro as VB) I see:

kern.timecounter.choice = TSC(q=-100, f=3192000000 Hz) clockinterrupt(q=0, f=100 Hz) lapic(q=-100, f=400000000 Hz) ichlpcib0(q=1000, f=3579545 Hz) ACPI-Fast(q=1000, f=3579545 Hz) i8254(q=100, f=1193182 Hz) dummy(q=-1000000, f=1000000 Hz)
kern.timecounter.hardware = ACPI-Fast
kern.timecounter.timestepwarnings = 0

So there the TSC quality is downgraded and the best-quality timer is
ACPI-Fast (and HPET apparently isn't available in the emulation I'm
using).


> >wsdisplay0: screen 7 added (default, vt100 emulation)
>
> >wsconscfg: screen 0 is already configured
> >wsconscfg: WSDISPLAYIO_ADDSCREEN: Device not configured
> >wsconscfg: WSDISPLAYIO_ADDSCREEN: Device not configured
> >wsconscfg: WSDISPLAYIO_ADDSCREEN: Device not configured
> >wsconscfg: WSDISPLAYIO_ADDSCREEN: Device not configured
> >wsconscfg: WSDISPLAYIO_ADDSCREEN: Device not configured
> >wsconscfg: WSDISPLAYIO_ADDSCREEN: Device not configured
>
>
> That says that for screens 1-6 you configured an unknown type,
> that is the second argument to 'screen' in /etc/wscons.conf.
>
> The available types are driver specific and "-" means to
> use a driver default. The genfb driver knows only the
> screen type "default".

Hmmm.... OK, thanks to your hint I see what's happening now.

When I boot without running the "vesa 0x145" bootloader command then I
get vga(4), but when I do run it (manually, as I said it doesn't have
any effect from /boot.cfg), then I get genfb(4).  Now I also better
understand the source of that very disconcerting console font size
change when the genfb(4) driver is probed and attached.

I had no idea genfb(4) wasn't upwards compatible with vga(4)
w.r.t. supported screen "types".

Sadly the genfb(4) manual page is entirely silent about screen types,
not even documenting the "default" type you mention.

I see that I automatically get more rows and columns with a suitably
small font when I select a higher-resolution VESA mode (128 rows; 160
columns with 1280x1024 and with the "ibm" font).  However it would be
nice to be able to explicitly say what size terminal should be emulated,
with some/all of the same screen types as the old vga(4) driver
supports.

As wsconscfg(8)'s BUGS section says:

     There should be an easy way to get a list of the screen types available
     on a display, and of the emulations supported by the kernel.

But that still wouldn't make it easy to make a generic but useful
wscons.conf.

I've had the following in my general-use /etc/wscons.conf forever:

# Note:  You must uncomment the 'font ibm - 8' line to get a useful font for
#        any 50 line screens on vga(4) screens, and otherwise you may get what
#        appears to be a black-on-black display.
#
# - 50-line screens need fonts with a height of 8 pixels
# - 40-line screens need fonts with a height of 10 pixels.
#
#       name    width   height  enc     file
font    ibm     -       8       ibm     /usr/share/wscons/fonts/vt220l.808
font    ibm10   -       10      ibm     /usr/share/wscons/fonts/vt220l.810
font    ibm16   -       16      ibm     /usr/share/wscons/fonts/vt220l.816
#
# You could use the '80x50bf" screen type and also load the "pcvt08" font into
# the upper half of the extended character set, but doing so limits the number
# of colours to 8 instead of the standard 16.
#
# Note: the upper half of the "pcvt" encoded fonts are only useful
# with the "*bf" screen types of the "vga" driver.  The kernel must be
# compiled with the option "WSCONS_SUPPORT_PCVTFONTS" turned on.  See
# vga(4) and wsfontload(8).
#
#font   pcvt    -       -       pcvt    /usr/share/wscons/fonts/vt220h.816
#font   pcvt    -       8       pcvt    /usr/share/wscons/fonts/vt220h.808

# Font for central european languages (ISO 8859-2).
#  Uncomment to load. Needs to be explicitly enabled (see below).
#font   latin2  -       16      iso     /usr/share/wscons/fonts/latin2.816

# screens to create
#
# Available emulations depend on which wscons(4) WSEMUL_* kernel
# options have been used.  "vt100", "sun" and "dumb" are the ones
# currently supported in the driver, and which are available by
# default depends on which architcture is in use.
#
# Note the "vt100" emulation should be used with the "TERM=wsvt25" or
# "TERM=wsvt25m", especially for applications using NetBSD curses(3).
#
# See ega(4), vga(4), etc. for supported screen types.
#
#       index   type    emul
# N.B.:  Screen 0 is often already configured as console in most cases.
# leave this one as 80x25 just in case the font load fails
screen  0       80x25   vt100
screen  1       80x50   vt100
screen  2       80x50   vt100
screen  3       80x50   vt100
screen  4       80x50   vt100
screen  5       80x50   vt100
# also leave the last active one as 80x25 just in case the font load fails
screen  6       80x25   vt100
# Screen 7 is for the X11 server started by xdm (on vt08) to attach to
screen  7       -       -

and of course in /etc/ttys I have ttyE[1-6] (and constty) turned on and
Xdm configured to use vt08.

--
					Greg A. Woods <gwoods%acm.org@localhost>

Kelowna, BC     +1 250 762-7675           RoboHack <woods%robohack.ca@localhost>
Planix, Inc. <woods%planix.com@localhost>     Avoncote Farms <woods%avoncote.ca@localhost>

Attachment: pgp30w0VfgrIf.pgp
Description: OpenPGP Digital Signature



Home | Main Index | Thread Index | Old Index