[Crash-utility] Question about ARM module address range

Mika Westerberg mika.westerberg at iki.fi
Thu Aug 9 10:12:33 UTC 2012


On Thu, Jul 26, 2012 at 07:58:15AM +0200, Karlsson, Jan wrote:
> 
> This is the case with modules. In an example without modules the first range
> is not present, so your assumption how it works is correct. One thing that
> could be done to get the printout less confusing is to put 0xffffffff in
> modules_vaddr if no modules exist (and potentially put 0 in modules_end).

Can we put there the default (0xbf000000) when there is no modules? This thing
is documented in kernel Documentation/arm/memory.txt - modules are always
placed in that area no matter what. And I think it works better with live
session as well.

Something like following patch? It still gets the first vmalloc address from
the vmcore but if it is larger than what we expect we use the default.

Jan, Thomas, 

Can you check whether this still works with vmcores that have modules loaded?
My sample vmlinux/vmcores don't seem to have any modules loaded.

diff --git a/arm.c b/arm.c
index ea06e1a..7f63a10 100644
--- a/arm.c
+++ b/arm.c
@@ -305,14 +305,20 @@ arm_init(int when)
 			error(WARNING, "Couldn't retrieve crash_notes\n");
 		break;
 
-	case POST_VM:
+	case POST_VM: {
+		ulong vaddr;
+
 		machdep->machspec->vmalloc_start_addr = vt->high_memory;
 		/*
 		 * Modules are placed in first vmalloc'd area. This is 16MB
 		 * below PAGE_OFFSET.
 		 */
-		machdep->machspec->modules_vaddr = first_vmalloc_address();
 		machdep->machspec->modules_end = machdep->kvbase - 1;
+		vaddr = first_vmalloc_address();
+		if (vaddr > machdep->machspec->modules_end)
+			machdep->machspec->modules_vaddr = DEFAULT_MODULES_VADDR;
+		else
+			machdep->machspec->modules_vaddr = vaddr;
 
 		if (init_unwind_tables()) {
 			if (CRASHDEBUG(1))
@@ -323,6 +329,7 @@ arm_init(int when)
 		}
 		break;
 	}
+	}
 }
 
 void
@@ -614,7 +621,7 @@ static int
 arm_is_module_addr(ulong vaddr)
 {
 	ulong modules_start;
-	ulong modules_end = machdep->kvbase - 1;
+	ulong modules_end = machdep->machspec->modules_end;
 
 	if (!MODULES_VADDR) {
 		/*
@@ -622,7 +629,7 @@ arm_is_module_addr(ulong vaddr)
 		 * called, we use defaults here which is 16MB below kernel start
 		 * address.
 		 */
-		modules_start = machdep->kvbase - 16 * 1024 * 1024;
+		modules_start = DEFAULT_MODULES_VADDR;
 	} else {
 		modules_start = MODULES_VADDR;
 	}
diff --git a/defs.h b/defs.h
index caa87c0..e775e24 100755
--- a/defs.h
+++ b/defs.h
@@ -2438,6 +2438,7 @@ struct load_module {
 
 #define IS_VMALLOC_ADDR(X) 	arm_is_vmalloc_addr((ulong)(X))
 
+#define DEFAULT_MODULES_VADDR	(machdep->kvbase - 16 * 1024 * 1024)
 #define MODULES_VADDR   	(machdep->machspec->modules_vaddr)
 #define MODULES_END     	(machdep->machspec->modules_end)
 #define VMALLOC_START   	(machdep->machspec->vmalloc_start_addr)




More information about the Crash-utility mailing list