Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Aug 2013 19:30:10 +0000 (UTC)
From:      Neel Natu <neel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r253863 - projects/bhyve_npt_pmap/sys/amd64/vmm/intel
Message-ID:  <201308011930.r71JUAkv012946@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;						\



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308011930.r71JUAkv012946>