WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [Linux PATCH] Fix to hugepages to work around new PWT ha

To: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Subject: Re: [Xen-devel] [Linux PATCH] Fix to hugepages to work around new PWT handling
From: Dave McCracken <dcm@xxxxxxxx>
Date: Wed, 9 Jun 2010 14:26:03 -0500
Cc: Xen Developers List <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 09 Jun 2010 12:27:01 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4C0FE359.1000305@xxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20100609140252.18351.48175.sendpatchset@xxxxxxxxxxxxxxxxxxx> <201006091335.52854.dcm@xxxxxxxx> <4C0FE359.1000305@xxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: KMail/1.13.3 (Linux/2.6.32; KDE/4.4.4; x86_64; ; )
On Wednesday, June 09, 2010, Jeremy Fitzhardinge wrote:
> >>> An additional fix here is to make sure the _PAGE_PRESENT bit is set
> >>> before hugepages does a mk_pte(), since Xen depends on that bit to
> >>> trigger the pfn->mfn translation.
> >>>
> >>>   
> >>>       
> >>>
> >> Why is the kernel creating a non-present mapping?  If it isn't present,
> >> why does it matter whether we do the pfn->mfn conversion?
> >>
> >>     
> >>
> > The hugepage function make_huge_pte() called mk_pte() to turn a page and
> > a  pgprot into a pte before it set PRESENT.  The PRESENT flag was set
> > after the pte was made.  This meant that the Xen version of the macro
> > did not see PRESENT so did not do the pfn_to_mfn().  My patch sets
> > PRESENT first so the right thing will happen.
> >
> >   
> 
> But in general kernel code shouldn't be just nakedly setting present on
> the pte without also remaking the whole thing.  That doesn't happen with
> normal ptes, and it probably shouldn't happen with huge ptes.  Forcing
> present on a pte at this level seems very bogus.   Why not change the
> upper code to set present if that's want it wants?
> 
> I'll skip this chunk for now.

Um, this is the upper level code.  The entire purpose of make_huge_pte is to 
construct a present huge pte from page and pgprot. The problem is that the 
original code makes the pte, then sets the present bit via pte_mkhuge().  This 
means the Xen-specific macro that triggers on present is misled and doesn't do 
the pfn_to_mfn().  Without this patch hugepages is handing pfns to the 
hypervisor to map instead of mfns.

Dave

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel