From: Jeremy Fitzhardinge <jeremy@goop.org>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
Andrew Morton <akpm@linux-foundation.org>,
Andi Kleen <ak@suse.de>, Zachary Amsden <zach@vmware.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] i386: For debugging, make the initial page table setup less forgiving.
Date: Wed, 25 Apr 2007 15:08:57 -0700 [thread overview]
Message-ID: <462FD179.6070802@goop.org> (raw)
In-Reply-To: <m1wt00qnwg.fsf@ebiederm.dsl.xmission.com>
Eric W. Biederman wrote:
> Nope. It's not overwriting anything.
This should fix it.
Subject: x86: fix PSE pagetable construction
When constructing the initial pagetable in pagetable_init, make sure
that non-PSE pmds are updated to PSE ones.
This moves the definition of pmd_huge() out of the hugetlbfs files
into pgtable.h.
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
---
arch/i386/mm/hugetlbpage.c | 6 +-----
arch/i386/mm/init.c | 2 +-
include/asm-i386/pgtable.h | 2 +-
include/asm-x86_64/pgtable.h | 1 +
include/linux/hugetlb.h | 2 --
5 files changed, 4 insertions(+), 9 deletions(-)
===================================================================
--- a/arch/i386/mm/hugetlbpage.c
+++ b/arch/i386/mm/hugetlbpage.c
@@ -183,6 +183,7 @@ follow_huge_addr(struct mm_struct *mm, u
return page;
}
+#undef pmd_huge
int pmd_huge(pmd_t pmd)
{
return 0;
@@ -201,11 +202,6 @@ follow_huge_addr(struct mm_struct *mm, u
follow_huge_addr(struct mm_struct *mm, unsigned long address, int write)
{
return ERR_PTR(-EINVAL);
-}
-
-int pmd_huge(pmd_t pmd)
-{
- return !!(pmd_val(pmd) & _PAGE_PSE);
}
struct page *
===================================================================
--- a/arch/i386/mm/init.c
+++ b/arch/i386/mm/init.c
@@ -172,7 +172,7 @@ static void __init kernel_physical_mappi
/* Map with big pages if possible, otherwise create normal page tables. */
if (cpu_has_pse) {
unsigned int address2 = (pfn + PTRS_PER_PTE - 1) * PAGE_SIZE + PAGE_OFFSET + PAGE_SIZE-1;
- if (!pmd_present(*pmd)) {
+ if (!pmd_present(*pmd) || !pmd_huge(*pmd)) {
if (is_kernel_text(address) || is_kernel_text(address2))
set_pmd(pmd, pfn_pmd(pfn, PAGE_KERNEL_LARGE_EXEC));
else
===================================================================
--- a/include/asm-i386/pgtable.h
+++ b/include/asm-i386/pgtable.h
@@ -211,7 +211,7 @@ extern unsigned long pg0[];
#define pmd_none(x) (!(unsigned long)pmd_val(x))
#define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT)
#define pmd_bad(x) ((pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE)
-
+#define pmd_huge(x) ((pmd_val(x) & _PAGE_PSE) != 0)
#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))
===================================================================
--- a/include/asm-x86_64/pgtable.h
+++ b/include/asm-x86_64/pgtable.h
@@ -352,6 +352,7 @@ static inline int pmd_large(pmd_t pte) {
pmd_index(address))
#define pmd_none(x) (!pmd_val(x))
#define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT)
+#define pmd_huge(x) ((pmd_val(x) & _PAGE_PSE) != 0)
#define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0)
#define pfn_pmd(nr,prot) (__pmd(((nr) << PAGE_SHIFT) | pgprot_val(prot)))
#define pmd_pfn(x) ((pmd_val(x) & __PHYSICAL_MASK) >> PAGE_SHIFT)
===================================================================
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -41,7 +41,6 @@ struct page *follow_huge_addr(struct mm_
int write);
struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address,
pmd_t *pmd, int write);
-int pmd_huge(pmd_t pmd);
void hugetlb_change_protection(struct vm_area_struct *vma,
unsigned long address, unsigned long end, pgprot_t newprot);
@@ -114,7 +113,6 @@ static inline unsigned long hugetlb_tota
#define hugetlb_report_node_meminfo(n, buf) 0
#define follow_huge_pmd(mm, addr, pmd, write) NULL
#define prepare_hugepage_range(addr,len,pgoff) (-EINVAL)
-#define pmd_huge(x) 0
#define is_hugepage_only_range(mm, addr, len) 0
#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; })
#define hugetlb_fault(mm, vma, addr, write) ({ BUG(); 0; })
next prev parent reply other threads:[~2007-04-25 22:08 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-13 21:49 [PATCH] i386: For debugging, make the initial page table setup less forgiving H. Peter Anvin
2007-04-13 22:18 ` Zachary Amsden
2007-04-13 22:26 ` H. Peter Anvin
2007-04-13 22:40 ` Zachary Amsden
2007-04-13 22:26 ` Jeremy Fitzhardinge
2007-04-25 11:48 ` Andrew Morton
2007-04-25 15:28 ` H. Peter Anvin
2007-04-25 17:50 ` Eric W. Biederman
2007-04-25 17:56 ` H. Peter Anvin
2007-04-25 18:23 ` Eric W. Biederman
2007-04-25 18:18 ` Jeremy Fitzhardinge
2007-04-25 19:01 ` Eric W. Biederman
2007-04-25 19:19 ` Jeremy Fitzhardinge
2007-04-25 22:08 ` Jeremy Fitzhardinge [this message]
2007-04-25 22:27 ` Eric W. Biederman
2007-04-25 23:08 ` Jeremy Fitzhardinge
2007-04-25 23:45 ` Eric W. Biederman
2007-04-26 0:14 ` Jeremy Fitzhardinge
2007-04-27 5:02 ` Eric W. Biederman
2007-04-26 3:27 ` Zachary Amsden
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=462FD179.6070802@goop.org \
--to=jeremy@goop.org \
--cc=ak@suse.de \
--cc=akpm@linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=zach@vmware.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.