From: Tim Deegan Subject: Re: [PATCH 10/11] x86/altp2m: fix log-dirty handling. Date: Thu, 15 Jan 2015 18:20:21 +0100 Message-ID: <20150115172021.GI57240@deinos.phlegethon.org> References: <1420838801-11704-1-git-send-email-edmund.h.white@intel.com> <1420838801-11704-11-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: Content-Disposition: inline In-Reply-To: <1420838801-11704-11-git-send-email-edmund.h.white@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 Hi, The locking chages look OK at first glance, but... At 13:26 -0800 on 09 Jan (1420806400), Ed White wrote: > @@ -793,6 +793,10 @@ int p2m_change_type_one(struct domain *d, unsigned long gfn, > > gfn_unlock(p2m, gfn, 0); > > + if ( pt == ot && altp2mhvm_active(d) ) > + /* make sure this page isn't valid in any alternate p2m */ > + p2m_remove_altp2m_page(d, gfn); > + > return rc; > } ...this is the wrong level to be making this change at. The hook needs to be right at the bottom, in atomic_write_ept_entry() (and hap_write_p2m_entry() for AMD, I think), to catch _every_ update of a p2m entry in the host p2m. Otherwise a guest frame could be removed entirely and the altp2m would still map it. Or am I missing some other path that handles that case? nested-p2m handles this by failry aggressively flushing nested p2m tabvles but that doesn't sounds suitable for this since there's state in the alt-p2m that needs to be retained. Cheers, Tim.