[Crash-utility] [PATCH] Fix irq -s for v4.2+

Rabin Vincent rabin.vincent at axis.com
Fri Apr 8 11:24:10 UTC 2016


From: Rabin Vincent <rabinv at axis.com>

Since v4.2, irq_data is no longer the first element in irq_desc, because
there is now an irq_common_data before it.  So we need to get the offset
of irq_data in irq_desc.

Side note: Since v4.3, affinity (used by irq -a) appears to have been
moved into the irq_common_data struct.  This patch doesn't handle that
but only fixes irq -s.
---
 defs.h   |  1 +
 kernel.c | 13 ++++++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/defs.h b/defs.h
index 2ecfa03..aaf9ba3 100644
--- a/defs.h
+++ b/defs.h
@@ -1950,6 +1950,7 @@ struct offset_table {                    /* stash of commonly-used offsets */
 	long pt_regs_cp0_badvaddr;
 	long address_space_page_tree;
 	long page_compound_head;
+	long irq_desc_irq_data;
 };
 
 struct size_table {         /* stash of commonly-used sizes */
diff --git a/kernel.c b/kernel.c
index 5d8a965..999fadd 100644
--- a/kernel.c
+++ b/kernel.c
@@ -523,6 +523,7 @@ kernel_init()
 	if (VALID_STRUCT(irq_data)) {
 		MEMBER_OFFSET_INIT(irq_data_chip, "irq_data", "chip");
 		MEMBER_OFFSET_INIT(irq_data_affinity, "irq_data", "affinity");
+		MEMBER_OFFSET_INIT(irq_desc_irq_data, "irq_desc", "irq_data");
 	}
 
         STRUCT_SIZE_INIT(irq_cpustat_t, "irq_cpustat_t");
@@ -6841,10 +6842,16 @@ generic_show_interrupts(int irq, ulong *cpus)
 		readmem(irq_desc_addr + OFFSET(irq_desc_t_chip), KVADDR,
 		        &handler, sizeof(long), "irq_desc chip",
 		        FAULT_ON_ERROR);
-	else if (VALID_MEMBER(irq_data_chip))
-		readmem(irq_desc_addr + OFFSET(irq_data_chip), KVADDR,
-		        &handler, sizeof(long), "irq_data chip",
+	else if (VALID_MEMBER(irq_data_chip)) {
+		ulong addr;
+
+		addr = irq_desc_addr + OFFSET(irq_data_chip);
+		if (VALID_MEMBER(irq_desc_irq_data))
+			addr += OFFSET(irq_desc_irq_data);
+
+		readmem(addr, KVADDR, &handler, sizeof(long), "irq_data chip",
 		        FAULT_ON_ERROR);
+	}
 
 	fprintf(fp, "%3d: ", irq);
 
-- 
2.7.0




More information about the Crash-utility mailing list