On Feb 19, 2025, at 05:24, Jason Bacon <bacon4...@gmail.com> wrote:
> 
> On 2/18/25 20:13, Mark Millard wrote:
>> Something I possibly should have done --but did not do was to set:
>> kern.hz=100
> 
> I stopped doing this under VirtualBox a few years ago, because it was causing 
> clock skew.  Apparently an assumption of 1000 was hard-coded into the FreeBSD 
> kernel at a couple places.  Not sure if this has been fixed.

If anyone is using an aarch64 VM, it may not be obvious if FreeBSD
is "aware" of running in a VM. For Parallels, the detection of the
VM for an amd64(/i386) VM does not work for an aarch64 Parallels
VM.

Folks using aarch64 VMs (or other non-amd64/i386 VMs) may want to
check on the status of (using my Parallels context as an example):

# kenv smbios.system.product
Parallels ARM Virtual Machine

# sysctl kern.vm_guest
kern.vm_guest: none

# sysctl kern.hz
kern.hz: 1000

The "none" and "1000" indicate a lack of FreeBSD having any
status indicating it is running in a VM.

In this case, the detection would be via smbios.system.product
content. Other VM contexts might also have distinct names for
ARM (or other) contexts compared to the historical amd64/i386
ones.

sys/dev/smbios/smbios_subr.c has:

static const struct {
      const char      *vm_pname;
      int             vm_guest;
} vm_pnames[] = {
      { "VMware Virtual Platform",    VM_GUEST_VMWARE },
      { "Virtual Machine",            VM_GUEST_VM }, /* Microsoft VirtualPC */
      { "QEMU Virtual Machine",       VM_GUEST_VM },
      { "VirtualBox",                 VM_GUEST_VBOX },
      { "Parallels Virtual Platform", VM_GUEST_PARALLELS },
      { "KVM",                        VM_GUEST_KVM },
};

None of those names are explicit about aarch64 or ARM or the
like but Parallels' naming is explicit vs. amd64/i386.
Parallels might not be the only context to make such a
distinction.

Some detections are not via this smbios.system.product text
matching. So kern.vm_guest and kern.hz may indicate having
the under-VM status recording set up, even if there is no
text match for smbios.system.product .

Going the other way for Jason's note: It may not be obvious
if kern.hz is already set to 100, even if you do not want it
set that way.

Another example might be if new VM contexts should be added,
such as UTM for macOS. What do kenv smbios.system.product ,
sysctl kern.vm_guest , and sysctl kern.hz report for UTM on:

) amd64 macOS
) aarch64 macOS
) . . . ?

===
Mark Millard
marklmi at yahoo.com


Reply via email to