diff --git a/sys/amd64/include/vmm.h b/sys/amd64/include/vmm.h --- a/sys/amd64/include/vmm.h +++ b/sys/amd64/include/vmm.h @@ -31,8 +31,12 @@ #ifndef _VMM_H_ #define _VMM_H_ +#include #include +#include +#include #include + #include struct vm_snapshot_meta; @@ -159,6 +163,7 @@ struct vm_eventinfo { void *rptr; /* rendezvous cookie */ + struct mtx *rmtx; /* rendezvous mtx */ int *sptr; /* suspend cookie */ int *iptr; /* reqidle cookie */ }; @@ -313,10 +318,17 @@ #endif /* _SYS__CPUSET_H_ */ static __inline int -vcpu_rendezvous_pending(struct vm_eventinfo *info) +vcpu_rendezvous_pending(struct vm_eventinfo *info, int vcpuid) { + bool pending; + + mtx_lock(info->rmtx); + + pending = CPU_ISSET(vcpuid, (cpuset_t*)info->rptr); + + mtx_unlock(info->rmtx); - return (*((uintptr_t *)(info->rptr)) != 0); + return pending; } static __inline int diff --git a/sys/amd64/vmm/amd/svm.c b/sys/amd64/vmm/amd/svm.c --- a/sys/amd64/vmm/amd/svm.c +++ b/sys/amd64/vmm/amd/svm.c @@ -2066,7 +2066,7 @@ break; } - if (vcpu_rendezvous_pending(evinfo)) { + if (vcpu_rendezvous_pending(evinfo, vcpu)) { enable_gintr(); vm_exit_rendezvous(vm, vcpu, state->rip); break; diff --git a/sys/amd64/vmm/intel/vmx.c b/sys/amd64/vmm/intel/vmx.c --- a/sys/amd64/vmm/intel/vmx.c +++ b/sys/amd64/vmm/intel/vmx.c @@ -3065,7 +3065,7 @@ break; } - if (vcpu_rendezvous_pending(evinfo)) { + if (vcpu_rendezvous_pending(evinfo, vcpu)) { enable_intr(); vm_exit_rendezvous(vmx->vm, vcpu, rip); break; diff --git a/sys/amd64/vmm/vmm.c b/sys/amd64/vmm/vmm.c --- a/sys/amd64/vmm/vmm.c +++ b/sys/amd64/vmm/vmm.c @@ -1755,7 +1755,8 @@ pmap = vmspace_pmap(vm->vmspace); vcpu = &vm->vcpu[vcpuid]; vme = &vcpu->exitinfo; - evinfo.rptr = &vm->rendezvous_func; + evinfo.rptr = &vm->rendezvous_req_cpus; + evinfo.rmtx = &vm->rendezvous_mtx; evinfo.sptr = &vm->suspend; evinfo.iptr = &vcpu->reqidle; restart: