aboutsummaryrefslogtreecommitdiff
path: root/sys/amd64/vmm/vmm_stat.h
diff options
context:
space:
mode:
authorNeel Natu <neel@FreeBSD.org>2013-03-16 22:40:20 +0000
committerNeel Natu <neel@FreeBSD.org>2013-03-16 22:40:20 +0000
commit61592433ebadb116cf225367506afed71492be35 (patch)
tree60811a41eb27a0a319975a387e911be77b3bc622 /sys/amd64/vmm/vmm_stat.h
parent99f23359a5fadf8007a6e88df9ddd77602835f7a (diff)
downloadsrc-61592433ebadb116cf225367506afed71492be35.tar.gz
src-61592433ebadb116cf225367506afed71492be35.zip
Allow vmm stats to be specific to the underlying hardware assist technology.
This can be done by using the new macros VMM_STAT_INTEL() and VMM_STAT_AMD(). Statistic counters that are common across the two are defined using VMM_STAT(). Suggested by: Anish Gupta Discussed with: grehan Obtained from: NetApp
Notes
Notes: svn path=/head/; revision=248389
Diffstat (limited to 'sys/amd64/vmm/vmm_stat.h')
-rw-r--r--sys/amd64/vmm/vmm_stat.h27
1 files changed, 24 insertions, 3 deletions
diff --git a/sys/amd64/vmm/vmm_stat.h b/sys/amd64/vmm/vmm_stat.h
index 7c075a6a7602..a1c096732a54 100644
--- a/sys/amd64/vmm/vmm_stat.h
+++ b/sys/amd64/vmm/vmm_stat.h
@@ -36,19 +36,36 @@ struct vm;
#define MAX_VMM_STAT_TYPES 64 /* arbitrary */
+enum vmm_stat_scope {
+ VMM_STAT_SCOPE_ANY,
+ VMM_STAT_SCOPE_INTEL, /* Intel VMX specific statistic */
+ VMM_STAT_SCOPE_AMD, /* AMD SVM specific statistic */
+};
+
struct vmm_stat_type {
- const char *desc; /* description of statistic */
int index; /* position in the stats buffer */
+ const char *desc; /* description of statistic */
+ enum vmm_stat_scope scope;
};
void vmm_stat_init(void *arg);
-#define VMM_STAT_DEFINE(type, desc) \
+#define VMM_STAT_DEFINE(type, desc, scope) \
struct vmm_stat_type type[1] = { \
- { desc, -1 } \
+ { -1, desc, scope } \
}; \
SYSINIT(type##_stat, SI_SUB_KLD, SI_ORDER_ANY, vmm_stat_init, type)
+#define VMM_STAT_DECLARE(type) \
+ extern struct vmm_stat_type type[1]
+
+#define VMM_STAT(type, desc) \
+ VMM_STAT_DEFINE(type, desc, VMM_STAT_SCOPE_ANY)
+#define VMM_STAT_INTEL(type, desc) \
+ VMM_STAT_DEFINE(type, desc, VMM_STAT_SCOPE_INTEL)
+#define VMM_STAT_AMD(type, desc) \
+ VMM_STAT_DEFINE(type, desc, VMM_STAT_SCOPE_AMD)
+
void *vmm_stat_alloc(void);
void vmm_stat_free(void *vp);
@@ -68,4 +85,8 @@ vmm_stat_incr(struct vm *vm, int vcpu, struct vmm_stat_type *vst, uint64_t x)
#endif
}
+VMM_STAT_DECLARE(VCPU_MIGRATIONS);
+VMM_STAT_DECLARE(VMEXIT_COUNT);
+VMM_STAT_DECLARE(VMEXIT_EXTINT);
+VMM_STAT_DECLARE(VMEXIT_HLT);
#endif