[Crash-utility] crash ppc64 fixes to deal with per_cpu_offset changes

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

 



Hi,

After 2.6.15, ppc64 per_cpu_offsets are moved to "paca"
structure. Here is the patch to make crash read per-cpu-offsets
from paca structure.

Without this patch, you get following error while running
crash. Please apply.

crash: cannot determine idle task addresses from init_tasks[] or
runqueues[]

crash: cannot resolve "init_task_union"


Thanks,
Badari


After 2.6.15 ppc64 per_cpu_offset are stored in paca.
So, we need to read these from paca now.

Signed-off-by: Badari Pulavarty <pbadari@xxxxxxxxxx>
--- crash-4.0-2.20/defs.h	2006-01-11 06:16:11.000000000 -0800
+++ crash-4.0-2.20.new/defs.h	2006-02-13 14:34:33.000000000 -0800
@@ -1318,6 +1318,7 @@ struct size_table {         /* stash of 
 	long radix_tree_root;
 	long radix_tree_node;
 	long x8664_pda;
+	long ppc64_paca;
 	long gate_struct;
 	long tss_struct;
 	long task_struct_start_time;
@@ -1410,6 +1411,7 @@ struct builtin_debug_table {
 #define ULONGLONG(ADDR) *((ulonglong *)((char *)(ADDR)))
 #define ULONG_PTR(ADDR) *((ulong **)((char *)(ADDR)))
 #define USHORT(ADDR)    *((ushort *)((char *)(ADDR)))
+#define SHORT(ADDR)    *((short *)((char *)(ADDR)))
 #define VOID_PTR(ADDR)  *((void **)((char *)(ADDR)))
 
 struct node_table {
--- crash-4.0-2.20/ppc64.c	2006-01-11 06:16:11.000000000 -0800
+++ crash-4.0-2.20.new/ppc64.c	2006-02-13 14:33:51.000000000 -0800
@@ -48,6 +48,7 @@ static char * ppc64_check_eframe(struct 
 static void ppc64_print_eframe(char *, struct ppc64_pt_regs *, 
 		struct bt_info *);
 static void parse_cmdline_arg(void);
+static void ppc64_paca_init(void);
 
 struct machine_specific ppc64_machine_specific = { { 0 }, 0, 0 };
 
@@ -161,6 +162,8 @@ ppc64_init(int when)
 			m->l3_shift = m->l2_shift + m->l2_index_size;
 			m->l4_shift = m->l3_shift + m->l3_index_size;
 		}
+
+		ppc64_paca_init();
 		machdep->vmalloc_start = ppc64_vmalloc_start;
 		MEMBER_OFFSET_INIT(thread_struct_pg_tables,
 			"thread_struct", "pg_tables");
@@ -2222,4 +2225,47 @@ parse_cmdline_arg(void)
 		fprintf(fp, "\n");
 }
 
+static void
+ppc64_paca_init(void)
+{
+	int i, cpus, nr_paca;
+	char *cpu_paca_buf;
+	ulong data_offset;
+	ulong per_cpu_offset;
+	ulong cpuid_offset;
+	signed short cpuid;
+
+	if (!symbol_exists("paca"))
+		return;
+
+	if (!MEMBER_EXISTS("paca_struct", "data_offset"))
+		return;
+	
+	STRUCT_SIZE_INIT(ppc64_paca, "paca_struct");
+	cpuid_offset = MEMBER_OFFSET("paca_struct", "hw_cpu_id");
+	data_offset = MEMBER_OFFSET("paca_struct", "data_offset");
+
+	cpu_paca_buf = GETBUF(SIZE(ppc64_paca));
+
+	if (!(nr_paca = get_array_length("paca", NULL, 0)))
+		nr_paca = NR_CPUS;
+
+	for (i = cpus = 0; i < nr_paca; i++) {
+        	readmem(symbol_value("paca") + (i * SIZE(ppc64_paca)),
+             		KVADDR, cpu_paca_buf, SIZE(ppc64_paca),
+			"paca entry", FAULT_ON_ERROR);
+
+		cpuid = SHORT(cpu_paca_buf + cpuid_offset);
+		if (cpuid == -1)
+			continue;
+
+		per_cpu_offset = ULONG(cpu_paca_buf + data_offset); 
+		kt->__per_cpu_offset[i] = per_cpu_offset;
+		kt->flags |= PER_CPU_OFF;
+		cpus++;
+	}
+	kt->cpus = cpus;
+	if (kt->cpus > 1)
+		kt->flags |= SMP;
+}
 #endif /* PPC64 */ 

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

 

Powered by Linux