I am trying sylve as a vm/jail manager. I am running FreeBSD 15.1-RELEASE on my N150 based Beelink Mini ME with the latest version of sylve (vers 0.2.3.4). My bhyve vm under this configuration is running OPNsense 26.7.1_1 (also FreeBSD 15.1). The settings in sylve are sockets=1, cores=4, threads=1, which matches the physical configuration of my N150 Intel processor. When I boot the OPNsense vm, it only recognizes 2 cores with 2 thread per core. I have performed the following diagnostic steps:
1. Verified the right topology in the host using sysctl
2. Verified the proper arguments are being passed by libvirt when creating the vm by examining /var/log/libvirt/bhyve/100.log (100 is the vm number)
3. Verified that the host allows creation of virtual machines with 4 virtual cpus using sysctl
4. This is the result in the OPNsense vm examining sysctl output
5. I tried disabling hyperthreading in the vm by setting the machdep.hyperthreading_allowed=0. The result was the vm only recognized 2 cores with 1 thread per core (2 vcpus).
When examining the scheduling behavior using top -P in the OPNsense vm with 2 cores, 2 threads per core, the cpu load is weighted to the 2 cpus the vm thinks are physical cores with very little activity occurring on the hyperthread cores. I assume this is due to the schedulers knowledge that the 2 hyperthread cores are not real independent execution units.
Any help in debugging and resolving this issue would be greatly appreciated.
1. Verified the right topology in the host using sysctl
Code:
kern.smp.topology: 0
kern.smp.cores: 4
kern.smp.threads_per_core: 1
kern.smp.cpus: 4
kern.sched.topology_spec: <groups>
<group level="1" cache-level="3">
<cpu count="4" mask="f,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0">0, 1, 2, 3</cpu>
</group>
</groups>
Code:
bhyve -c cpus=4,sockets=1,cores=4,threads=1 -m 2048 -S -H -P -s 0:0,hostbridge -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd,/var/db/sylve/vms/100/100_vars.fd -s 2:0,xhci,tablet -s 1:0,lpc -s 3:0,virtio-net,tap0,mac=ba:97:78:fd:81:ea -s 4:0,virtio-net,tap1,mac=86:0d:5a:76:96:30 -s 5:0,virtio-net,tap2,mac=aa:27:40:11:1c:ce -s 6:0,virtio-net,tap3,mac=fe:53:c0:18:a4:e4 -s 12,virtio-console,org.qemu.guest_agent.0=/var/db/sylve/vms/100/qga.sock -s 13:0,passthru,1/0/0 -s 14:0,fbuf,tcp=127.0.0.1:5957,w=1280,h=960,password=simple-become-thought-coward-reflection-joy -s 10:0,nvme,/dev/zvol/zroot/sylve/virtual-Verified that machines/100/zvol-5 100
Code:
hw.vmm.maxcpu: 4
Code:
ern.smp.topology: 0
kern.smp.cores: 2
kern.smp.threads_per_core: 2
kern.smp.cpus: 4
kern.sched.topology_spec: <groups>
<group level="1" cache-level="3">
<cpu count="4" mask="f,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0">0, 1, 2, 3</cpu>
<children>
<group level="2" cache-level="2">
<cpu count="2" mask="3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0">0, 1</cpu>
<flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
</group>
<group level="2" cache-level="2">
<cpu count="2" mask="c,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0">2, 3</cpu>
<flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
</group>
</children>
</group>
</groups>
When examining the scheduling behavior using top -P in the OPNsense vm with 2 cores, 2 threads per core, the cpu load is weighted to the 2 cpus the vm thinks are physical cores with very little activity occurring on the hyperthread cores. I assume this is due to the schedulers knowledge that the 2 hyperthread cores are not real independent execution units.
Any help in debugging and resolving this issue would be greatly appreciated.