From: Jeff Dike <jdike@addtoit.com>
To: Andrew Morton <akpm@osdl.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
uml-devel <user-mode-linux-devel@lists.sourceforge.net>
Subject: [PATCH 6/6] UML - 64-bit tlb fixes
Date: Thu, 6 Dec 2007 12:06:43 -0500 [thread overview]
Message-ID: <20071206170643.GA7445@c2.user-mode-linux.org> (raw)
Some 64-bit tlb fixes -
moved pmd_page_vaddr to pgtable.h since it's the same for both
2-level and 3-level page tables
fixed a bogus cast on pud_page_vaddr
made the address checking in update_*_range more careful
Signed-off-by: Jeff Dike <jdike@linux.intel.com>
---
arch/um/kernel/tlb.c | 8 ++++----
include/asm-um/pgtable-2level.h | 3 ---
include/asm-um/pgtable-3level.h | 3 +--
include/asm-um/pgtable.h | 3 +++
4 files changed, 8 insertions(+), 9 deletions(-)
Index: linux-2.6-git/arch/um/kernel/tlb.c
===================================================================
--- linux-2.6-git.orig/arch/um/kernel/tlb.c 2007-12-06 10:34:41.000000000 -0500
+++ linux-2.6-git/arch/um/kernel/tlb.c 2007-12-06 11:26:20.000000000 -0500
@@ -207,7 +207,7 @@ static inline int update_pte_range(pmd_t
} else if (pte_newprot(*pte))
ret = add_mprotect(addr, PAGE_SIZE, prot, hvc);
*pte = pte_mkuptodate(*pte);
- } while (pte++, addr += PAGE_SIZE, ((addr != end) && !ret));
+ } while (pte++, addr += PAGE_SIZE, ((addr < end) && !ret));
return ret;
}
@@ -229,7 +229,7 @@ static inline int update_pmd_range(pud_t
}
}
else ret = update_pte_range(pmd, addr, next, hvc);
- } while (pmd++, addr = next, ((addr != end) && !ret));
+ } while (pmd++, addr = next, ((addr < end) && !ret));
return ret;
}
@@ -251,7 +251,7 @@ static inline int update_pud_range(pgd_t
}
}
else ret = update_pmd_range(pud, addr, next, hvc);
- } while (pud++, addr = next, ((addr != end) && !ret));
+ } while (pud++, addr = next, ((addr < end) && !ret));
return ret;
}
@@ -274,7 +274,7 @@ void fix_range_common(struct mm_struct *
}
}
else ret = update_pud_range(pgd, addr, next, &hvc);
- } while (pgd++, addr = next, ((addr != end_addr) && !ret));
+ } while (pgd++, addr = next, ((addr < end_addr) && !ret));
if (!ret)
ret = do_ops(&hvc, hvc.index, 1);
Index: linux-2.6-git/include/asm-um/pgtable-2level.h
===================================================================
--- linux-2.6-git.orig/include/asm-um/pgtable-2level.h 2007-12-03 23:57:24.000000000 -0500
+++ linux-2.6-git/include/asm-um/pgtable-2level.h 2007-12-06 11:26:20.000000000 -0500
@@ -41,9 +41,6 @@ static inline void pgd_mkuptodate(pgd_t
#define pfn_pte(pfn, prot) __pte(pfn_to_phys(pfn) | pgprot_val(prot))
#define pfn_pmd(pfn, prot) __pmd(pfn_to_phys(pfn) | pgprot_val(prot))
-#define pmd_page_vaddr(pmd) \
- ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
-
/*
* Bits 0 through 4 are taken
*/
Index: linux-2.6-git/include/asm-um/pgtable-3level.h
===================================================================
--- linux-2.6-git.orig/include/asm-um/pgtable-3level.h 2007-12-06 10:32:12.000000000 -0500
+++ linux-2.6-git/include/asm-um/pgtable-3level.h 2007-12-06 11:26:20.000000000 -0500
@@ -87,8 +87,7 @@ static inline void pud_clear (pud_t *pud
}
#define pud_page(pud) phys_to_page(pud_val(pud) & PAGE_MASK)
-#define pud_page_vaddr(pud) \
- ((struct page *) __va(pud_val(pud) & PAGE_MASK))
+#define pud_page_vaddr(pud) ((unsigned long) __va(pud_val(pud) & PAGE_MASK))
/* Find an entry in the second-level page table.. */
#define pmd_offset(pud, address) ((pmd_t *) pud_page_vaddr(*(pud)) + \
Index: linux-2.6-git/include/asm-um/pgtable.h
===================================================================
--- linux-2.6-git.orig/include/asm-um/pgtable.h 2007-12-06 10:32:12.000000000 -0500
+++ linux-2.6-git/include/asm-um/pgtable.h 2007-12-06 11:26:20.000000000 -0500
@@ -307,6 +307,9 @@ static inline pte_t pte_modify(pte_t pte
*/
#define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
+#define pmd_page_vaddr(pmd) \
+ ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
+
/*
* the pte page can be thought of an array like this: pte_t[PTRS_PER_PTE]
*
reply other threads:[~2007-12-06 17:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20071206170643.GA7445@c2.user-mode-linux.org \
--to=jdike@addtoit.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=user-mode-linux-devel@lists.sourceforge.net \
/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).