From: Tim Deegan Subject: Re: [PATCH 02/11] VMX: implement suppress #VE. Date: Fri, 16 Jan 2015 18:22:32 +0100 Message-ID: <20150116172232.GB48064@deinos.phlegethon.org> References: <1420838801-11704-1-git-send-email-edmund.h.white@intel.com> <1420838801-11704-3-git-send-email-edmund.h.white@intel.com> <20150115162506.GB57240@deinos.phlegethon.org> <54B80B1A.3050707@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <54B80B1A.3050707@intel.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ed White Cc: keir@xen.org, ian.jackson@eu.citrix.com, ian.campbell@citrix.com, jbeulich@suse.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org At 10:46 -0800 on 15 Jan (1421315210), Ed White wrote: > On 01/15/2015 08:25 AM, Tim Deegan wrote: > > Hi, > > > > At 13:26 -0800 on 09 Jan (1420806392), Ed White wrote: > >> static inline bool_t is_epte_valid(ept_entry_t *e) > >> { > >> - return (e->epte != 0 && e->sa_p2mt != p2m_invalid); > >> + return (e->valid != 0 && e->sa_p2mt != p2m_invalid); > > > > This test for 0 is just catching uninitialised entries in freshly > > allocated pages. Rather than changing it to ignore bit 63, this loop... > > > >> } > >> > >> /* returns : 0 for success, -errno otherwise */ > >> @@ -194,6 +194,19 @@ static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry) > >> > >> ept_entry->r = ept_entry->w = ept_entry->x = 1; > >> > >> + /* Disable #VE on all entries */ > >> + if ( cpu_has_vmx_virt_exceptions ) > >> + { > >> + ept_entry_t *table = __map_domain_page(pg); > >> + > >> + for ( int i = 0; i < EPT_PAGETABLE_ENTRIES; i++ ) > >> + table[i].suppress_ve = 1; > > > > ...should set the type of the empty entries to p2m_invalid as it goes. > > > >> + /* Disable #VE on all entries */ > >> + if ( cpu_has_vmx_virt_exceptions ) > >> + { > >> + ept_entry_t *table = > >> + map_domain_page(pagetable_get_pfn(p2m_get_pagetable(p2m))); > >> + > >> + for ( int i = 0; i < EPT_PAGETABLE_ENTRIES; i++ ) > >> + table[i].suppress_ve = 1; > > > > And the same here. > > You mean do that unconditionally, regardless of hardware #VE? Yes, I think that would be OK, and make for slightly cleaner code. If you prefer, you can set the type only for #VE hardware and leave the 'e->epte != 0' test as it is. Cheers, Tim.