]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/x86/mm/pageattr-test.c
Merge branch 'core/locking' of git://git.kernel.org/pub/scm/linux/kernel/git/tip...
[linux-2.6-omap-h63xx.git] / arch / x86 / mm / pageattr-test.c
index ed82016003540ec66ccd7b18157188f6a9d7a5cf..0dcd42eb94e66fd8650422cb25e348cc18da3cf5 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * self test for change_page_attr.
  *
- * Clears the global bit on random pages in the direct mapping, then reverts
- * and compares page tables forwards and afterwards.
+ * Clears the a test pte bit on random pages in the direct mapping,
+ * then reverts and compares page tables forwards and afterwards.
  */
 #include <linux/bootmem.h>
 #include <linux/kthread.h>
@@ -32,6 +32,13 @@ enum {
        GPS                     = (1<<30)
 };
 
+#define PAGE_TESTBIT   __pgprot(_PAGE_UNUSED1)
+
+static int pte_testbit(pte_t pte)
+{
+       return pte_flags(pte) & _PAGE_UNUSED1;
+}
+
 struct split_state {
        long lpg, gpg, spg, exec;
        long min_exec, max_exec;
@@ -40,7 +47,6 @@ struct split_state {
 static int print_split(struct split_state *s)
 {
        long i, expected, missed = 0;
-       int printed = 0;
        int err = 0;
 
        s->lpg = s->gpg = s->spg = s->exec = 0;
@@ -53,12 +59,6 @@ static int print_split(struct split_state *s)
 
                pte = lookup_address(addr, &level);
                if (!pte) {
-                       if (!printed) {
-                               dump_pagetable(addr);
-                               printk(KERN_INFO "CPA %lx no pte level %d\n",
-                                       addr, level);
-                               printed = 1;
-                       }
                        missed++;
                        i++;
                        continue;
@@ -172,15 +172,14 @@ static int pageattr_test(void)
                        continue;
                }
 
-               err = change_page_attr_clear(addr[i], len[i],
-                                              __pgprot(_PAGE_GLOBAL));
+               err = change_page_attr_set(addr[i], len[i], PAGE_TESTBIT);
                if (err < 0) {
                        printk(KERN_ERR "CPA %d failed %d\n", i, err);
                        failed++;
                }
 
                pte = lookup_address(addr[i], &level);
-               if (!pte || pte_global(*pte) || pte_huge(*pte)) {
+               if (!pte || !pte_testbit(*pte) || pte_huge(*pte)) {
                        printk(KERN_ERR "CPA %lx: bad pte %Lx\n", addr[i],
                                pte ? (u64)pte_val(*pte) : 0ULL);
                        failed++;
@@ -205,14 +204,13 @@ static int pageattr_test(void)
                        failed++;
                        continue;
                }
-               err = change_page_attr_set(addr[i], len[i],
-                                            __pgprot(_PAGE_GLOBAL));
+               err = change_page_attr_clear(addr[i], len[i], PAGE_TESTBIT);
                if (err < 0) {
                        printk(KERN_ERR "CPA reverting failed: %d\n", err);
                        failed++;
                }
                pte = lookup_address(addr[i], &level);
-               if (!pte || !pte_global(*pte)) {
+               if (!pte || pte_testbit(*pte)) {
                        printk(KERN_ERR "CPA %lx: bad pte after revert %Lx\n",
                                addr[i], pte ? (u64)pte_val(*pte) : 0ULL);
                        failed++;