git: e7d34aeda4e6 - main - vmm: move bumping VMEXIT_USERSPACE stat to the right place
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 09 Jun 2022 13:08:18 UTC
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=e7d34aeda4e6fba68343dfcaf5e4aeed83a0ec87
commit e7d34aeda4e6fba68343dfcaf5e4aeed83a0ec87
Author: Vitaliy Gusev <gusev.vitaliy@gmail.com>
AuthorDate: 2022-06-09 12:57:25 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-06-09 12:57:25 +0000
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
---
sys/amd64/vmm/intel/vmx.c | 3 ---
sys/amd64/vmm/vmm.c | 1 +
2 files changed, 1 insertion(+), 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 */