From: "Jan Beulich" Subject: Re: [PATCH 6/8] x86/EPT: force re???evaluation of memory type as necessary Date: Thu, 27 Mar 2014 16:16:43 +0000 Message-ID: <53345CFB02000078000030BD@nat28.tlf.novell.com> References: <5332FF1902000078000027A2@nat28.tlf.novell.com> <5333020802000078000027F7@nat28.tlf.novell.com> <20140327130802.GH91759@deinos.phlegethon.org> <533450980200007800002FBD@nat28.tlf.novell.com> <20140327154833.GD91261@deinos.phlegethon.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WTCz1-0005hG-Jl for xen-devel@lists.xenproject.org; Thu, 27 Mar 2014 16:16:47 +0000 In-Reply-To: <20140327154833.GD91261@deinos.phlegethon.org> 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: Tim Deegan Cc: Kevin Tian , Keir Fraser , Eddie Dong , Jun Nakajima , Yang Z Zhang , xen-devel List-Id: xen-devel@lists.xenproject.org >>> On 27.03.14 at 16:48, wrote: > Let me work through an example: in a 2-level EPT table (for clarity), > the guest has an mmio-dm entry (or a log-dirty, or otherwise not > present). The EPTEs look like this: > > L1: present > L0: not present, type mmio_dm > > after an MTRR change it look like this: > > L1: present, bad EMT > L0: not present, type mmio_dm > > Two CPUs fault on it at the same time. The first one to the p2m lock > goes through this walk, clears the bad EMT on the L1 and > ept_invalidate_emt()s the whole L0 page. That _doesn't_ set bad EMT > on the L0 entry because the L0 entry is not present. > > L1: present > L0: not present, type mmio_dm > > The other CPU then takes the p2m lock, sees a perfectly good walk and > hasn't been told to expect a spurious fault --> crash. > > So if we clear any intermediate EMTs we need to warn the other CPUs > to expect spurious faults. Right - I didn't take non-present (but valid) leaf entries properly into account here. Thanks for spotting this! Jan