ChangeSet 1.2181.30.3, 2005/03/22 09:45:15-08:00, [EMAIL PROTECTED]
[SPARC64]: Handle straddling VA space hole correctly.
Noticed by Hugh Dickins.
Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
tlb.c | 23 +++++++++++++++++++----
1 files changed, 19 insertions(+), 4 deletions(-)
diff -Nru a/arch/sparc64/mm/tlb.c b/arch/sparc64/mm/tlb.c
--- a/arch/sparc64/mm/tlb.c 2005-04-03 21:11:39 -07:00
+++ b/arch/sparc64/mm/tlb.c 2005-04-03 21:11:39 -07:00
@@ -101,11 +101,10 @@
if (mp->tlb_frozen)
return;
- /* Nobody should call us with start below VM hole and end above.
- * See if it is really true.
- */
- BUG_ON(s > e);
+ /* If start is greater than end, that is a real problem. */
+ BUG_ON(start > end);
+ /* However, straddling the VA space hole is quite normal. */
s &= PMD_MASK;
e = (e + PMD_SIZE - 1) & PMD_MASK;
@@ -123,6 +122,22 @@
start = vpte_base + (s >> (PAGE_SHIFT - 3));
end = vpte_base + (e >> (PAGE_SHIFT - 3));
+
+ /* If the request straddles the VA space hole, we
+ * need to swap start and end. The reason this
+ * occurs is that "vpte_base" is the center of
+ * the linear page table mapping area. Thus,
+ * high addresses with the sign bit set map to
+ * addresses below vpte_base and non-sign bit
+ * addresses map to addresses above vpte_base.
+ */
+ if (end < start) {
+ unsigned long tmp = start;
+
+ start = end;
+ end = tmp;
+ }
+
while (start < end) {
mp->vaddrs[nr] = start;
mp->tlb_nr = ++nr;
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html