-/* $OpenBSD: vmm.c,v 1.327 2022/11/08 18:08:43 mlarkin Exp $ */
+/* $OpenBSD: vmm.c,v 1.328 2022/11/08 19:18:47 dlg Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
{
struct vm *vm;
struct vcpu *vcpu;
+ struct cpu_info *ci;
int error, ret = 0;
/* Find the desired VM */
}
vcpu->vc_intr = vip->vip_intr;
+ ci = READ_ONCE(vcpu->vc_curcpu);
+ if (ci != NULL)
+ x86_send_ipi(ci, X86_IPI_NOP);
refcnt_rele_wake(&vcpu->vc_refcnt);
out:
}
}
+ WRITE_ONCE(vcpu->vc_curcpu, curcpu());
/* Run the VCPU specified in vrp */
if (vcpu->vc_virt_mode == VMM_MODE_VMX ||
vcpu->vc_virt_mode == VMM_MODE_EPT) {
vcpu->vc_virt_mode == VMM_MODE_RVI) {
ret = vcpu_run_svm(vcpu, vrp);
}
+ WRITE_ONCE(vcpu->vc_curcpu, NULL);
atomic_dec_int(&vm->vm_vcpus_running);
if (ret == 0 || ret == EAGAIN) {
-/* $OpenBSD: vmmvar.h,v 1.81 2022/09/01 22:01:40 dv Exp $ */
+/* $OpenBSD: vmmvar.h,v 1.82 2022/11/08 19:18:47 dlg Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
struct rwlock vc_lock;
struct refcnt vc_refcnt; /* [a] */
+ struct cpu_info *vc_curcpu; /* [a] */
struct cpu_info *vc_last_pcpu; /* [v] */
struct vm_exit vc_exit; /* [v] */