All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave McCracken <dcm@mccr.org>
To: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Xen Developers List <xen-devel@lists.xensource.com>
Subject: Re: [Linux PATCH] Fix to hugepages to work around new PWT	handling
Date: Wed, 9 Jun 2010 13:35:52 -0500	[thread overview]
Message-ID: <201006091335.52854.dcm@mccr.org> (raw)
In-Reply-To: <4C0FDBB9.8090807@goop.org>

On Wednesday, June 09, 2010, Jeremy Fitzhardinge wrote:
> > Recent changes to Linux include code to set new flags in the pte,
> > including _PAGE_PAT and _PAGE_PWT.  That change conflicts with hugepage
> > using the pte macros to set up its pmd entries.  This patch resolves
> > that problem.
> >
> >   
> 
> Could you explain this a bit more clearly?  Why is using __pmd not
> working in this case?  Is it because the kernel is now setting PAT and
> PWT on huge pages?  But PAT isn't even the same flag for huge pages...

For some reason the latest xen_make_pte() and xen_pte_val() are attempting to 
do some magic with PAT, PCD, and PWT.  The previous version of the code in 
set_huge_pte_at() did "__pmd(pte_val(pte))", and the end result was that PSE 
got turned off and PWT was turned on.  Doing the native versions of those calls 
avoids this issue, since all the code is really trying to do here is a 
typecast.

I realize the more complete fix probably involves something like converting 
hugepages to use pmd throughout instead of pte, but that's a much bigger 
change and this solves the immediate problem.

> > 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.

Dave McCracken
Oracle Corp.

  reply	other threads:[~2010-06-09 18:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-09 14:02 [Linux PATCH] Fix to hugepages to work around new PWT handling Dave McCracken
2010-06-09 18:21 ` Jeremy Fitzhardinge
2010-06-09 18:35   ` Dave McCracken [this message]
2010-06-09 18:54     ` Jeremy Fitzhardinge
2010-06-09 19:26       ` Dave McCracken
2010-06-24 10:05         ` Jeremy Fitzhardinge
2010-06-24 22:38           ` Dave McCracken

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201006091335.52854.dcm@mccr.org \
    --to=dcm@mccr.org \
    --cc=jeremy@goop.org \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.