]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
vmm: fix missing ipi statistic
authorVitaliy Gusev <gusev.vitaliy@gmail.com>
Fri, 17 Mar 2023 09:17:22 +0000 (10:17 +0100)
committerCorvin Köhne <corvink@FreeBSD.org>
Fri, 17 Mar 2023 12:50:08 +0000 (13:50 +0100)
commit94a3876d7e18ada9596464623829d37d186da856
tree9cd05f8d1fa23041f6abfcf49efcff371f0c7615
parent949efdaa1db8cfe165760ebb78efd3e04ad1f758
vmm: fix missing ipi statistic

ipi counters are missing in bhyvectl's output because vm_maxcpu is 0
when initializing them. That's because vmm_stat_register is executed
before vmm_init.

Instead of directly fixing it, there's a better solution in illumos
which is cherry picked:
https://github.com/illumos/illumos-gate/commit/65a3bc83734e5fb0fc2c19df3e5112b87dcdc3f8

It replaces the matrix statistic by two counters per vcpu. One for
counting the ipis to the vcpu and one counting the ipis received by the
vcpu. This has several advantages:

- A matrix statistic becomes huge when using many vcpus.
- A matrix statistic easily reaches the MAX_VMM_STAT_ELEMS limit.
- Two counters are enough in most cases. DTrace can be used for more
  advanced debugging purposes.
- A matrix statistic wastes memory. The matrix size is determined by
  vm_maxcpu regardless of the number of vcpus assigned to the vm.

Reviewed by: corvink, markj
Fixes: ee98f99d7a68b284a669fefb969cbfc31df2d0ab ("vmm: Convert VM_MAXCPU into a loader tunable hw.vmm.maxcpu.")
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D39038
sys/amd64/vmm/io/vlapic.c
sys/amd64/vmm/vmm_stat.c
sys/amd64/vmm/vmm_stat.h