[PATCH] Add i386 linux-2.6.30 support.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

The latest crash (version 4.0-8.11) fails on i386 linux-2.6.30:

 # crash -s vmlinux vmcore

 crash: cannot resolve: "hardirq_ctx"

 #

The reason is that both hardirq_ctx and softirq_ctx have been defined
by DEFINE_PER_CPU() since linux-2.6.30. This change is the following:

  --- a/arch/x86/kernel/irq_32.c
  +++ b/arch/x86/kernel/irq_32.c
  [snip]
  -static union irq_ctx *hardirq_ctx[NR_CPUS] __read_mostly;
  -static union irq_ctx *softirq_ctx[NR_CPUS] __read_mostly;
  +static DEFINE_PER_CPU(union irq_ctx *, hardirq_ctx);
  +static DEFINE_PER_CPU(union irq_ctx *, softirq_ctx);

By this patch, the crash utility can read the dumpfile of i386 linux-2.6.30.


Thanks
Ken'ichi Ohmichi

Signed-off-by: Ken'ichi Ohmichi <oomichi@xxxxxxxxxxxxxxxxx>
---
--- a/task.c	2009-07-01 00:31:20.000000000 +0900
+++ b/task.c	2009-07-06 15:37:35.000000000 +0900
@@ -488,10 +488,27 @@ irqstacks_init(void)
 
 	thread_info_buf = GETBUF(SIZE(irq_ctx));
 
-        i = get_array_length("hardirq_ctx", NULL, 0);
-        get_symbol_data("hardirq_ctx",
-                sizeof(long)*(i <= NR_CPUS ? i : NR_CPUS),
-                &tt->hardirq_ctx[0]);
+	if (symbol_exists("hardirq_ctx")) {
+		i = get_array_length("hardirq_ctx", NULL, 0);
+		get_symbol_data("hardirq_ctx",
+			sizeof(long)*(i <= NR_CPUS ? i : NR_CPUS),
+			&tt->hardirq_ctx[0]);
+	} else if (symbol_exists("per_cpu__hardirq_ctx")) {
+		if ((kt->flags & SMP) && (kt->flags & PER_CPU_OFF)) {
+			for (i = 0; i < NR_CPUS; i++) {
+				if (!kt->__per_cpu_offset[i])
+					continue;
+				tt->hardirq_ctx[i] =
+					symbol_value("per_cpu__hardirq_ctx") +
+					kt->__per_cpu_offset[i];
+			}
+		} else {
+			tt->hardirq_ctx[0] =
+				symbol_value("per_cpu__hardirq_ctx");
+		}
+	} else {
+		error(FATAL, "cannot get hardirq_ctx.");
+	}
 
 	for (i = 0; i < NR_CPUS; i++) {
         	if (!(tt->hardirq_ctx[i]))
@@ -509,10 +526,27 @@ irqstacks_init(void)
 			ULONG(thread_info_buf+OFFSET(thread_info_task));
 	}
 
-        i = get_array_length("softirq_ctx", NULL, 0);
-        get_symbol_data("softirq_ctx",
-                sizeof(long)*(i <= NR_CPUS ? i : NR_CPUS),
-                &tt->softirq_ctx[0]);
+	if (symbol_exists("softirq_ctx")) {
+		i = get_array_length("softirq_ctx", NULL, 0);
+		get_symbol_data("softirq_ctx",
+			sizeof(long)*(i <= NR_CPUS ? i : NR_CPUS),
+			&tt->softirq_ctx[0]);
+	} else if (symbol_exists("per_cpu__softirq_ctx")) {
+		if ((kt->flags & SMP) && (kt->flags & PER_CPU_OFF)) {
+			for (i = 0; i < NR_CPUS; i++) {
+				if (!kt->__per_cpu_offset[i])
+					continue;
+				tt->softirq_ctx[i] =
+					symbol_value("per_cpu__softirq_ctx") +
+					kt->__per_cpu_offset[i];
+			}
+		} else {
+			 tt->softirq_ctx[0] =
+				symbol_value("per_cpu__softirq_ctx");
+		}
+	} else {
+		error(FATAL, "cannot get softirq_ctx.");
+	}
 
         for (i = 0; i < NR_CPUS; i++) {
                 if (!(tt->softirq_ctx[i]))

--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility

[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux