[PATCH] PAE36 further diagnosis: Fix for 2.3.42

From: Stephen C. Tweedie (sct@redhat.com)
Date: Wed Feb 09 2000 - 13:45:26 EST


Hi,

There's a serious problem with the current PAE36 code which prevents it
working at all for me unless I limit the amount of memory available to
the kernel.

The problem is pte_modify, which on IA32 masks the existing pte with
_PAGE_CHG_MASK. This is defined as

#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)

and PAGE_MASK, in turn, is defined as

#define PAGE_MASK (~(PAGE_SIZE-1))

Unfortunately, that means that pte_modify() ends up masking our 64-bit
pte with the value 0x00000000fffff060. Whoops.

Now, PAGE_MASK _should_ normally be 32 bits, as it is used extensively
for both virtual addresses, and for pgd/pmd manipulations (which are
always in the bottom 1G). However, in just this place, we want to
mask the full 64 bits.

Note that, strictly speaking, PTE_MASK should probably only set the
bottom 4 bits of the high longword for PAE36, but the definition here
can't do any harm --- if we already have any higher bits set in a pte
then something has gone wrong already.

The patch below produces a shiny, happy PAE36 kernel for me on 2.3.42.
Ingo has given it his stamp of approval.

Cheers,
 Stephen

----------------------------------------------------------------
--- include/asm-i386/page.h~ Tue Feb 1 11:52:41 2000
+++ include/asm-i386/page.h Fri Feb 4 19:14:40 2000
@@ -37,10 +37,12 @@
 typedef struct { unsigned long long pte; } pte_t;
 typedef struct { unsigned long long pmd; } pmd_t;
 typedef struct { unsigned long long pgd; } pgd_t;
+#define PTE_MASK (~(unsigned long long) (PAGE_SIZE-1))
 #else
 typedef struct { unsigned long pte; } pte_t;
 typedef struct { unsigned long pmd; } pmd_t;
 typedef struct { unsigned long pgd; } pgd_t;
+#define PTE_MASK PAGE_MASK
 #endif
 
 typedef struct { unsigned long pgprot; } pgprot_t;
--- include/asm-i386/pgtable.h~ Tue Feb 1 11:52:41 2000
+++ include/asm-i386/pgtable.h Fri Feb 4 19:16:22 2000
@@ -151,7 +151,7 @@
 
 #define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY)
 #define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY)
-#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)
+#define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)
 
 #define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_ACCESSED)
 #define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Feb 15 2000 - 21:00:15 EST