Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177705390
D61709.1795086565.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D61709.1795086565.diff
View Options
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
@@ -2929,9 +2929,14 @@
case EXIT_REASON_VMXOFF:
case EXIT_REASON_VMXON:
SDT_PROBE3(vmm, vmx, exit, vminsn, vmx, vcpuid, vmexit);
- vmexit->exitcode = VM_EXITCODE_VMINSN;
- if (vcpu->nested != NULL)
+ if (vcpu->nested != NULL) {
vmx_nested_insn_exit(vcpu, reason, qual);
+ if (vmx_nested_insn_fast(vcpu)) {
+ handled = HANDLED;
+ break;
+ }
+ }
+ vmexit->exitcode = VM_EXITCODE_VMINSN;
break;
case EXIT_REASON_INVD:
case EXIT_REASON_WBINVD:
diff --git a/sys/amd64/vmm/intel/vmx_nested.h b/sys/amd64/vmm/intel/vmx_nested.h
--- a/sys/amd64/vmm/intel/vmx_nested.h
+++ b/sys/amd64/vmm/intel/vmx_nested.h
@@ -84,6 +84,7 @@
struct vmx_nested *vmx_nested_alloc(void);
void vmx_nested_free(struct vmx_nested *nested);
int vmx_nested_rdmsr(u_int num, uint64_t *val);
+bool vmx_nested_insn_fast(struct vmx_vcpu *vcpu);
int vmx_nested_exit(struct vmx_vcpu *vcpu);
#endif
diff --git a/sys/amd64/vmm/intel/vmx_nested.c b/sys/amd64/vmm/intel/vmx_nested.c
--- a/sys/amd64/vmm/intel/vmx_nested.c
+++ b/sys/amd64/vmm/intel/vmx_nested.c
@@ -1317,6 +1317,24 @@
}
}
+/*
+ * VMREAD and VMWRITE with a register operand, which are most of the VMX
+ * instructions that a hypervisor executes, need nothing that can sleep and
+ * are emulated without leaving vmx_run(). Returns false for the rest.
+ */
+bool
+vmx_nested_insn_fast(struct vmx_vcpu *vcpu)
+{
+ const struct vmx_nested_insn *insn = &vcpu->nested->insn;
+
+ if ((insn->reason != EXIT_REASON_VMREAD &&
+ insn->reason != EXIT_REASON_VMWRITE) ||
+ (insn->inst_info & INST_INFO_IS_REG) == 0)
+ return (false);
+ nested_insn(vcpu);
+ return (true);
+}
+
/*
* A VMX instruction of L1 or a VM exit of L2, both VM_EXITCODE_VMINSN, with
* the vCPU frozen: L1's memory can be accessed and its registers set.
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 19, 11:09 AM (16 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41843894
Default Alt Text
D61709.1795086565.diff (1 KB)
Attached To
Mode
D61709: vmm: Emulate VMREAD and VMWRITE without leaving vmx_run()
Attached
Detach File
Event Timeline