diff options
author | 2016-03-09 07:41:25 +0000 | |
---|---|---|
committer | 2016-03-09 07:41:25 +0000 | |
commit | 80f1a75c5c9ea33a77542f974c2bce16c2c3c02f (patch) | |
tree | d646e4d75f8071aa07c0488ddbc440aa277efc58 /sys | |
parent | rework how mpw(4) interacts with vlan(4) (diff) | |
download | wireguard-openbsd-80f1a75c5c9ea33a77542f974c2bce16c2c3c02f.tar.xz wireguard-openbsd-80f1a75c5c9ea33a77542f974c2bce16c2c3c02f.zip |
Induce an exit in a running vcpu if an interrupt is asserted (pending).
Needed for ongoing interrupt controller work.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/amd64/amd64/vmm.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/sys/arch/amd64/amd64/vmm.c b/sys/arch/amd64/amd64/vmm.c index 4637e2e4f12..1593aa8b06e 100644 --- a/sys/arch/amd64/amd64/vmm.c +++ b/sys/arch/amd64/amd64/vmm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmm.c,v 1.43 2016/03/08 08:43:50 mlarkin Exp $ */ +/* $OpenBSD: vmm.c,v 1.44 2016/03/09 07:41:25 mlarkin Exp $ */ /* * Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org> * @@ -594,6 +594,25 @@ vm_intr_pending(struct vm_intr_params *vip) vcpu->vc_intr = vip->vip_intr; +#ifdef MULTIPROCESSOR + /* + * If the vcpu is running on another PCPU, attempt to force it + * to exit to process the pending interrupt. This could race as + * it could be running when we do the check but be stopped by the + * time we send the IPI. In this case, there is a small extra + * overhead to process the IPI but no other side effects. + * + * There is also a chance that the vcpu may have interrupts blocked. + * That's ok as that condition will be checked on exit, and we will + * simply re-enter the guest. This "fast notification" is done only + * as an optimization. + */ + if (vcpu->vc_state == VCPU_STATE_RUNNING) { + x86_send_ipi(vcpu->vc_last_pcpu, X86_IPI_NOP); + } +#endif /* MULTIPROCESSOR */ + + return (0); } |