xen-devel.lists.xenproject.org archive mirror
 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: [Linux PATCH] Fix to hugepages to work around new PWT handling
Date: Wed, 09 Jun 2010 09:02:52 -0500	[thread overview]
Message-ID: <20100609140252.18351.48175.sendpatchset@magnum.int.mccr.org> (raw)

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.

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.

Signed-off-by: Dave McCracken <dave.mccracken@oracle.com>

--------


--- stable-2.6.32.x//arch/x86/include/asm/hugetlb.h	2010-06-04 12:19:31.000000000 -0500
+++ 2.6.32-hfix//arch/x86/include/asm/hugetlb.h	2010-06-08 12:23:53.000000000 -0500
@@ -44,7 +44,7 @@ static inline pte_t huge_ptep_get(pte_t
 static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
 				   pte_t *ptep, pte_t pte)
 {
-	set_pmd((pmd_t *)ptep, __pmd(pte_val(pte)));
+	set_pmd((pmd_t *)ptep, native_make_pmd(native_pte_val(pte)));
 }
 
 static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
--- stable-2.6.32.x//mm/hugetlb.c	2010-06-04 12:19:36.000000000 -0500
+++ 2.6.32-hfix//mm/hugetlb.c	2010-06-07 07:11:34.000000000 -0500
@@ -1732,12 +1732,14 @@ static pte_t make_huge_pte(struct vm_are
 				int writable)
 {
 	pte_t entry;
+	pgprot_t pgprot;
 
+	pgprot = __pgprot(pgprot_val(vma->vm_page_prot) | _PAGE_PRESENT);
 	if (writable) {
 		entry =
-		    pte_mkwrite(pte_mkdirty(mk_pte(page, vma->vm_page_prot)));
+		    pte_mkwrite(pte_mkdirty(mk_pte(page, pgprot)));
 	} else {
-		entry = huge_pte_wrprotect(mk_pte(page, vma->vm_page_prot));
+		entry = huge_pte_wrprotect(mk_pte(page, pgprot));
 	}
 	entry = pte_mkyoung(entry);
 	entry = pte_mkhuge(entry);

             reply	other threads:[~2010-06-09 14:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-09 14:02 Dave McCracken [this message]
2010-06-09 18:21 ` [Linux PATCH] Fix to hugepages to work around new PWT handling Jeremy Fitzhardinge
2010-06-09 18:35   ` Dave McCracken
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=20100609140252.18351.48175.sendpatchset@magnum.int.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).