Skip to contentSkip to conversation

Badness in map_area_pte

DISCUSSION Bob Breuer 4 participants 10 messages Jan 15, 2005 – Feb 5, 2005 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore

Bob Breuer

author
#0 lore raw

Badness in map_area_pte at mm/vmalloc.c:126
[f0062a8c : map_area_pud+0x50/0xac ] [f0062c20 : map_vm_area+0x94/0xd0 ] [f00631bc : __vmalloc+0xe0/0x134 ] [f0048124 : load_module+0x38/0x9dc ] [f0048b3c : sys_init_module+0x74/0x2dc ] [f0010cdc :
syscall_is_too_hard+0x34/0x40 ] [00020df8 : 0x20df8 ]

I am getting multiple stack dumps like this one when I do a "modprobe nfs" with kernel 2.6.11-rc1 on my SS20. This only happens when I use the framebuffer console (cg14), and when it happens the top part of the display gets corrupted.

Here is line 126 of vmalloc.c:
WARN_ON(!pte_none(*pte));

At this point, I am guessing that some pte's allocated for the framebuffer are being wrongly re-used when loading the module.

Bob

author
#1 lore raw
Quoted 3 lines · Bob Breuer

At this point, I am guessing that some pte's allocated for the framebuffer are being wrongly re-used when loading the module.

The cg14 driver is not remapping the framebuffer, and is using the mappings that were setup by the prom and recreated in linux from srmmu_inherit_prom_mappings().

How can we tell vmalloc not to step on that area of memory? Is it just from VMALLOC_START to END? Let's see, for 2.6 those are 0xfe600000 and 0xffc00000. The prom mapped the cg14 to 0xfe700000 (8MB ram) and 0xffec0000 (registers). Hmm, a bit of overlap there... And 2.4 had VMALLOC_START at 0xfe300000. So it would seem that if the total vmalloc'ed memory goes above 1 meg for me, 2.6 will have problems, but 2.4 will still be fine.

Bob

#2 lore raw
In reply to Bob Breuer
Quoted 2 lines · Bob Breuer
Quoted 2 lines

At this point, I am guessing that some pte's allocated for the framebuffer are being wrongly re-used when loading the module.

Quoted 10 lines · Bob Breuer

The cg14 driver is not remapping the framebuffer, and is using the mappings that were setup by the prom and recreated in linux from srmmu_inherit_prom_mappings().
How can we tell vmalloc not to step on that area of memory? Is it just from VMALLOC_START to END? Let's see, for 2.6 those are 0xfe600000 and 0xffc00000. The prom mapped the cg14 to 0xfe700000 (8MB ram) and 0xffec0000 (registers). Hmm, a bit of overlap there... And 2.4 had VMALLOC_START at 0xfe300000. So it would seem that if the total vmalloc'ed memory goes above 1 meg for me, 2.6 will have problems, but 2.4 will still be fine.

This sounds like a real problem. What happens if you move VMALLOC_START to where it was in 2.4.x?

-- wli

author
#3 lore raw
In reply to Bob Breuer
Quoted 20 lines · William Lee Irwin III
Quoted 2 lines · Bob Breuer
Quoted 2 lines

At this point, I am guessing that some pte's allocated for the framebuffer are being wrongly re-used when loading the module.

Quoted 10 lines · Bob Breuer

The cg14 driver is not remapping the framebuffer, and is using the mappings that were setup by the prom and recreated in linux from srmmu_inherit_prom_mappings().
How can we tell vmalloc not to step on that area of memory? Is it just from VMALLOC_START to END? Let's see, for 2.6 those are 0xfe600000 and 0xffc00000. The prom mapped the cg14 to 0xfe700000 (8MB ram) and 0xffec0000 (registers). Hmm, a bit of overlap there... And 2.4 had VMALLOC_START at 0xfe300000. So it would seem that if the total vmalloc'ed memory goes above 1 meg for me, 2.6 will have problems, but 2.4 will still be fine.

Quoted 3 lines

This sounds like a real problem. What happens if you move VMALLOC_START to where it was in 2.4.x?

Yes, changing it back fixes my problem for now.

The bitkeeper comments say it was changed 4 months ago to fix a framebuffer on a SparcStation 2. Looks like we need something more dynamic to cover all the bases.

Bob

#4 lore raw
In reply to Bob Breuer
Quoted 2 lines · William Lee Irwin III
Quoted 2 lines

This sounds like a real problem. What happens if you move VMALLOC_START to where it was in 2.4.x?

Quoted 4 lines · Bob Breuer

Yes, changing it back fixes my problem for now.
The bitkeeper comments say it was changed 4 months ago to fix a framebuffer on a SparcStation 2. Looks like we need something more dynamic to cover all the bases.

I suspected the same. Perhaps time to brew up another BTFIXUP.

-- wli

#5 lore raw
In reply to Bob Breuer
Quoted 1 line · William Lee Irwin III

I suspected the same. Perhaps time to brew up another BTFIXUP.

I tried to whip up a BTFIXUP patch for this, but it wouldn't work, since VMALLOC_START is in entry.S. Peter Jones took my patch and made a version that works. His patch to resolve this is attached.

~spot
---
Tom "spot" Callaway <tcallawa(a)redhat*com> LCA, RHCE Red Hat Sales Engineer || Aurora Linux Project Leader

"If you are going through hell, keep going."
-- Sir Winston Churchill

arch/sparc/kernel/entry.S renamed from arch/sparc/kernel/entry.S.BAD +3 -0
@@ -863,8 +863,11 @@
 	.globl	vac_hwflush_patch2
 
 	.align	4
+	.globl	vmalloc_start_addr
+vmalloc_start_addr:
+	.word	0xfe300000

.globl sun4c_fault

! %l0 = %psr
! %l1 = %pc
! %l2 = %npc
@@ -944,7 +947,8 @@
and %l5, %l4, %l5

/* Test for NULL pte_t * in vmalloc area. */
- sethi %hi(VMALLOC_START), %l4
+ sethi %hi(vmalloc_start_addr), %l4
+ ld [%l4 + %lo(vmalloc_start_addr)], %l4
cmp %l5, %l4
blu,a invalid_segment_patch1
lduXa [%l5] ASI_SEGMAP, %l4
@@ -1072,7 +1076,8 @@
andn %l4, 0x1ff, %l5

1:
- sethi %hi(VMALLOC_START), %l4
+ sethi %hi(vmalloc_start_addr), %l4
+ ld [%l4 + %lo(vmalloc_start_addr)], %l4
cmp %l5, %l4

bgeu 1f

arch/sparc/mm/init.c renamed from arch/sparc/mm/init.c.BAD +17 -0
@@ -402,6 +402,23 @@
 	int reservedpages = 0;
 	int i;
 
+	switch(sparc_cpu_model) {
+		case sun4:
+		case sun4c:
+			vmalloc_start_addr = VMALLOC_START_SUN4;
+			break;
+		case sun4d:
+		case sun4e:
+		case sun4m:
+			vmalloc_start_addr = VMALLOC_START_SUN4M;
+			break;
+		/* these are just to pacify gcc warnings */
+		case sun4u:
+		case sun_unknown:
+		case ap1000:
+			break;
+	};
+
 	if (PKMAP_BASE+LAST_PKMAP*PAGE_SIZE >= FIXADDR_START) {
 		prom_printf("BUG: fixmap and pkmap areas overlap\n");
 		prom_printf("pkbase: 0x%lx pkend: 0x%lx fixstart 0x%lx\n",
arch/sparc/mm/sun4c.c renamed from arch/sparc/mm/sun4c.c.BAD +1 -1
@@ -2085,7 +2085,7 @@
 	memset(pg3, 0, PAGE_SIZE);
 
 	/* Save work later. */
-	vaddr = VMALLOC_START;
+	vaddr = vmalloc_start_addr;
 	swapper_pg_dir[vaddr>>SUN4C_PGDIR_SHIFT] = __pgd(PGD_TABLE | (unsigned long) pg0);
 	vaddr += SUN4C_PGDIR_SIZE;
 	swapper_pg_dir[vaddr>>SUN4C_PGDIR_SHIFT] = __pgd(PGD_TABLE | (unsigned long) pg1);
include/asm-sparc/vaddrs.h renamed from include/asm-sparc/vaddrs.h.BAD +7 -1
@@ -35,7 +35,13 @@
 #define IOBASE_VADDR		0xfe000000
 #define IOBASE_END		0xfe600000
 
-#define VMALLOC_START		0xfe600000
+#ifndef __ASSEMBLY__
+extern unsigned long vmalloc_start_addr;
+#endif
+
+#define VMALLOC_START_SUN4	0xfe600000
+#define VMALLOC_START_SUN4M	0xfe300000
+#define VMALLOC_START		vmalloc_start_addr
 
 /* XXX Alter this when I get around to fixing sun4c - Anton */
 #define VMALLOC_END		0xffc00000
arch/sparc/kernel/sparc_ksyms.c renamed from arch/sparc/kernel/sparc_ksyms.c.BAD +1 -0
@@ -135,6 +135,7 @@
 EXPORT_SYMBOL(__down_trylock);
 EXPORT_SYMBOL(__down_interruptible);
 
+EXPORT_SYMBOL(vmalloc_start_addr);
 EXPORT_SYMBOL(sparc_valid_addr_bitmap);
 EXPORT_SYMBOL(phys_base);
 EXPORT_SYMBOL(pfn_base);
maintainer
#6 lore raw
In reply to Bob Breuer
Quoted 7 lines · On Fri, 04 Feb 2005 15:37:24 -0600 "Tom 'spot' Callaway" <[email protected]>…
Quoted 1 line · William Lee Irwin III

I suspected the same. Perhaps time to brew up another BTFIXUP.

I tried to whip up a BTFIXUP patch for this, but it wouldn't work, since VMALLOC_START is in entry.S. Peter Jones took my patch and made a version that works. His patch to resolve this is attached.

That entry.S code is all for sun4c, so you can use VMALLOC_START_SUN4C or whatever.

#7 lore raw
In reply to Bob Breuer
Quoted 5 lines · David S. Miller
Quoted 2 lines · On Fri, 04 Feb 2005 15:37:24 -0600 "Tom 'spot' Callaway" <[email protected]>…

On Sat, 2005-01-15 at 20:29 -0800, William Lee Irwin III wrote:

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

I suspected the same. Perhaps time to brew up another BTFIXUP.

I tried to whip up a BTFIXUP patch for this, but it wouldn't work, since VMALLOC_START is in entry.S. Peter Jones took my patch and made a version that works. His patch to resolve this is attached.

That entry.S code is all for sun4c, so you can use VMALLOC_START_SUN4C or whatever.

OK, how about this patch?

~spot
---
Tom "spot" Callaway <tcallawa(a)redhat*com> LCA, RHCE Red Hat Sales Engineer || Aurora Linux Project Leader

"If you are going through hell, keep going."
-- Sir Winston Churchill

arch/sparc/kernel/entry.S renamed from arch/sparc/kernel/entry.S.BAD +2 -2
@@ -944,7 +944,7 @@
 	 and	%l5, %l4, %l5
 
 	/* Test for NULL pte_t * in vmalloc area. */
-	sethi   %hi(VMALLOC_START), %l4
+	sethi   %hi(VMALLOC_START_SUN4), %l4
 	cmp     %l5, %l4
 	blu,a   invalid_segment_patch1
 	 lduXa	[%l5] ASI_SEGMAP, %l4
@@ -1072,7 +1072,7 @@
 	andn	%l4, 0x1ff, %l5
 
 1:
-	sethi	%hi(VMALLOC_START), %l4
+	sethi	%hi(VMALLOC_START_SUN4), %l4
 	cmp	%l5, %l4
 
 	bgeu	1f
arch/sparc/mm/init.c renamed from arch/sparc/mm/init.c.BAD +22 -0
@@ -44,6 +44,7 @@
 
 struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS+1];
 unsigned long sparc_unmapped_base;
+unsigned long vmalloc_start_addr;
 
 struct pgtable_cache_struct pgt_quicklists;
 
@@ -402,6 +403,27 @@
 	int reservedpages = 0;
 	int i;
 
+	switch(sparc_cpu_model) {
+	case sun4:
+	case sun4c:
+		vmalloc_start_addr = VMALLOC_START_SUN4;
+		BTFIXUPSET_SETHI(vmalloc_start_addr, VMALLOC_START_SUN4);
+		break;
+	case sun4d:
+	case sun4e:
+	case sun4m:
+		vmalloc_start_addr = VMALLOC_START_SUN4M;
+		BTFIXUPSET_SETHI(vmalloc_start_addr, VMALLOC_START_SUN4M);
+		break;
+	/* these are just to pacify gcc warnings */
+	case sun4u:
+	case sun_unknown:
+	case ap1000:
+	default:
+		break;
+	}
+
+
 	if (PKMAP_BASE+LAST_PKMAP*PAGE_SIZE >= FIXADDR_START) {
 		prom_printf("BUG: fixmap and pkmap areas overlap\n");
 		prom_printf("pkbase: 0x%lx pkend: 0x%lx fixstart 0x%lx\n",
include/asm-sparc/vaddrs.h renamed from include/asm-sparc/vaddrs.h.BAD +7 -1
@@ -35,7 +35,13 @@
 #define IOBASE_VADDR		0xfe000000
 #define IOBASE_END		0xfe600000
 
-#define VMALLOC_START		0xfe600000
+extern unsigned long vmalloc_start_addr;
+
+BTFIXUPDEF_SETHI(vmalloc_start_addr)
+
+#define VMALLOC_START_SUN4	0xfe600000
+#define VMALLOC_START_SUN4M	0xfe300000
+#define VMALLOC_START		BTFIXUP_SETHI(vmalloc_start_addr)
 
 /* XXX Alter this when I get around to fixing sun4c - Anton */
 #define VMALLOC_END		0xffc00000
#8 lore raw
In reply to Bob Breuer
Quoted 1 line · Tom 'spot' Callaway

OK, how about this patch?

Sorry. That patch was broken, this patch is not.

~spot
---
Tom "spot" Callaway <tcallawa(a)redhat*com> LCA, RHCE Red Hat Sales Engineer || Aurora Linux Project Leader

"If you are going through hell, keep going."
-- Sir Winston Churchill

arch/sparc/kernel/entry.S renamed from arch/sparc/kernel/entry.S.BAD +2 -2
@@ -944,7 +944,7 @@
 	 and	%l5, %l4, %l5
 
 	/* Test for NULL pte_t * in vmalloc area. */
-	sethi   %hi(VMALLOC_START), %l4
+	sethi   %hi(VMALLOC_START_SUN4), %l4
 	cmp     %l5, %l4
 	blu,a   invalid_segment_patch1
 	 lduXa	[%l5] ASI_SEGMAP, %l4
@@ -1072,7 +1072,7 @@
 	andn	%l4, 0x1ff, %l5
 
 1:
-	sethi	%hi(VMALLOC_START), %l4
+	sethi	%hi(VMALLOC_START_SUN4), %l4
 	cmp	%l5, %l4
 
 	bgeu	1f
arch/sparc/mm/init.c renamed from arch/sparc/mm/init.c.BAD +22 -0
@@ -44,6 +44,7 @@
 
 struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS+1];
 unsigned long sparc_unmapped_base;
+unsigned long vmalloc_start_addr;
 
 struct pgtable_cache_struct pgt_quicklists;
 
@@ -402,6 +403,27 @@
 	int reservedpages = 0;
 	int i;
 
+	switch(sparc_cpu_model) {
+	case sun4:
+	case sun4c:
+		vmalloc_start_addr = VMALLOC_START_SUN4;
+		BTFIXUPSET_SETHI(vmalloc_start_addr, VMALLOC_START_SUN4);
+		break;
+	case sun4d:
+	case sun4e:
+	case sun4m:
+		vmalloc_start_addr = VMALLOC_START_SUN4M;
+		BTFIXUPSET_SETHI(vmalloc_start_addr, VMALLOC_START_SUN4M);
+		break;
+	/* these are just to pacify gcc warnings */
+	case sun4u:
+	case sun_unknown:
+	case ap1000:
+	default:
+		break;
+	}
+
+
 	if (PKMAP_BASE+LAST_PKMAP*PAGE_SIZE >= FIXADDR_START) {
 		prom_printf("BUG: fixmap and pkmap areas overlap\n");
 		prom_printf("pkbase: 0x%lx pkend: 0x%lx fixstart 0x%lx\n",
include/asm-sparc/vaddrs.h renamed from include/asm-sparc/vaddrs.h.BAD +10 -1
@@ -3,6 +3,7 @@
 #define _SPARC_VADDRS_H
 
 #include <asm/head.h>
+#include <asm/btfixup.h>
 
 /*
  * asm-sparc/vaddrs.h:  Here we define the virtual addresses at
@@ -35,7 +36,15 @@
 #define IOBASE_VADDR		0xfe000000
 #define IOBASE_END		0xfe600000
 
-#define VMALLOC_START		0xfe600000
+#define VMALLOC_START_SUN4	0xfe600000
+#define VMALLOC_START_SUN4M	0xfe300000
+#ifndef __ASSEMBLY__
+extern unsigned long vmalloc_start_addr;
+
+BTFIXUPDEF_SETHI(vmalloc_start_addr)
+
+#define VMALLOC_START		BTFIXUP_SETHI(vmalloc_start_addr)
+#endif
 
 /* XXX Alter this when I get around to fixing sun4c - Anton */
 #define VMALLOC_END		0xffc00000