aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitaliy Gusev <gusev.vitaliy@gmail.com>2022-06-09 12:57:25 +0000
committerMark Johnston <markj@FreeBSD.org>2022-06-09 12:57:25 +0000
commite7d34aeda4e6fba68343dfcaf5e4aeed83a0ec87 (patch)
tree5541fd4e34c68424f984ef65fccf3bd880038c74
parent30031172534c22695ab7b26a9420bda7b20b0824 (diff)
vmm: move bumping VMEXIT_USERSPACE stat to the right place
Statistic for "number of vm exits handled in userspace" should be increased in vm_run() instead of vmx_run() because in some cases vm_run() doesn't exit to userspace and keeps entering the guest. Also svm_run's implementation even wrongly misses that stat. Reviewed by: markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D35350
-rw-r--r--sys/amd64/vmm/intel/vmx.c3
-rw-r--r--sys/amd64/vmm/vmm.c1
2 files changed, 1 insertions, 3 deletions
diff --git a/sys/amd64/vmm/intel/vmx.c b/sys/amd64/vmm/intel/vmx.c
index edb3653aff70..f1aea1d2a9db 100644
--- a/sys/amd64/vmm/intel/vmx.c
+++ b/sys/amd64/vmm/intel/vmx.c
@@ -3184,9 +3184,6 @@ vmx_run(void *arg, int vcpu, register_t rip, pmap_t pmap,
handled, vmexit->exitcode);
}
- if (!handled)
- vmm_stat_incr(vm, vcpu, VMEXIT_USERSPACE, 1);
-
VCPU_CTR1(vm, vcpu, "returning from vmx_run: exitcode %d",
vmexit->exitcode);
diff --git a/sys/amd64/vmm/vmm.c b/sys/amd64/vmm/vmm.c
index 2375dc0e13c4..47299301f5f0 100644
--- a/sys/amd64/vmm/vmm.c
+++ b/sys/amd64/vmm/vmm.c
@@ -1821,6 +1821,7 @@ restart:
if (error == 0 && retu == false)
goto restart;
+ vmm_stat_incr(vm, vcpuid, VMEXIT_USERSPACE, 1);
VCPU_CTR2(vm, vcpuid, "retu %d/%d", error, vme->exitcode);
/* copy the exit information */