projects
/
linux-block.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
x86: fix pageattr-test
[linux-block.git]
/
arch
/
x86
/
mm
/
pageattr-test.c
diff --git
a/arch/x86/mm/pageattr-test.c
b/arch/x86/mm/pageattr-test.c
index ed82016003540ec66ccd7b18157188f6a9d7a5cf..6ae1f28a7ff29c7cfddc3b65513857a17e7527dd 100644
(file)
--- a/
arch/x86/mm/pageattr-test.c
+++ b/
arch/x86/mm/pageattr-test.c
@@
-1,8
+1,8
@@
/*
* self test for change_page_attr.
*
/*
* 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>
*/
#include <linux/bootmem.h>
#include <linux/kthread.h>
@@
-32,6
+32,13
@@
enum {
GPS = (1<<30)
};
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;
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;
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;
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) {
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;
missed++;
i++;
continue;
@@
-118,6
+118,7
@@
static int pageattr_test(void)
unsigned int level;
int i, k;
int err;
unsigned int level;
int i, k;
int err;
+ unsigned long test_addr;
if (print)
printk(KERN_INFO "CPA self-test:\n");
if (print)
printk(KERN_INFO "CPA self-test:\n");
@@
-172,15
+173,15
@@
static int pageattr_test(void)
continue;
}
continue;
}
- err = change_page_attr_clear(addr[i], len[i],
-
__pgprot(_PAGE_GLOBAL)
);
+ test_addr = addr[i];
+
err = change_page_attr_set(&test_addr, len[i], PAGE_TESTBIT, 0
);
if (err < 0) {
printk(KERN_ERR "CPA %d failed %d\n", i, err);
failed++;
}
pte = lookup_address(addr[i], &level);
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++;
printk(KERN_ERR "CPA %lx: bad pte %Lx\n", addr[i],
pte ? (u64)pte_val(*pte) : 0ULL);
failed++;
@@
-205,14
+206,14
@@
static int pageattr_test(void)
failed++;
continue;
}
failed++;
continue;
}
- err = change_page_attr_set(addr[i], len[i],
-
__pgprot(_PAGE_GLOBAL)
);
+ test_addr = addr[i];
+
err = change_page_attr_clear(&test_addr, len[i], PAGE_TESTBIT, 0
);
if (err < 0) {
printk(KERN_ERR "CPA reverting failed: %d\n", err);
failed++;
}
pte = lookup_address(addr[i], &level);
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++;
printk(KERN_ERR "CPA %lx: bad pte after revert %Lx\n",
addr[i], pte ? (u64)pte_val(*pte) : 0ULL);
failed++;