All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: Xen-devel <xen-devel@lists.xensource.com>,
	Keir Fraser <Keir.Fraser@eu.citrix.com>,
	Jan Beulich <JBeulich@novell.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: Re: Xen's use of PAT and PV guests
Date: Tue, 30 Mar 2010 14:47:07 -0700	[thread overview]
Message-ID: <4BB2715B.7020604@goop.org> (raw)
In-Reply-To: <1269971775.2490.88.camel@localhost.localdomain>

On 03/30/2010 10:56 AM, Ian Campbell wrote:
> I had a patch ages ago (which I have now lost) that caused the kernel to
> read back the PAT MSR after writing it and try and locate a suitable
> entry for each cache setting it was interested in (with fallbacks as
> appropriate) to use dynamically thereafter.
>
> This has the nice property that Linux could write what it really wanted
> to the PAT register but it would then read and use whatever it actually
> ended up with.
>

I started to implement something like that, but stopped and decided to 
do a much simpler hack.  I wanted to make sure that make_pte and pte_val 
are proper inverses of each other, so pte_val needs to do the reverse 
mapping from xen pte pat flags -> linux pte pat flags.  Given that the 
only difference between Xen and Linux is whether _PAGE_PWT means WT or 
WC, it is easy to do the mapping forward and back.

But hugetlbfs adds the complication that it ends up constructing ptes 
via the pte operations (which makes logical sense), but on x86 that's a 
mess because the meaning of _PAGE_PAT changes to _PAGE_PSE on level 
2/3/4 entries, and there's no way of knowing what level we're looking at.

At the moment I'm winging it by ignoring _PAGE_PAT in make_pte, and hope 
that nobody wants to do pte_val on a hugetlbfs pte...

Looks like the proper fix is to stop hugetlbfs from using mk_pte, and 
add a mk_huge_tlb instead, and have the x86 version use the pmd operations.

> I'm not sure that this scheme is at all upstreamable though.
>

I don't see why not; it would all be hidden away in the Xen code, and 
maintains the normal x86 illusion.   It's just a matter of hooking 
wrmsr, make_pte and pte_val, which we do already.

     J

  reply	other threads:[~2010-03-30 21:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-30  0:35 Xen's use of PAT and PV guests Jeremy Fitzhardinge
2010-03-30  7:44 ` Jan Beulich
2010-03-30 17:39   ` Jeremy Fitzhardinge
2010-03-30 17:59     ` Keir Fraser
2010-03-30 18:25       ` Jeremy Fitzhardinge
2010-03-30 16:57 ` Konrad Rzeszutek Wilk
2010-03-30 18:43   ` Jeremy Fitzhardinge
2010-03-31  8:26     ` Jan Beulich
2010-03-30 17:56 ` Ian Campbell
2010-03-30 21:47   ` Jeremy Fitzhardinge [this message]
2010-03-31  8:31     ` Ian Campbell
2010-03-31 16:55       ` Jeremy Fitzhardinge

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=4BB2715B.7020604@goop.org \
    --to=jeremy@goop.org \
    --cc=Ian.Campbell@citrix.com \
    --cc=JBeulich@novell.com \
    --cc=Keir.Fraser@eu.citrix.com \
    --cc=konrad.wilk@oracle.com \
    --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.