From: Tim Deegan Subject: Re: [PATCH RFC] x86/shadow: adjust cachability flags handling Date: Thu, 6 Mar 2014 11:53:56 +0100 Message-ID: <20140306105356.GE11475@deinos.phlegethon.org> References: <531747840200007800121329@nat28.tlf.novell.com> 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 1WLVw6-0007FP-JY for xen-devel@lists.xenproject.org; Thu, 06 Mar 2014 10:53:58 +0000 Content-Disposition: inline In-Reply-To: <531747840200007800121329@nat28.tlf.novell.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: Jan Beulich Cc: xen-devel List-Id: xen-devel@lists.xenproject.org At 14:49 +0000 on 05 Mar (1394027364), Jan Beulich wrote: > For one, including _PAGE_PAT in the pass-through flags is valid only > for L1 entries (otherwise _PAGE_PSE_PAT would need looking at). Looking > around I _think_ that for page directories we'd always get a valid MFN > passed in here, and hence I _think_ the assertion is correct. > > And second we need to avoid or-ing guest PAT/PCD/PWT with ones coming > from pat_type_2_pte_flags()/get_pat_flags(). An alternative to the > pass_thru_flags check might be to use mfn_valid(target_mfn). > > --- a/xen/arch/x86/mm/shadow/multi.c > +++ b/xen/arch/x86/mm/shadow/multi.c > @@ -580,7 +580,10 @@ _sh_propagate(struct vcpu *v, > if ( guest_supports_nx(v) ) > pass_thru_flags |= _PAGE_NX_BIT; > if ( !shadow_mode_refcounts(d) && !mfn_valid(target_mfn) ) > + { > + ASSERT(level == 1); Yes, this assertion is correct -- enforced by this block just above: if ( !mfn_valid(target_mfn) && !(level == 1 && (!shadow_mode_refcounts(d) || p2mt == p2m_mmio_direct)) ) { ASSERT((ft == ft_prefetch)); *sp = shadow_l1e_empty(); goto done; } > pass_thru_flags |= _PAGE_PAT | _PAGE_PCD | _PAGE_PWT; > + } > sflags = gflags & pass_thru_flags; > > /* > @@ -588,6 +591,7 @@ _sh_propagate(struct vcpu *v, > * caching attributes in the shadows to match what was asked for. > */ > if ( (level == 1) && is_hvm_domain(d) && > + !(pass_thru_flags & (_PAGE_PAT | _PAGE_PCD | _PAGE_PWT)) && I don't think this is necessary -- is_hvm_domain() implies shadow_mode_refcounts(), so we won't have set these flags in pass_thru_flags above. If you want to make a change for clarity, I'd be happier with ASSERT(!(gflags & (_PAGE_PAT | _PAGE_PCD | _PAGE_PWT))) here. Cheers, Tim. > !is_xen_heap_mfn(mfn_x(target_mfn)) ) > { > unsigned int type; > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel