From: "Jan Beulich" Subject: Re: [PATCH v3 03/13] VMX: implement suppress #VE. Date: Thu, 09 Jul 2015 14:01:03 +0100 Message-ID: <559E8CAF020000780008EC87@mail.emea.novell.com> References: <1435774177-6345-1-git-send-email-edmund.h.white@intel.com> <1435774177-6345-4-git-send-email-edmund.h.white@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1435774177-6345-4-git-send-email-edmund.h.white@intel.com> Content-Disposition: inline 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: Tim Deegan , Ravi Sahita , Wei Liu , George Dunlap , Andrew Cooper , Ian Jackson , xen-devel@lists.xen.org, tlengyel@novetta.com, Daniel De Graaf List-Id: xen-devel@lists.xenproject.org >>> On 01.07.15 at 20:09, wrote: > @@ -232,6 +235,15 @@ static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry) > /* Manually set A bit to avoid overhead of MMU having to write it later. */ > ept_entry->a = 1; > > + ept_entry->suppress_ve = 1; > + > + table = __map_domain_page(pg); > + > + for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ ) > + table[i].suppress_ve = 1; > + > + unmap_domain_page(table); For the moment I can certainly agree to it being done this way, but it's inefficient and should be cleaned up: There shouldn't be two mappings of the page being allocated (one in hap_alloc() and the other being added here). I suppose the easiest would be to pass an optional callback pointer to p2m_alloc_ptp(). Or, to also cover the case below in ept_p2m_init() (i.e. p2m_alloc_table()) a new optional hook in struct p2m_domain could be added for that purpose. Albeit ... > @@ -1134,6 +1151,13 @@ int ept_p2m_init(struct p2m_domain *p2m) > p2m->flush_hardware_cached_dirty = ept_flush_pml_buffers; > } > > + table = map_domain_page(pagetable_get_pfn(p2m_get_pagetable(p2m))); > + > + for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ ) > + table[i].suppress_ve = 1; > + > + unmap_domain_page(table); ... why is this needed? Bit 63 is documented to be ignored in PML4Es (just like in all other intermediate page tables). Jan