Skip to contentSkip to conversation

BUG: failure at mm/nommu.c:518/add_nommu_region()

DISCUSSION Greg Ungerer 2 participants 8 messages May 5, 2009 – May 7, 2009

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

Hi David,

I am getting this BUG_ON with linux-2.6.30-rc4-git1, that I wasn't getting with linux-2.6.30-rc3:

uClinux/COLDFIRE(m520x)
COLDFIRE port done by Greg Ungerer, [email protected]
Flat model support (C) 1998,1999 Kenneth Albanowski, D. Jeff Dionne Built 1 zonelists in Zone order, mobility grouping on. Total pages: 8128 Kernel command line: root=/dev/mtdblock0
NR_IRQS:256
PID hash table entries: 128 (order: 7, 512 bytes)
Dentry cache hash table entries: 4096 (order: 2, 16384 bytes) Inode-cache hash table entries: 2048 (order: 1, 8192 bytes) Memory available: 30160k/32768k RAM, (1144k kernel code, 159k data)
SLUB: Genslabs=13, HWalign=16, Order=0-3, MinObjects=0, CPUs=1, Nodes=1 Calibrating delay loop... 109.36 BogoMIPS (lpj=546816) Mount-cache hash table entries: 512
net_namespace: 520 bytes
NET: Registered protocol family 16
bio: create slab <bio-0> at 0
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes) TCP established hash table entries: 1024 (order: 1, 8192 bytes) TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
TCP reno registered
NET: Registered protocol family 1
ROMFS MTD (C) 2007 Red Hat, Inc.
io scheduler noop registered (default)
ColdFire internal UART serial driver
ttyS0 at MMIO 0xfc060000 (irq = 90) is a ColdFire UART console [ttyS0] enabled
ttyS1 at MMIO 0xfc064000 (irq = 91) is a ColdFire UART
ttyS2 at MMIO 0xfc068000 (irq = 92) is a ColdFire UART
brd: module loaded
FEC Ethernet Driver
fec: PHY @ 0x1, ID 0x20005c90 -- DP83848
eth0 (fec): not using net_device_ops yet
uclinux[mtd]: RAM probe address=0x40165e98 size=0xdc000 Creating 1 MTD partitions on "RAM":
0x000000000000-0x0000000dc000 : "ROMfs"
TCP cubic registered
NET: Registered protocol family 17
VFS: Mounted root (romfs filesystem) readonly on device 31:0. Freeing unused kernel memory: 44k freed (0x40150000 - 0x4015a000)

BUG: failure at mm/nommu.c:518/add_nommu_region()!
Kernel panic - not syncing: BUG!

This is on a ColdFire non-MMU target (using ROMfs with MTD backing store).

Could it be related to the recent changes to mm/nommu.c? I didn't revert those to see yet...

Removing the BUG_ON() I can boot all the way up, not sure if it is still a valid check.

Regards
Greg

------------------------------------------------------------------------

Greg Ungerer  --  Principal Engineer        EMAIL:     [email protected]
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
825 Stanley St,                             FAX:         +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia         WEB: http://www.SnapGear.com
#1 lore raw
Quoted 1 line · Greg Ungerer
BUG: failure at mm/nommu.c:518/add_nommu_region()!

Can you find out some more information about the region in question, perhaps with the attached patch?

Also if you can check to see whether the region is within the ROMFS image.

David
---

mm/nommu.c +12 -1
index cdc6f60..ba9e230 100644
@@ -515,7 +515,18 @@ static void add_nommu_region(struct vm_region *region)
 
 	validate_nommu_regions();
 
-	BUG_ON(region->vm_start & ~PAGE_MASK);
+	if (region->vm_start & ~PAGE_MASK) {
+		printk(KERN_ERR "___ REGION ERROR ___\n");
+		printk(KERN_ERR "%lx-%lx\n", region->vm_start, region->vm_end);
+		printk(KERN_ERR "fs=%s file=%s\n",
+		       region->vm_file ?
+		       region->vm_file->f_path.dentry->d_inode->i_sb->s_type->name :
+		       "*anon*",
+		       region->vm_file ?
+		       region->vm_file->f_path.dentry->d_name.name :
+		       (const unsigned char *) "*anon*");
+		BUG();
+	}
 
 	parent = NULL;
 	p = &nommu_region_tree.rb_node;
#2 lore raw

Hi David,

Quoted 6 lines · David Howells
Quoted 1 line · Greg Ungerer
BUG: failure at mm/nommu.c:518/add_nommu_region()!

Can you find out some more information about the region in question, perhaps with the attached patch?

Yep, last part of the boot log now:

...
uclinux[mtd]: RAM probe address=0x168fc0 size=0xd7000 Creating 1 MTD partitions on "RAM":
0x000000000000-0x0000000d7000 : "ROMfs"
TCP cubic registered
NET: Registered protocol family 17
VFS: Mounted root (romfs filesystem) readonly on device 31:0. Freeing unused kernel memory: 44k freed (0x152000 - 0x15c000) ___ REGION ERROR ___
18b790-191db0
fs=romfs file=init

BUG: failure at mm/nommu.c:532/add_nommu_region()!
Kernel panic - not syncing: BUG!
Quoted 1 line

Also if you can check to see whether the region is within the ROMFS image.

Yes, it is. As per the uclinux/mtd trace output (at top of trace above). The start physical address of the ROMFS is 0x168fc0, and it will end at 0x23ffc0.

Regards
Greg

Quoted 27 lines

David
---

mm/nommu.c +12 -1
index cdc6f60..ba9e230 100644
@@ -515,7 +515,18 @@ static void add_nommu_region(struct vm_region *region)
 
 	validate_nommu_regions();
 
-	BUG_ON(region->vm_start & ~PAGE_MASK);
+	if (region->vm_start & ~PAGE_MASK) {
+		printk(KERN_ERR "___ REGION ERROR ___\n");
+		printk(KERN_ERR "%lx-%lx\n", region->vm_start, region->vm_end);
+		printk(KERN_ERR "fs=%s file=%s\n",
+		       region->vm_file ?
+		       region->vm_file->f_path.dentry->d_inode->i_sb->s_type->name :
+		       "*anon*",
+		       region->vm_file ?
+		       region->vm_file->f_path.dentry->d_name.name :
+		       (const unsigned char *) "*anon*");
+		BUG();
+	}
 
 	parent = NULL;
 	p = &nommu_region_tree.rb_node;
Signature · 5 lines
------------------------------------------------------------------------
Greg Ungerer  --  Principal Engineer        EMAIL:     [email protected]
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
825 Stanley St,                             FAX:         +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia         WEB: http://www.SnapGear.com
#3 lore raw
Quoted 7 lines · Greg Ungerer

___ REGION ERROR ___
18b790-191db0
fs=romfs file=init

BUG: failure at mm/nommu.c:532/add_nommu_region()!
Kernel panic - not syncing: BUG!
Quoted 5 lines
Quoted 1 line

Also if you can check to see whether the region is within the ROMFS image.

Yes, it is. As per the uclinux/mtd trace output (at top of trace above). The start physical address of the ROMFS is 0x168fc0, and it will end at 0x23ffc0.

Okay... XIP regions must avoid the check.

David

#4 lore raw
In reply to Greg Ungerer

Can you try the attached patch, please?

David
---
From: David Howells <[email protected]>
Subject: [PATCH] NOMMU: Don't check vm_region::vm_start is page aligned in add_nommu_region()

Don't check vm_region::vm_start is page aligned in add_nommu_region() because the region may reflect some non-page-aligned mapped file, such as could be obtained from RomFS XIP.

---

 mm/nommu.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
mm/nommu.c +0 -2
index cdc6f60..325706b 100644
@@ -515,8 +515,6 @@ static void add_nommu_region(struct vm_region *region)
 
 	validate_nommu_regions();
 
-	BUG_ON(region->vm_start & ~PAGE_MASK);
-
 	parent = NULL;
 	p = &nommu_region_tree.rb_node;
 	while (*p) {
#5 lore raw

Hi David,

Quoted 1 line · David Howells

Can you try the attached patch, please?

Yes, that fixes it :-)

Regards
Greg

Quoted 29 lines

---
From: David Howells <[email protected]>
Subject: [PATCH] NOMMU: Don't check vm_region::vm_start is page aligned in add_nommu_region()

Don't check vm_region::vm_start is page aligned in add_nommu_region() because the region may reflect some non-page-aligned mapped file, such as could be obtained from RomFS XIP.

---

 mm/nommu.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
mm/nommu.c +0 -2
index cdc6f60..325706b 100644
@@ -515,8 +515,6 @@ static void add_nommu_region(struct vm_region *region)
 
 	validate_nommu_regions();
 
-	BUG_ON(region->vm_start & ~PAGE_MASK);
-
 	parent = NULL;
 	p = &nommu_region_tree.rb_node;
 	while (*p) {
Signature · 5 lines
------------------------------------------------------------------------
Greg Ungerer  --  Principal Engineer        EMAIL:     [email protected]
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
825 Stanley St,                             FAX:         +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia         WEB: http://www.SnapGear.com
#6 lore raw
Quoted 1 line · Greg Ungerer

Yes, that fixes it :-)

Can I add your Acked-by or Tested-by?

David

author Acked-by
#7 lore raw

Hi David,

Quoted 5 lines · David Howells
Quoted 1 line · Greg Ungerer

Yes, that fixes it :-)

Can I add your Acked-by or Tested-by?

Yes, absolutely:

Regards
Greg

------------------------------------------------------------------------

Greg Ungerer  --  Principal Engineer        EMAIL:     [email protected]
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
825 Stanley St,                             FAX:         +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia         WEB: http://www.SnapGear.com