From owner-svn-src-projects@FreeBSD.ORG Thu Aug 1 19:30:11 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 7DECF837; Thu, 1 Aug 2013 19:30:11 +0000 (UTC) (envelope-from neel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 516B22659; Thu, 1 Aug 2013 19:30:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r71JUBSN012949; Thu, 1 Aug 2013 19:30:11 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r71JUAkv012946; Thu, 1 Aug 2013 19:30:10 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201308011930.r71JUAkv012946@svn.freebsd.org> From: Neel Natu Date: Thu, 1 Aug 2013 19:30:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r253863 - projects/bhyve_npt_pmap/sys/amd64/vmm/intel X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Aug 2013 19:30:11 -0000 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; \