svn commit: r253863 - projects/bhyve_npt_pmap/sys/amd64/vmm/intel
Neel Natu
neel at FreeBSD.org
Thu Aug 1 19:30:11 UTC 2013
Author: neel
Date: Thu Aug 1 19:30:10 2013
New Revision: 253863
URL: http://svnweb.freebsd.org/changeset/base/253863
Log:
Keep track of the cached value of 'pm_eptgen' for each host cpu.
This is necessary to make sure that we invalidate the nested page table
TLB entries correctly when a vcpu moves between host cpus.
Modified:
projects/bhyve_npt_pmap/sys/amd64/vmm/intel/vmx.h
projects/bhyve_npt_pmap/sys/amd64/vmm/intel/vmx_support.S
Modified: projects/bhyve_npt_pmap/sys/amd64/vmm/intel/vmx.h
==============================================================================
--- projects/bhyve_npt_pmap/sys/amd64/vmm/intel/vmx.h Thu Aug 1 18:06:58 2013 (r253862)
+++ projects/bhyve_npt_pmap/sys/amd64/vmm/intel/vmx.h Thu Aug 1 19:30:10 2013 (r253863)
@@ -71,7 +71,7 @@ struct vmxctx {
int launched; /* vmcs launch state */
int launch_error;
- long eptgen; /* cached pmap->pm_eptgen */
+ long eptgen[MAXCPU]; /* cached pmap->pm_eptgen */
/*
* The 'eptp' and the 'pmap' do not change during the lifetime of
Modified: projects/bhyve_npt_pmap/sys/amd64/vmm/intel/vmx_support.S
==============================================================================
--- projects/bhyve_npt_pmap/sys/amd64/vmm/intel/vmx_support.S Thu Aug 1 18:06:58 2013 (r253862)
+++ projects/bhyve_npt_pmap/sys/amd64/vmm/intel/vmx_support.S Thu Aug 1 19:30:10 2013 (r253863)
@@ -123,20 +123,21 @@
LK btrl %eax, PM_ACTIVE(%r11)
/*
- * If 'vmxctx->eptgen' is not identical to 'pmap->pm_eptgen' then
- * we must invalidate all mappings associated with this eptp.
+ * If 'vmxctx->eptgen[curcpu]' is not identical to 'pmap->pm_eptgen'
+ * then we must invalidate all mappings associated with this eptp.
*
* %rdi = vmxctx
- * %rax, %r11 = scratch registers
+ * %rax, %rbx, %r11 = scratch registers
*/
#define VMX_CHECK_EPTGEN \
+ movl PCPU(CPUID), %ebx; \
movq VMXCTX_PMAP(%rdi), %r11; \
movq PM_EPTGEN(%r11), %rax; \
- cmpq %rax, VMXCTX_EPTGEN(%rdi); \
+ cmpq %rax, VMXCTX_EPTGEN(%rdi, %rbx, 8); \
je 9f; \
\
- /* Refresh 'vmxctx->eptgen' */ \
- movq %rax, VMXCTX_EPTGEN(%rdi); \
+ /* Refresh 'vmxctx->eptgen[curcpu]' */ \
+ movq %rax, VMXCTX_EPTGEN(%rdi, %rbx, 8); \
\
/* Setup the invept descriptor at the top of tmpstk */ \
mov %rdi, %r11; \
More information about the svn-src-projects
mailing list