mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-06 16:40:47 +00:00
vmm stat: Add a special nelems constant for arrays sized by vCPU count.
Reviewed by: corvink, markj Differential Revision: https://reviews.freebsd.org/D37170
This commit is contained in:
parent
58eefc67a1
commit
d5118d0fc4
|
@ -905,7 +905,7 @@ vlapic_calcdest(struct vm *vm, cpuset_t *dmask, uint32_t dest, bool phys,
|
|||
}
|
||||
}
|
||||
|
||||
static VMM_STAT_ARRAY(IPIS_SENT, VM_MAXCPU, "ipis sent to vcpu");
|
||||
static VMM_STAT_ARRAY(IPIS_SENT, VMM_STAT_NELEMS_VCPU, "ipis sent to vcpu");
|
||||
|
||||
static void
|
||||
vlapic_set_tpr(struct vlapic *vlapic, uint8_t val)
|
||||
|
|
|
@ -70,6 +70,9 @@ vmm_stat_register(void *arg)
|
|||
if (vst->scope == VMM_STAT_SCOPE_AMD && !vmm_is_svm())
|
||||
return;
|
||||
|
||||
if (vst->nelems == VMM_STAT_NELEMS_VCPU)
|
||||
vst->nelems = VM_MAXCPU;
|
||||
|
||||
if (vst_num_elems + vst->nelems >= MAX_VMM_STAT_ELEMS) {
|
||||
printf("Cannot accommodate vmm stat type \"%s\"!\n", vst->desc);
|
||||
return;
|
||||
|
|
|
@ -58,6 +58,8 @@ struct vmm_stat_type {
|
|||
|
||||
void vmm_stat_register(void *arg);
|
||||
|
||||
#define VMM_STAT_NELEMS_VCPU (-1)
|
||||
|
||||
#define VMM_STAT_FDEFINE(type, nelems, desc, func, scope) \
|
||||
struct vmm_stat_type type[1] = { \
|
||||
{ -1, nelems, desc, func, scope } \
|
||||
|
|
Loading…
Reference in a new issue