From owner-svn-src-all@FreeBSD.ORG Fri Dec 20 05:50:24 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0A554BC6; Fri, 20 Dec 2013 05:50:24 +0000 (UTC) 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 DFB391F4B; Fri, 20 Dec 2013 05:50:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBK5oNEk098490; Fri, 20 Dec 2013 05:50:23 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBK5oNmw098487; Fri, 20 Dec 2013 05:50:23 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201312200550.rBK5oNmw098487@svn.freebsd.org> From: Neel Natu Date: Fri, 20 Dec 2013 05:50:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r259641 - in head/sys/amd64: amd64 include vmm/intel X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Dec 2013 05:50:24 -0000 Author: neel Date: Fri Dec 20 05:50:22 2013 New Revision: 259641 URL: http://svnweb.freebsd.org/changeset/base/259641 Log: Re-arrange bits in the amd64/pmap 'pm_flags' field. The least significant 8 bits of 'pm_flags' are now used for the IPI vector to use for nested page table TLB shootdown. Previously we used IPI_AST to interrupt the host cpu which is functionally correct but could lead to misleading interrupt counts for AST handler. The AST handler was also doing a lot more than what is required for the nested page table TLB shootdown (EOI and IRET). Modified: head/sys/amd64/amd64/pmap.c head/sys/amd64/include/pmap.h head/sys/amd64/vmm/intel/ept.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Fri Dec 20 00:56:23 2013 (r259640) +++ head/sys/amd64/amd64/pmap.c Fri Dec 20 05:50:22 2013 (r259641) @@ -1295,6 +1295,7 @@ pmap_invalidate_page_pcid(pmap_t pmap, v static __inline void pmap_invalidate_ept(pmap_t pmap) { + int ipinum; sched_pin(); KASSERT(!CPU_ISSET(curcpu, &pmap->pm_active), @@ -1319,11 +1320,9 @@ pmap_invalidate_ept(pmap_t pmap) /* * Force the vcpu to exit and trap back into the hypervisor. - * - * XXX this is not optimal because IPI_AST builds a trapframe - * whereas all we need is an 'eoi' followed by 'iret'. */ - ipi_selected(pmap->pm_active, IPI_AST); + ipinum = pmap->pm_flags & PMAP_NESTED_IPIMASK; + ipi_selected(pmap->pm_active, ipinum); sched_unpin(); } Modified: head/sys/amd64/include/pmap.h ============================================================================== --- head/sys/amd64/include/pmap.h Fri Dec 20 00:56:23 2013 (r259640) +++ head/sys/amd64/include/pmap.h Fri Dec 20 05:50:22 2013 (r259641) @@ -312,9 +312,10 @@ struct pmap { }; /* flags */ -#define PMAP_PDE_SUPERPAGE (1 << 0) /* supports 2MB superpages */ -#define PMAP_EMULATE_AD_BITS (1 << 1) /* needs A/D bits emulation */ -#define PMAP_SUPPORTS_EXEC_ONLY (1 << 2) /* execute only mappings ok */ +#define PMAP_NESTED_IPIMASK 0xff +#define PMAP_PDE_SUPERPAGE (1 << 8) /* supports 2MB superpages */ +#define PMAP_EMULATE_AD_BITS (1 << 9) /* needs A/D bits emulation */ +#define PMAP_SUPPORTS_EXEC_ONLY (1 << 10) /* execute only mappings ok */ typedef struct pmap *pmap_t; Modified: head/sys/amd64/vmm/intel/ept.c ============================================================================== --- head/sys/amd64/vmm/intel/ept.c Fri Dec 20 00:56:23 2013 (r259640) +++ head/sys/amd64/vmm/intel/ept.c Fri Dec 20 05:50:22 2013 (r259641) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include "vmx_cpufunc.h" +#include "vmm_ipi.h" #include "vmx_msr.h" #include "ept.h" @@ -98,6 +99,8 @@ ept_init(void) !INVEPT_ALL_TYPES_SUPPORTED(cap)) return (EINVAL); + ept_pmap_flags = vmm_ipinum & PMAP_NESTED_IPIMASK; + use_superpages = 1; TUNABLE_INT_FETCH("hw.vmm.ept.use_superpages", &use_superpages); if (use_superpages && EPT_PDE_SUPERPAGE(cap))