[PATCH] [1/36] Undo pat cpa patch

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-kernel@...>, <mingo@...>, <tglx@...>, <jbeulich@...>, <venkatesh.pallipadi@...>
Date: Wednesday, January 16, 2008 - 6:14 pm

Going to implement this differently

 commit 5ec5c5a2302ca8794da03f8bedec931a2a814ae9
 Author: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
 Date:   Tue Jan 15 09:36:03 2008 +0100

    patches/x86-pat-cpa_i386.patch
    
    This makes 32 bit cpa similar to x86_64 and makes it easier for following PA
T
    patches.

Signed-off-by: Andi Kleen <ak@suse.de>

---
 arch/x86/mm/pageattr_32.c |   24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

Index: linux/arch/x86/mm/pageattr_32.c
===================================================================
--- linux.orig/arch/x86/mm/pageattr_32.c
+++ linux/arch/x86/mm/pageattr_32.c
@@ -153,12 +153,15 @@ static inline void save_page(struct page
 		list_add(&kpte_page->lru, &df_list);
 }
 
-static int __change_page_attr(unsigned long address, unsigned long pfn,
-                              pgprot_t prot)
+static int __change_page_attr(struct page *page, pgprot_t prot)
 {
 	struct page *kpte_page;
+	unsigned long address;
 	pte_t *kpte;
 
+	BUG_ON(PageHighMem(page));
+	address = (unsigned long)page_address(page);
+
 	kpte = lookup_address(address);
 	if (!kpte)
 		return -EINVAL;
@@ -169,7 +172,7 @@ static int __change_page_attr(unsigned l
 
 	if (pgprot_val(prot) != pgprot_val(PAGE_KERNEL)) {
 		if (!pte_huge(*kpte)) {
-			set_pte_atomic(kpte, pfn_pte(pfn, prot));
+			set_pte_atomic(kpte, mk_pte(page, prot));
 		} else {
 			struct page *split;
 			pgprot_t ref_prot;
@@ -187,7 +190,7 @@ static int __change_page_attr(unsigned l
 		page_private(kpte_page)++;
 	} else {
 		if (!pte_huge(*kpte)) {
-			set_pte_atomic(kpte, pfn_pte(pfn, PAGE_KERNEL));
+			set_pte_atomic(kpte, mk_pte(page, PAGE_KERNEL));
 			BUG_ON(page_private(kpte_page) == 0);
 			page_private(kpte_page)--;
 		} else
@@ -228,15 +231,14 @@ static inline void flush_map(struct list
  *
  * Caller must call global_flush_tlb() after this.
  */
-int change_page_attr_addr(unsigned long address, int numpages, pgprot_t prot)
+int change_page_attr(struct page *page, int numpages, pgprot_t prot)
 {
 	unsigned long flags;
 	int err = 0, i;
 
 	spin_lock_irqsave(&cpa_lock, flags);
-	for (i = 0; i < numpages; i++, address += PAGE_SIZE) {
-		unsigned long pfn = __pa(address) >> PAGE_SHIFT;
-		err = __change_page_attr(address, pfn, prot);
+	for (i = 0; i < numpages; i++, page++) {
+		err = __change_page_attr(page, prot);
 		if (err)
 			break;
 	}
@@ -246,12 +248,6 @@ int change_page_attr_addr(unsigned long 
 }
 EXPORT_SYMBOL(change_page_attr);
 
-int change_page_attr(struct page *page, int numpages, pgprot_t prot)
-{
-	unsigned long addr = (unsigned long)page_address(page);
-	return change_page_attr_addr(addr, numpages, prot);
-}
-
 void global_flush_tlb(void)
 {
 	struct page *pg, *next;
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] [35/36] Remove set_kernel_exec, Andi Kleen, (Wed Jan 16, 6:15 pm)
[PATCH] [36/36] Clean up pte_exec, Andi Kleen, (Wed Jan 16, 6:15 pm)
[PATCH] [14/36] CPA: Add simple self test at boot, Andi Kleen, (Wed Jan 16, 6:15 pm)
[PATCH] [10/36] Add pte_pgprot on i386, Andi Kleen, (Wed Jan 16, 6:15 pm)
[PATCH] [9/36] Add pte accessors for the global bit, Andi Kleen, (Wed Jan 16, 6:15 pm)
[PATCH] [8/36] CPA: Do a simple self test at boot, Andi Kleen, (Wed Jan 16, 6:15 pm)
[PATCH] [4/36] CPA: Undo white space changes, Andi Kleen, (Wed Jan 16, 6:15 pm)
[PATCH] [1/36] Undo pat cpa patch, Andi Kleen, (Wed Jan 16, 6:14 pm)