Skip to contentSkip to conversation

set_pte() part 2 arch usage

PATCH In review David S. Miller 3 participants 16 messages Feb 24, 2005 – Mar 1, 2005

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 set_pte() part 2 arch usage

Ok, here is the promised second installment. This changes sparc64 (first attachment) and ppc{32,64} (second attachment) over to take advantage of the new set_pte_at() mm+address arguments.

I've build and run tested the sparc64 version. I have only build tested the ppc32 and ppc64 changes. Ben, can you give them a spin?

Thanks.

#1 lore raw
Quoted 8 lines · David S. Miller

Ok, here is the promised second installment. This changes sparc64 (first attachment) and ppc{32,64} (second attachment) over to take advantage of the new set_pte_at() mm+address arguments.

I've build and run tested the sparc64 version. I have only build tested the ppc32 and ppc64 changes. Ben, can you give them a spin?

Seems to be happy on ppc32, I'll try ppc64 asap.

Ben.

#2 lore raw
Quoted 1 line · On Thu, 24 Feb 2005 16:18:48 +1100 Benjamin Herrenschmidt <[email protected]>…

Seems to be happy on ppc32, I'll try ppc64 asap.

Thanks for testing, let me know how ppc64 goes.

#3 lore raw
Quoted 6 lines · David S. Miller
Quoted 1 line · On Thu, 24 Feb 2005 16:18:48 +1100 Benjamin Herrenschmidt <[email protected]>…

Seems to be happy on ppc32, I'll try ppc64 asap.

Thanks for testing, let me know how ppc64 goes.

Looks fine. Didn't stress much yet tho, but certainly good enough for early 2.6.12, we can always push further fixes in if necessary.

Ben.

#4 lore raw
Quoted 10 lines · Benjamin Herrenschmidt
Quoted 6 lines · David S. Miller
Quoted 1 line · On Thu, 24 Feb 2005 16:18:48 +1100 Benjamin Herrenschmidt <[email protected]>…

Seems to be happy on ppc32, I'll try ppc64 asap.

Thanks for testing, let me know how ppc64 goes.

Looks fine. Didn't stress much yet tho, but certainly good enough for early 2.6.12, we can always push further fixes in if necessary.

Ok, LTP dies on POWER5, investigation in progress ;)

Ben.

#5 lore raw
Quoted 1 line · On Fri, 25 Feb 2005 18:20:55 +1100 Benjamin Herrenschmidt…

Ok, LTP dies on POWER5, investigation in progress ;)

OK, FWIW I did a full LTP run on sparc64 with the changes installed.

#6 lore raw
In reply to Benjamin Herrenschmidt
Quoted 1 line · On Fri, 25 Feb 2005 18:20:55 +1100 Benjamin Herrenschmidt…

Ok, LTP dies on POWER5, investigation in progress ;)

I bet the address arg is incorrect in some case. It is easy to add debugging for this, for example in your set_pte_at() implementation you can do something like:

static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
pte_t *ptep, pte_t pte)
{

#ifdef DEBUG_SET_PTE_AT
	{
		pgd_t *pgd_check = pgd_offset(mm, addr);
		pud_t *pud_check = pud_offset(pgd_check, addr);
		pmd_t *pmd_check = pmd_offset(pud_check, addr);
		pte_t *pte_check = pte_offset(pmd_check, addr);

		BUG_ON(pte_check != ptep);
	}

#endif
}

BUG_ON() may hinder debugging if you hit a range of such incorrect calculations, so maybe a single printk which just prints __builtin_return_address(0) or current_text_addr() as well.

#7 lore raw
Quoted 6 lines · David S. Miller
Quoted 1 line · On Fri, 25 Feb 2005 18:20:55 +1100 Benjamin Herrenschmidt…

Ok, LTP dies on POWER5, investigation in progress ;)

I bet the address arg is incorrect in some case.

Yes, probably. That's the same symptoms we had when zeromap_pud_range had the bug getting the address wrong, which means we fail to properly flush the hash & TLB for this PTE. I'm not at work (it's sat. already here :) but I'll have a look asap.

Quoted 16 lines

It is ea<sy
to add debugging for this, for example in your set_pte_at() implementation you can do something like:

static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
pte_t *ptep, pte_t pte)
{

#ifdef DEBUG_SET_PTE_AT
	{
		pgd_t *pgd_check = pgd_offset(mm, addr);
		pud_t *pud_check = pud_offset(pgd_check, addr);
		pmd_t *pmd_check = pmd_offset(pud_check, addr);
		pte_t *pte_check = pte_offset(pmd_check, addr);

		BUG_ON(pte_check != ptep);
	}
Quoted 2 lines

#endif
}

Good idea.

Quoted 4 lines

BUG_ON() may hinder debugging if you hit a range of such incorrect calculations, so maybe a single printk which just prints __builtin_return_address(0) or current_text_addr() as well.

Nah, just xmon(NULL); :=)

Ben.

#8 lore raw
Quoted 7 lines · On Sat, 26 Feb 2005 11:56:09 +1100 Benjamin Herrenschmidt…
Quoted 1 line · David S. Miller

I bet the address arg is incorrect in some case.

Yes, probably. That's the same symptoms we had when zeromap_pud_range had the bug getting the address wrong, which means we fail to properly flush the hash & TLB for this PTE. I'm not at work (it's sat. already here :) but I'll have a look asap.

I added the debugging I suggested and did some runs on sparc64.

There are many pte level looping constructs of the form:

	pte = ...(pmd, address);
	address &= ~PMD_MASK;
	end = address + size;
	if (end > PMD_SIZE)
		end = PMD_SIZE;

	some_loop() {
		...
		set_pte_at(mm, address, pte);
		address += PAGE_SIZE;
		pte++;
		...
	}

This "address" mask screws everything up.

I know of at least three such cases so far, vmalloc.c:unmap_area_pte(), vmalloc.c:map_area_pte(), and mprotect.c:change_pte_range()

The latter could definitely explain the behavior you are seeing on ppc64.

#9 lore raw
Quoted 5 lines · On Sat, 26 Feb 2005 19:09:43 -0800 "David S. Miller" <[email protected]>…

I know of at least three such cases so far, vmalloc.c:unmap_area_pte(), vmalloc.c:map_area_pte(), and mprotect.c:change_pte_range()

The latter could definitely explain the behavior you are seeing on ppc64.

Ok, here's a fix, let me know if it makes the PPC64 problems go away Ben.

Thanks.

===== mm/memory.c 1.224 vs edited =====

mm/memory.c +7 -5
@@ -992,16 +992,17 @@
 			      unsigned long address,
 			      unsigned long size, pgprot_t prot)
 {
-	unsigned long end;
+	unsigned long base, end;
 
+	base = address & PMD_MASK;
 	address &= ~PMD_MASK;
 	end = address + size;
 	if (end > PMD_SIZE)
 		end = PMD_SIZE;
 	do {
-		pte_t zero_pte = pte_wrprotect(mk_pte(ZERO_PAGE(address), prot));
+		pte_t zero_pte = pte_wrprotect(mk_pte(ZERO_PAGE(base+address), prot));
 		BUG_ON(!pte_none(*pte));
-		set_pte_at(mm, address, pte, zero_pte);
+		set_pte_at(mm, base+address, pte, zero_pte);
 		address += PAGE_SIZE;
 		pte++;
 	} while (address && (address < end));
@@ -1106,8 +1107,9 @@
 		unsigned long address, unsigned long size,
 		unsigned long pfn, pgprot_t prot)
 {
-	unsigned long end;
+	unsigned long base, end;
 
+	base = address & PMD_MASK;
 	address &= ~PMD_MASK;
 	end = address + size;
 	if (end > PMD_SIZE)
@@ -1115,7 +1117,7 @@
 	do {
 		BUG_ON(!pte_none(*pte));
 		if (!pfn_valid(pfn) || PageReserved(pfn_to_page(pfn)))
-			set_pte_at(mm, address, pte, pfn_pte(pfn, prot));
+			set_pte_at(mm, base+address, pte, pfn_pte(pfn, prot));
 		address += PAGE_SIZE;
 		pfn++;
 		pte++;

===== mm/mprotect.c 1.41 vs edited =====

mm/mprotect.c +10 -7
@@ -30,7 +30,7 @@
 		unsigned long size, pgprot_t newprot)
 {
 	pte_t * pte;
-	unsigned long end;
+	unsigned long base, end;
 
 	if (pmd_none(*pmd))
 		return;
@@ -40,6 +40,7 @@
 		return;
 	}
 	pte = pte_offset_map(pmd, address);
+	base = address & PMD_MASK;
 	address &= ~PMD_MASK;
 	end = address + size;
 	if (end > PMD_SIZE)
@@ -52,8 +53,8 @@
 			 * bits by wiping the pte and then setting the new pte
 			 * into place.
 			 */
-			entry = ptep_get_and_clear(mm, address, pte);
-			set_pte_at(mm, address, pte, pte_modify(entry, newprot));
+			entry = ptep_get_and_clear(mm, base + address, pte);
+			set_pte_at(mm, base + address, pte, pte_modify(entry, newprot));
 		}
 		address += PAGE_SIZE;
 		pte++;
@@ -66,7 +67,7 @@
 		 unsigned long size, pgprot_t newprot)
 {
 	pmd_t * pmd;
-	unsigned long end;
+	unsigned long base, end;
 
 	if (pud_none(*pud))
 		return;
@@ -76,12 +77,13 @@
 		return;
 	}
 	pmd = pmd_offset(pud, address);
+	base = address & PUD_MASK;
 	address &= ~PUD_MASK;
 	end = address + size;
 	if (end > PUD_SIZE)
 		end = PUD_SIZE;
 	do {
-		change_pte_range(mm, pmd, address, end - address, newprot);
+		change_pte_range(mm, pmd, base + address, end - address, newprot);
 		address = (address + PMD_SIZE) & PMD_MASK;
 		pmd++;
 	} while (address && (address < end));
@@ -92,7 +94,7 @@
 		 unsigned long size, pgprot_t newprot)
 {
 	pud_t * pud;
-	unsigned long end;
+	unsigned long base, end;
 
 	if (pgd_none(*pgd))
 		return;
@@ -102,12 +104,13 @@
 		return;
 	}
 	pud = pud_offset(pgd, address);
+	base = address & PGDIR_MASK;
 	address &= ~PGDIR_MASK;
 	end = address + size;
 	if (end > PGDIR_SIZE)
 		end = PGDIR_SIZE;
 	do {
-		change_pmd_range(mm, pud, address, end - address, newprot);
+		change_pmd_range(mm, pud, base + address, end - address, newprot);
 		address = (address + PUD_SIZE) & PUD_MASK;
 		pud++;
 	} while (address && (address < end));

===== mm/vmalloc.c 1.41 vs edited =====

mm/vmalloc.c +13 -9
@@ -26,7 +26,7 @@
 static void unmap_area_pte(pmd_t *pmd, unsigned long address,
 				  unsigned long size)
 {
-	unsigned long end;
+	unsigned long base, end;
 	pte_t *pte;
 
 	if (pmd_none(*pmd))
@@ -38,6 +38,7 @@
 	}
 
 	pte = pte_offset_kernel(pmd, address);
+	base = address & PMD_MASK;
 	address &= ~PMD_MASK;
 	end = address + size;
 	if (end > PMD_SIZE)
@@ -45,7 +46,7 @@
 
 	do {
 		pte_t page;
-		page = ptep_get_and_clear(&init_mm, address, pte);
+		page = ptep_get_and_clear(&init_mm, base + address, pte);
 		address += PAGE_SIZE;
 		pte++;
 		if (pte_none(page))
@@ -59,7 +60,7 @@
 static void unmap_area_pmd(pud_t *pud, unsigned long address,
 				  unsigned long size)
 {
-	unsigned long end;
+	unsigned long base, end;
 	pmd_t *pmd;
 
 	if (pud_none(*pud))
@@ -71,13 +72,14 @@
 	}
 
 	pmd = pmd_offset(pud, address);
+	base = address & PUD_MASK;
 	address &= ~PUD_MASK;
 	end = address + size;
 	if (end > PUD_SIZE)
 		end = PUD_SIZE;
 
 	do {
-		unmap_area_pte(pmd, address, end - address);
+		unmap_area_pte(pmd, base + address, end - address);
 		address = (address + PMD_SIZE) & PMD_MASK;
 		pmd++;
 	} while (address < end);
@@ -87,7 +89,7 @@
 			   unsigned long size)
 {
 	pud_t *pud;
-	unsigned long end;
+	unsigned long base, end;
 
 	if (pgd_none(*pgd))
 		return;
@@ -98,13 +100,14 @@
 	}
 
 	pud = pud_offset(pgd, address);
+	base = address & PGDIR_MASK;
 	address &= ~PGDIR_MASK;
 	end = address + size;
 	if (end > PGDIR_SIZE)
 		end = PGDIR_SIZE;
 
 	do {
-		unmap_area_pmd(pud, address, end - address);
+		unmap_area_pmd(pud, base + address, end - address);
 		address = (address + PUD_SIZE) & PUD_MASK;
 		pud++;
 	} while (address && (address < end));
@@ -114,8 +117,9 @@
 			       unsigned long size, pgprot_t prot,
 			       struct page ***pages)
 {
-	unsigned long end;
+	unsigned long base, end;
 
+	base = address & PMD_MASK;
 	address &= ~PMD_MASK;
 	end = address + size;
 	if (end > PMD_SIZE)
@@ -127,7 +131,7 @@
 		if (!page)
 			return -ENOMEM;
 
-		set_pte_at(&init_mm, address, pte, mk_pte(page, prot));
+		set_pte_at(&init_mm, base + address, pte, mk_pte(page, prot));
 		address += PAGE_SIZE;
 		pte++;
 		(*pages)++;
@@ -151,7 +155,7 @@
 		pte_t * pte = pte_alloc_kernel(&init_mm, pmd, base + address);
 		if (!pte)
 			return -ENOMEM;
-		if (map_area_pte(pte, address, end - address, prot, pages))
+		if (map_area_pte(pte, base + address, end - address, prot, pages))
 			return -ENOMEM;
 		address = (address + PMD_SIZE) & PMD_MASK;
 		pmd++;
#10 lore raw
Quoted 11 lines · David S. Miller
Quoted 5 lines · On Sat, 26 Feb 2005 19:09:43 -0800 "David S. Miller" <[email protected]>…

I know of at least three such cases so far, vmalloc.c:unmap_area_pte(), vmalloc.c:map_area_pte(), and mprotect.c:change_pte_range()

The latter could definitely explain the behavior you are seeing on ppc64.

Ok, here's a fix, let me know if it makes the PPC64 problems go away Ben.

Test machine has been LTP'ing happily over night with that patch.

Ben.

#11 lore raw
Quoted 1 line · On Tue, 01 Mar 2005 12:45:28 +1100 Benjamin Herrenschmidt…

Test machine has been LTP'ing happily over night with that patch.

Great, along with the s390 build fix the tree should be ready to go once 2.6.12 opens up. I'll be sure to push it along.

Thanks everyone.

#12 lore raw
In reply to David S. Miller

And here's an updated version of your 3rd patch to make it apply on top of current bk (a small fix to hpte_update broke it).

arch/ppc/kernel/dma-mapping.c +5 -2
Index: linux-work/arch/ppc/kernel/dma-mapping.c
===================================================================
@@ -219,7 +219,8 @@
 	c = vm_region_alloc(&consistent_head, size,
 			    gfp & ~(__GFP_DMA | __GFP_HIGHMEM));
 	if (c) {
-		pte_t *pte = consistent_pte + CONSISTENT_OFFSET(c->vm_start);
+		unsigned long vaddr = c->vm_start;
+		pte_t *pte = consistent_pte + CONSISTENT_OFFSET(vaddr);
 		struct page *end = page + (1 << order);
 
 		/*
@@ -232,9 +233,11 @@
 
 			set_page_count(page, 1);
 			SetPageReserved(page);
-			set_pte(pte, mk_pte(page, pgprot_noncached(PAGE_KERNEL)));
+			set_pte_at(&init_mm, vaddr,
+				   pte, mk_pte(page, pgprot_noncached(PAGE_KERNEL)));
 			page++;
 			pte++;
+			vaddr += PAGE_SIZE;
 		} while (size -= PAGE_SIZE);
 
 		/*
arch/ppc/mm/init.c +0 -12
Index: linux-work/arch/ppc/mm/init.c
===================================================================
@@ -490,18 +490,6 @@
 		printk(KERN_INFO "AGP special page: 0x%08lx\n", agp_special_page);
 #endif
 
-	/* Make sure all our pagetable pages have page->mapping
-	   and page->index set correctly. */
-	for (addr = KERNELBASE; addr != 0; addr += PGDIR_SIZE) {
-		struct page *pg;
-		pmd_t *pmd = pmd_offset(pgd_offset_k(addr), addr);
-		if (pmd_present(*pmd)) {
-			pg = pmd_page(*pmd);
-			pg->mapping = (void *) &init_mm;
-			pg->index = addr;
-		}
-	}
-
 	mem_init_done = 1;
 }
 
arch/ppc/mm/pgtable.c +2 -12
Index: linux-work/arch/ppc/mm/pgtable.c
===================================================================
@@ -102,11 +102,6 @@
 
 	if (mem_init_done) {
 		pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
-		if (pte) {
-			struct page *ptepage = virt_to_page(pte);
-			ptepage->mapping = (void *) mm;
-			ptepage->index = address & PMD_MASK;
-		}
 	} else {
 		pte = (pte_t *)early_get_page();
 		if (pte)
@@ -126,11 +121,8 @@
 #endif
 
 	ptepage = alloc_pages(flags, 0);
-	if (ptepage) {
-		ptepage->mapping = (void *) mm;
-		ptepage->index = address & PMD_MASK;
+	if (ptepage)
 		clear_highpage(ptepage);
-	}
 	return ptepage;
 }
 
@@ -139,7 +131,6 @@
 #ifdef CONFIG_SMP
 	hash_page_sync();
 #endif
-	virt_to_page(pte)->mapping = NULL;
 	free_page((unsigned long)pte);
 }
 
@@ -148,7 +139,6 @@
 #ifdef CONFIG_SMP
 	hash_page_sync();
 #endif
-	ptepage->mapping = NULL;
 	__free_page(ptepage);
 }
 
@@ -298,7 +288,7 @@
 	pg = pte_alloc_kernel(&init_mm, pd, va);
 	if (pg != 0) {
 		err = 0;
-		set_pte(pg, pfn_pte(pa >> PAGE_SHIFT, __pgprot(flags)));
+		set_pte_at(&init_mm, va, pg, pfn_pte(pa >> PAGE_SHIFT, __pgprot(flags)));
 		if (mem_init_done)
 			flush_HPTE(0, va, pmd_val(*pd));
 	}
arch/ppc/mm/tlb.c +0 -20
Index: linux-work/arch/ppc/mm/tlb.c
===================================================================
@@ -47,26 +47,6 @@
 }
 
 /*
- * Called by ptep_test_and_clear_young()
- */
-void flush_hash_one_pte(pte_t *ptep)
-{
-	struct page *ptepage;
-	struct mm_struct *mm;
-	unsigned long ptephys;
-	unsigned long addr;
-
-	if (Hash == 0)
-		return;
-	
-	ptepage = virt_to_page(ptep);
-	mm = (struct mm_struct *) ptepage->mapping;
-	ptephys = __pa(ptep) & PAGE_MASK;
-	addr = ptepage->index + (((unsigned long)ptep & ~PAGE_MASK) << 10);
-	flush_hash_pages(mm->context, addr, ptephys, 1);
-}
-
-/*
  * Called by ptep_set_access_flags, must flush on CPUs for which the
  * DSI handler can't just "fixup" the TLB on a write fault
  */
arch/ppc64/mm/tlb.c +2 -13
Index: linux-work/arch/ppc64/mm/tlb.c
===================================================================
@@ -74,24 +74,13 @@
  * change the existing HPTE to read-only rather than removing it
  * (if we remove it we should clear the _PTE_HPTEFLAGS bits).
  */
-void hpte_update(pte_t *ptep, unsigned long pte, int wrprot)
+ void hpte_update(struct mm_struct *mm, unsigned long addr,
+		  unsigned long pte, int wrprot)
 {
-	struct page *ptepage;
-	struct mm_struct *mm;
-	unsigned long addr;
 	int i;
 	unsigned long context = 0;
 	struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch);
 
-	ptepage = virt_to_page(ptep);
-	mm = (struct mm_struct *) ptepage->mapping;
-	addr = ptepage->index;
-	if (pte_huge(pte))
-		addr +=  ((unsigned long)ptep & ~PAGE_MASK)
-			/ sizeof(*ptep) * HPAGE_SIZE;
-	else
-		addr += ((unsigned long)ptep & ~PAGE_MASK) * PTRS_PER_PTE;
-
 	if (REGION_ID(addr) == USER_REGION_ID)
 		context = mm->context.id;
 	i = batch->index;
include/asm-ppc/highmem.h +1 -1
Index: linux-work/include/asm-ppc/highmem.h
===================================================================
@@ -90,7 +90,7 @@
 #ifdef HIGHMEM_DEBUG
 	BUG_ON(!pte_none(*(kmap_pte+idx)));
 #endif
-	set_pte(kmap_pte+idx, mk_pte(page, kmap_prot));
+	set_pte_at(&init_mm, vaddr, kmap_pte+idx, mk_pte(page, kmap_prot));
 	flush_tlb_page(NULL, vaddr);
 
 	return (void*) vaddr;
include/asm-ppc/pgtable.h +33 -28

119 lines not on this page · raw message

include/asm-ppc64/pgalloc.h +6 -22
Index: linux-work/include/asm-ppc64/pgalloc.h
===================================================================
@@ -48,42 +48,26 @@
 #define pmd_populate(mm, pmd, pte_page) \
 	pmd_populate_kernel(mm, pmd, page_address(pte_page))
 
-static inline pte_t *
-pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
+static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
 {
-	pte_t *pte;
-	pte = kmem_cache_alloc(zero_cache, GFP_KERNEL|__GFP_REPEAT);
-	if (pte) {
-		struct page *ptepage = virt_to_page(pte);
-		ptepage->mapping = (void *) mm;
-		ptepage->index = address & PMD_MASK;
-	}
-	return pte;
+	return kmem_cache_alloc(zero_cache, GFP_KERNEL|__GFP_REPEAT);
 }
 
-static inline struct page *
-pte_alloc_one(struct mm_struct *mm, unsigned long address)
+static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
 {
-	pte_t *pte;
-	pte = kmem_cache_alloc(zero_cache, GFP_KERNEL|__GFP_REPEAT);
-	if (pte) {
-		struct page *ptepage = virt_to_page(pte);
-		ptepage->mapping = (void *) mm;
-		ptepage->index = address & PMD_MASK;
-		return ptepage;
-	}
+	pte_t *pte = kmem_cache_alloc(zero_cache, GFP_KERNEL|__GFP_REPEAT);
+	if (pte)
+		return virt_to_page(pte);
 	return NULL;
 }
 		
 static inline void pte_free_kernel(pte_t *pte)
 {
-	virt_to_page(pte)->mapping = NULL;
 	kmem_cache_free(zero_cache, pte);
 }
 
 static inline void pte_free(struct page *ptepage)
 {
-	ptepage->mapping = NULL;
 	kmem_cache_free(zero_cache, page_address(ptepage));
 }
 
include/asm-ppc64/pgtable.h +32 -20

129 lines not on this page · raw message

#13 lore raw
Quoted 2 lines · On Tue, 01 Mar 2005 13:22:18 +1100 Benjamin Herrenschmidt…

And here's an updated version of your 3rd patch to make it apply on top of current bk (a small fix to hpte_update broke it).

I should be able to resolve the conflict when I
re-root the tree for submission to Linus. If for
some reason I can't, sure I'll use your patch
thanks :-)

#14 lore raw
In reply to David S. Miller
Quoted 17 lines · David S. Miller

.../...
There are many pte level looping constructs of the form:

	pte = ...(pmd, address);
	address &= ~PMD_MASK;
	end = address + size;
	if (end > PMD_SIZE)
		end = PMD_SIZE;

	some_loop() {
		...
		set_pte_at(mm, address, pte);
		address += PAGE_SIZE;
		pte++;
		...
	}
Quoted 7 lines

This "address" mask screws everything up.

I know of at least three such cases so far, vmalloc.c:unmap_area_pte(), vmalloc.c:map_area_pte(), and mprotect.c:change_pte_range()

The latter could definitely explain the behavior you are seeing on ppc64.

Indeed. Sorry, didn't have a chance to test myself yet here, but that's definitely a bad one. Note that some of those functions use an address + base (which would work, I suspect that was a later fix to the ones that do pte_alloc etc...) and some use yet another scheme where the proper address is passed along (the ones precalculating "next"). I prefer the later version.

That's just another argument for having all these sharing common code, even if it's a bit bulky macro at first, the current state of affairs is just too prone to fail in weird ways.

Ben.

#15 lore raw
Quoted 3 lines · On Sun, 27 Feb 2005 20:35:57 +1100 Benjamin Herrenschmidt…

That's just another argument for having all these sharing common code, even if it's a bit bulky macro at first, the current state of affairs is just too prone to fail in weird ways.

Yep, the current situation is a joke. That's why any arguments against consolidation I hear will fall on deaf ears. I'm really tired of fixing bugs like these 5 or 6 times over instead of once.