From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: LKML <linux-kernel@vger.kernel.org>,
x86@kernel.org, Stephen Tweedie <sct@redhat.com>,
Eduardo Habkost <ehabkost@redhat.com>,
Mark McLoughlin <markmc@redhat.com>,
x86@kernel.org
Subject: [PATCH 8 of 8] x86/cpa: use an undefined PTE bit for testing CPA
Date: Tue, 01 Jul 2008 16:46:37 -0700 [thread overview]
Message-ID: <abddb8b25c08f0d28b8c.1214955997@localhost> (raw)
In-Reply-To: <patchbomb.1214955989@localhost>
Rather than using _PAGE_GLOBAL - which not all CPUs support - to test
CPA, use one of the reserved-for-software-use PTE flags instead. This
allows CPA testing to work on CPUs which don't support PGD.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
arch/x86/mm/pageattr-test.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/arch/x86/mm/pageattr-test.c b/arch/x86/mm/pageattr-test.c
--- a/arch/x86/mm/pageattr-test.c
+++ b/arch/x86/mm/pageattr-test.c
@@ -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>
@@ -31,6 +31,13 @@
#endif
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;
@@ -165,15 +172,14 @@
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++;
@@ -198,14 +204,13 @@
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++;
next prev parent reply other threads:[~2008-07-02 1:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-01 23:46 [PATCH 0 of 8] x86/xen: updated physical mapping patches, and _PAGE_GLOBAL cleanup Jeremy Fitzhardinge
2008-07-01 23:46 ` [PATCH 1 of 8] x86_64: create global mappings in head_64.S Jeremy Fitzhardinge
2008-07-01 23:46 ` [PATCH 2 of 8] x86_64: unmap iomapping before populating Jeremy Fitzhardinge
2008-07-01 23:46 ` [PATCH 3 of 8] x86_64/setup: preserve existing PUD mappings Jeremy Fitzhardinge
2008-07-01 23:46 ` [PATCH 4 of 8] x86_64/setup: unconditionally populate the pgd Jeremy Fitzhardinge
2008-07-01 23:46 ` [PATCH 5 of 8] x86_64/setup: create 4k mappings if the cpu doens't support PSE Jeremy Fitzhardinge
2008-07-01 23:46 ` [PATCH 6 of 8] x86: always set _PAGE_GLOBAL in _PAGE_KERNEL* flags Jeremy Fitzhardinge
2008-07-01 23:46 ` [PATCH 7 of 8] x86_32: remove __PAGE_KERNEL(_EXEC) Jeremy Fitzhardinge
2008-07-01 23:46 ` Jeremy Fitzhardinge [this message]
2008-07-04 10:33 ` [PATCH 0 of 8] x86/xen: updated physical mapping patches, and _PAGE_GLOBAL cleanup Ingo Molnar
2008-07-04 15:56 ` Jeremy Fitzhardinge
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=abddb8b25c08f0d28b8c.1214955997@localhost \
--to=jeremy@goop.org \
--cc=ehabkost@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=markmc@redhat.com \
--cc=mingo@elte.hu \
--cc=sct@redhat.com \
--cc=x86@kernel.org \
/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