Hi Dave In kernels after 2.6.17, the hw_interrupt_type structure has been replaced by irq_chip, among other changes to the irq_desc kernel struct. This has broken the 'irq' command in crash. The following patch fixes this. Thanks Rachita Signed-off-by: Rachita Kothiyal <rachita@xxxxxxxxxx> --- defs.h | 16 +++ kernel.c | 298 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-------- symbols.c | 33 ++++++ 3 files changed, 310 insertions(+), 37 deletions(-) diff -puN kernel.c~crash-fix-irq-command kernel.c --- crash-4.0-3.5/kernel.c~crash-fix-irq-command 2006-10-18 18:50:40.765651800 +0530 +++ crash-4.0-3.5-rachita/kernel.c 2006-10-18 20:16:03.233918256 +0530 @@ -262,27 +262,66 @@ kernel_init() STRUCT_SIZE_INIT(hlist_node, "hlist_node"); MEMBER_OFFSET_INIT(irq_desc_t_status, "irq_desc_t", "status"); - MEMBER_OFFSET_INIT(irq_desc_t_handler, "irq_desc_t", "handler"); + if (MEMBER_EXISTS("irq_desc_t", "handler")) + MEMBER_OFFSET_INIT(irq_desc_t_handler, "irq_desc_t", "handler"); + else + MEMBER_OFFSET_INIT(irq_desc_t_chip, "irq_desc_t", "chip"); MEMBER_OFFSET_INIT(irq_desc_t_action, "irq_desc_t", "action"); MEMBER_OFFSET_INIT(irq_desc_t_depth, "irq_desc_t", "depth"); - MEMBER_OFFSET_INIT(hw_interrupt_type_typename, - "hw_interrupt_type", "typename"); - MEMBER_OFFSET_INIT(hw_interrupt_type_startup, - "hw_interrupt_type", "startup"); - MEMBER_OFFSET_INIT(hw_interrupt_type_shutdown, - "hw_interrupt_type", "shutdown"); - MEMBER_OFFSET_INIT(hw_interrupt_type_handle, - "hw_interrupt_type", "handle"); - MEMBER_OFFSET_INIT(hw_interrupt_type_enable, - "hw_interrupt_type", "enable"); - MEMBER_OFFSET_INIT(hw_interrupt_type_disable, - "hw_interrupt_type", "disable"); - MEMBER_OFFSET_INIT(hw_interrupt_type_ack, - "hw_interrupt_type", "ack"); - MEMBER_OFFSET_INIT(hw_interrupt_type_end, - "hw_interrupt_type", "end"); - MEMBER_OFFSET_INIT(hw_interrupt_type_set_affinity, - "hw_interrupt_type", "set_affinity"); + if (STRUCT_EXISTS("hw_interrupt_type")) { + MEMBER_OFFSET_INIT(hw_interrupt_type_typename, + "hw_interrupt_type", "typename"); + MEMBER_OFFSET_INIT(hw_interrupt_type_startup, + "hw_interrupt_type", "startup"); + MEMBER_OFFSET_INIT(hw_interrupt_type_shutdown, + "hw_interrupt_type", "shutdown"); + MEMBER_OFFSET_INIT(hw_interrupt_type_handle, + "hw_interrupt_type", "handle"); + MEMBER_OFFSET_INIT(hw_interrupt_type_enable, + "hw_interrupt_type", "enable"); + MEMBER_OFFSET_INIT(hw_interrupt_type_disable, + "hw_interrupt_type", "disable"); + MEMBER_OFFSET_INIT(hw_interrupt_type_ack, + "hw_interrupt_type", "ack"); + MEMBER_OFFSET_INIT(hw_interrupt_type_end, + "hw_interrupt_type", "end"); + MEMBER_OFFSET_INIT(hw_interrupt_type_set_affinity, + "hw_interrupt_type", "set_affinity"); + } else { /* + * On later kernels where hw_interrupt_type was replaced + * by irq_chip + */ + MEMBER_OFFSET_INIT(irq_chip_typename, + "irq_chip", "name"); + MEMBER_OFFSET_INIT(irq_chip_startup, + "irq_chip", "startup"); + MEMBER_OFFSET_INIT(irq_chip_shutdown, + "irq_chip", "shutdown"); + MEMBER_OFFSET_INIT(irq_chip_enable, + "irq_chip", "enable"); + MEMBER_OFFSET_INIT(irq_chip_disable, + "irq_chip", "disable"); + MEMBER_OFFSET_INIT(irq_chip_ack, + "irq_chip", "ack"); + MEMBER_OFFSET_INIT(irq_chip_mask, + "irq_chip", "mask"); + MEMBER_OFFSET_INIT(irq_chip_mask_ack, + "irq_chip", "mask_ack"); + MEMBER_OFFSET_INIT(irq_chip_unmask, + "irq_chip", "unmask"); + MEMBER_OFFSET_INIT(irq_chip_eoi, + "irq_chip", "eoi"); + MEMBER_OFFSET_INIT(irq_chip_end, + "irq_chip", "end"); + MEMBER_OFFSET_INIT(irq_chip_set_affinity, + "irq_chip", "set_affinity"); + MEMBER_OFFSET_INIT(irq_chip_retrigger, + "irq_chip", "retrigger"); + MEMBER_OFFSET_INIT(irq_chip_set_type, + "irq_chip", "set_type"); + MEMBER_OFFSET_INIT(irq_chip_set_wake, + "irq_chip", "set_wake"); + } MEMBER_OFFSET_INIT(irqaction_handler, "irqaction", "handler"); MEMBER_OFFSET_INIT(irqaction_flags, "irqaction", "flags"); MEMBER_OFFSET_INIT(irqaction_mask, "irqaction", "mask"); @@ -3588,8 +3627,14 @@ generic_dump_irq(int irq) readmem(irq_desc_addr + OFFSET(irq_desc_t_status), KVADDR, &status, sizeof(int), "irq_desc entry", FAULT_ON_ERROR); - readmem(irq_desc_addr + OFFSET(irq_desc_t_handler), KVADDR, &handler, - sizeof(long), "irq_desc entry", FAULT_ON_ERROR); + if (VALID_MEMBER(irq_desc_t_handler)) + readmem(irq_desc_addr + OFFSET(irq_desc_t_handler), KVADDR, + &handler, sizeof(long), "irq_desc entry", + FAULT_ON_ERROR); + else if (VALID_MEMBER(irq_desc_t_chip)) + readmem(irq_desc_addr + OFFSET(irq_desc_t_chip), KVADDR, + &handler, sizeof(long), "irq_desc entry", + FAULT_ON_ERROR); readmem(irq_desc_addr + OFFSET(irq_desc_t_action), KVADDR, &action, sizeof(long), "irq_desc entry", FAULT_ON_ERROR); readmem(irq_desc_addr + OFFSET(irq_desc_t_depth), KVADDR, &depth, @@ -3627,19 +3672,30 @@ generic_dump_irq(int irq) } else fprintf(fp, "%lx\n", handler); - if (handler) { - readmem(handler+OFFSET(hw_interrupt_type_typename), KVADDR, - &tmp1, sizeof(void *), - "hw_interrupt_type typename", FAULT_ON_ERROR); + if (handler) { + if (VALID_MEMBER(hw_interrupt_type_typename)) + readmem(handler+OFFSET(hw_interrupt_type_typename), + KVADDR, &tmp1, sizeof(void *), + "hw_interrupt_type typename", FAULT_ON_ERROR); + else if (VALID_MEMBER(irq_chip_typename)) + readmem(handler+OFFSET(irq_chip_typename), + KVADDR, &tmp1, sizeof(void *), + "hw_interrupt_type typename", FAULT_ON_ERROR); + fprintf(fp, " typename: %lx ", tmp1); BZERO(buf, BUFSIZE); if (read_string(tmp1, buf, BUFSIZE-1)) fprintf(fp, "\"%s\"", buf); fprintf(fp, "\n"); - readmem(handler+OFFSET(hw_interrupt_type_startup), KVADDR, - &tmp1, sizeof(void *), - "hw_interrupt_type startup", FAULT_ON_ERROR); + if (VALID_MEMBER(hw_interrupt_type_startup)) + readmem(handler+OFFSET(hw_interrupt_type_startup), + KVADDR, &tmp1, sizeof(void *), + "hw_interrupt_type startup", FAULT_ON_ERROR); + else if (VALID_MEMBER(irq_chip_startup)) + readmem(handler+OFFSET(irq_chip_startup), + KVADDR, &tmp1, sizeof(void *), + "hw_interrupt_type startup", FAULT_ON_ERROR); fprintf(fp, " startup: %lx ", tmp1); if (is_kernel_text(tmp1)) fprintf(fp, "<%s>", value_to_symstr(tmp1, buf, 0)); @@ -3650,9 +3706,15 @@ generic_dump_irq(int irq) value_to_symstr(tmp2, buf, 0)); fprintf(fp, "\n"); - readmem(handler+OFFSET(hw_interrupt_type_shutdown), KVADDR, - &tmp1, sizeof(void *), - "hw_interrupt_type shutdown", FAULT_ON_ERROR); + if (VALID_MEMBER(hw_interrupt_type_shutdown)) + readmem(handler+OFFSET(hw_interrupt_type_shutdown), + KVADDR, &tmp1, sizeof(void *), + "hw_interrupt_type shutdown", FAULT_ON_ERROR); + else if (VALID_MEMBER(irq_chip_shutdown)) + readmem(handler+OFFSET(irq_chip_shutdown), + KVADDR, &tmp1, sizeof(void *), + "hw_interrupt_type shutdown", FAULT_ON_ERROR); + fprintf(fp, " shutdown: %lx ", tmp1); if (is_kernel_text(tmp1)) fprintf(fp, "<%s>", value_to_symstr(tmp1, buf, 0)); @@ -3680,9 +3742,14 @@ generic_dump_irq(int irq) fprintf(fp, "\n"); } - readmem(handler+OFFSET(hw_interrupt_type_enable), KVADDR, - &tmp1, sizeof(void *), - "hw_interrupt_type enable", FAULT_ON_ERROR); + if (VALID_MEMBER(hw_interrupt_type_enable)) + readmem(handler+OFFSET(hw_interrupt_type_enable), + KVADDR, &tmp1, sizeof(void *), + "hw_interrupt_type enable", FAULT_ON_ERROR); + else if (VALID_MEMBER(irq_chip_enable)) + readmem(handler+OFFSET(irq_chip_enable), + KVADDR, &tmp1, sizeof(void *), + "hw_interrupt_type enable", FAULT_ON_ERROR); fprintf(fp, " enable: %lx ", tmp1); if (is_kernel_text(tmp1)) fprintf(fp, "<%s>", value_to_symstr(tmp1, buf, 0)); @@ -3693,9 +3760,14 @@ generic_dump_irq(int irq) value_to_symstr(tmp2, buf, 0)); fprintf(fp, "\n"); - readmem(handler+OFFSET(hw_interrupt_type_disable), KVADDR, - &tmp1, sizeof(void *), - "hw_interrupt_type disable", FAULT_ON_ERROR); + if (VALID_MEMBER(hw_interrupt_type_disable)) + readmem(handler+OFFSET(hw_interrupt_type_disable), + KVADDR, &tmp1, sizeof(void *), + "hw_interrupt_type disable", FAULT_ON_ERROR); + else if (VALID_MEMBER(irq_chip_disable)) + readmem(handler+OFFSET(irq_chip_disable), + KVADDR, &tmp1, sizeof(void *), + "hw_interrupt_type disable", FAULT_ON_ERROR); fprintf(fp, " disable: %lx ", tmp1); if (is_kernel_text(tmp1)) fprintf(fp, "<%s>", value_to_symstr(tmp1, buf, 0)); @@ -3720,6 +3792,84 @@ generic_dump_irq(int irq) fprintf(fp, "<%s>", value_to_symstr(tmp2, buf, 0)); fprintf(fp, "\n"); + } else if (VALID_MEMBER(irq_chip_ack)) { + readmem(handler+OFFSET(irq_chip_ack), KVADDR, + &tmp1, sizeof(void *), + "irq_chip ack", FAULT_ON_ERROR); + fprintf(fp, " ack: %lx ", tmp1); + if (is_kernel_text(tmp1)) + fprintf(fp, "<%s>", + value_to_symstr(tmp1, buf, 0)); + else if (readmem(tmp1, KVADDR, &tmp2, + sizeof(ulong), "ack indirection", + RETURN_ON_ERROR|QUIET) && is_kernel_text(tmp2)) + fprintf(fp, "<%s>", + value_to_symstr(tmp2, buf, 0)); + fprintf(fp, "\n"); + } + + if (VALID_MEMBER(irq_chip_mask)) { + readmem(handler+OFFSET(irq_chip_mask), KVADDR, + &tmp1, sizeof(void *), + "irq_chip mask", FAULT_ON_ERROR); + fprintf(fp, " mask: %lx ", tmp1); + if (is_kernel_text(tmp1)) + fprintf(fp, "<%s>", + value_to_symstr(tmp1, buf, 0)); + else if (readmem(tmp1, KVADDR, &tmp2, + sizeof(ulong), "mask indirection", + RETURN_ON_ERROR|QUIET) && is_kernel_text(tmp2)) + fprintf(fp, "<%s>", + value_to_symstr(tmp2, buf, 0)); + fprintf(fp, "\n"); + } + + if (VALID_MEMBER(irq_chip_mask_ack)) { + readmem(handler+OFFSET(irq_chip_mask_ack), KVADDR, + &tmp1, sizeof(void *), + "irq_chip mask_ack", FAULT_ON_ERROR); + fprintf(fp, " mask_ack: %lx ", tmp1); + if (is_kernel_text(tmp1)) + fprintf(fp, "<%s>", + value_to_symstr(tmp1, buf, 0)); + else if (readmem(tmp1, KVADDR, &tmp2, + sizeof(ulong), "mask_ack indirection", + RETURN_ON_ERROR|QUIET) && is_kernel_text(tmp2)) + fprintf(fp, "<%s>", + value_to_symstr(tmp2, buf, 0)); + fprintf(fp, "\n"); + } + + if (VALID_MEMBER(irq_chip_unmask)) { + readmem(handler+OFFSET(irq_chip_unmask), KVADDR, + &tmp1, sizeof(void *), + "irq_chip unmask", FAULT_ON_ERROR); + fprintf(fp, " unmask: %lx ", tmp1); + if (is_kernel_text(tmp1)) + fprintf(fp, "<%s>", + value_to_symstr(tmp1, buf, 0)); + else if (readmem(tmp1, KVADDR, &tmp2, + sizeof(ulong), "unmask indirection", + RETURN_ON_ERROR|QUIET) && is_kernel_text(tmp2)) + fprintf(fp, "<%s>", + value_to_symstr(tmp2, buf, 0)); + fprintf(fp, "\n"); + } + + if (VALID_MEMBER(irq_chip_eoi)) { + readmem(handler+OFFSET(irq_chip_eoi), KVADDR, + &tmp1, sizeof(void *), + "irq_chip eoi", FAULT_ON_ERROR); + fprintf(fp, " eoi: %lx ", tmp1); + if (is_kernel_text(tmp1)) + fprintf(fp, "<%s>", + value_to_symstr(tmp1, buf, 0)); + else if (readmem(tmp1, KVADDR, &tmp2, + sizeof(ulong), "eoi indirection", + RETURN_ON_ERROR|QUIET) && is_kernel_text(tmp2)) + fprintf(fp, "<%s>", + value_to_symstr(tmp2, buf, 0)); + fprintf(fp, "\n"); } if (VALID_MEMBER(hw_interrupt_type_end)) { @@ -3736,6 +3886,20 @@ generic_dump_irq(int irq) fprintf(fp, "<%s>", value_to_symstr(tmp2, buf, 0)); fprintf(fp, "\n"); + } else if (VALID_MEMBER(irq_chip_end)) { + readmem(handler+OFFSET(irq_chip_end), KVADDR, + &tmp1, sizeof(void *), + "irq_chip end", FAULT_ON_ERROR); + fprintf(fp, " end: %lx ", tmp1); + if (is_kernel_text(tmp1)) + fprintf(fp, "<%s>", + value_to_symstr(tmp1, buf, 0)); + else if (readmem(tmp1, KVADDR, &tmp2, + sizeof(ulong), "end indirection", + RETURN_ON_ERROR|QUIET) && is_kernel_text(tmp2)) + fprintf(fp, "<%s>", + value_to_symstr(tmp2, buf, 0)); + fprintf(fp, "\n"); } if (VALID_MEMBER(hw_interrupt_type_set_affinity)) { @@ -3753,6 +3917,66 @@ generic_dump_irq(int irq) fprintf(fp, "<%s>", value_to_symstr(tmp2, buf, 0)); fprintf(fp, "\n"); + } else if (VALID_MEMBER(irq_chip_set_affinity)) { + readmem(handler+OFFSET(irq_chip_set_affinity), + KVADDR, &tmp1, sizeof(void *), + "irq_chip set_affinity", + FAULT_ON_ERROR); + fprintf(fp, " set_affinity: %lx ", tmp1); + if (is_kernel_text(tmp1)) + fprintf(fp, "<%s>", + value_to_symstr(tmp1, buf, 0)); + else if (readmem(tmp1, KVADDR, &tmp2, + sizeof(ulong), "set_affinity indirection", + RETURN_ON_ERROR|QUIET) && is_kernel_text(tmp2)) + fprintf(fp, "<%s>", + value_to_symstr(tmp2, buf, 0)); + fprintf(fp, "\n"); + } + if (VALID_MEMBER(irq_chip_retrigger)) { + readmem(handler+OFFSET(irq_chip_retrigger), KVADDR, + &tmp1, sizeof(void *), + "irq_chip retrigger", FAULT_ON_ERROR); + fprintf(fp, " retrigger: %lx ", tmp1); + if (is_kernel_text(tmp1)) + fprintf(fp, "<%s>", + value_to_symstr(tmp1, buf, 0)); + else if (readmem(tmp1, KVADDR, &tmp2, + sizeof(ulong), "retrigger indirection", + RETURN_ON_ERROR|QUIET) && is_kernel_text(tmp2)) + fprintf(fp, "<%s>", + value_to_symstr(tmp2, buf, 0)); + fprintf(fp, "\n"); + } + if (VALID_MEMBER(irq_chip_set_type)) { + readmem(handler+OFFSET(irq_chip_set_type), KVADDR, + &tmp1, sizeof(void *), + "irq_chip set_type", FAULT_ON_ERROR); + fprintf(fp, " set_type: %lx ", tmp1); + if (is_kernel_text(tmp1)) + fprintf(fp, "<%s>", + value_to_symstr(tmp1, buf, 0)); + else if (readmem(tmp1, KVADDR, &tmp2, + sizeof(ulong), "set_type indirection", + RETURN_ON_ERROR|QUIET) && is_kernel_text(tmp2)) + fprintf(fp, "<%s>", + value_to_symstr(tmp2, buf, 0)); + fprintf(fp, "\n"); + } + if (VALID_MEMBER(irq_chip_set_wake)) { + readmem(handler+OFFSET(irq_chip_set_wake), KVADDR, + &tmp1, sizeof(void *), + "irq_chip set wake", FAULT_ON_ERROR); + fprintf(fp, " set_wake: %lx ", tmp1); + if (is_kernel_text(tmp1)) + fprintf(fp, "<%s>", + value_to_symstr(tmp1, buf, 0)); + else if (readmem(tmp1, KVADDR, &tmp2, + sizeof(ulong), "set_wake indirection", + RETURN_ON_ERROR|QUIET) && is_kernel_text(tmp2)) + fprintf(fp, "<%s>", + value_to_symstr(tmp2, buf, 0)); + fprintf(fp, "\n"); } } diff -puN defs.h~crash-fix-irq-command defs.h --- crash-4.0-3.5/defs.h~crash-fix-irq-command 2006-10-18 19:08:46.917531616 +0530 +++ crash-4.0-3.5-rachita/defs.h 2006-10-18 19:09:03.169061008 +0530 @@ -1039,6 +1039,7 @@ struct offset_table { long block_device_bd_disk; long irq_desc_t_status; long irq_desc_t_handler; + long irq_desc_t_chip; long irq_desc_t_action; long irq_desc_t_depth; long irqdesc_action; @@ -1059,6 +1060,21 @@ struct offset_table { long hw_interrupt_type_ack; long hw_interrupt_type_end; long hw_interrupt_type_set_affinity; + long irq_chip_typename; + long irq_chip_startup; + long irq_chip_shutdown; + long irq_chip_enable; + long irq_chip_disable; + long irq_chip_ack; + long irq_chip_end; + long irq_chip_set_affinity; + long irq_chip_mask; + long irq_chip_mask_ack; + long irq_chip_unmask; + long irq_chip_eoi; + long irq_chip_retrigger; + long irq_chip_set_type; + long irq_chip_set_wake; long irq_cpustat_t___softirq_active; long irq_cpustat_t___softirq_mask; long fdtable_max_fds; diff -puN symbols.c~crash-fix-irq-command symbols.c --- crash-4.0-3.5/symbols.c~crash-fix-irq-command 2006-10-18 19:11:29.829765192 +0530 +++ crash-4.0-3.5-rachita/symbols.c 2006-10-18 19:47:15.249611800 +0530 @@ -5961,6 +5961,8 @@ dump_offset_table(char *spec, ulong make OFFSET(irq_desc_t_status)); fprintf(fp, " irq_desc_t_handler: %ld\n", OFFSET(irq_desc_t_handler)); + fprintf(fp, " irq_desc_t_chip: %ld\n", + OFFSET(irq_desc_t_chip)); fprintf(fp, " irq_desc_t_action: %ld\n", OFFSET(irq_desc_t_action)); fprintf(fp, " irq_desc_t_depth: %ld\n", @@ -6006,6 +6008,37 @@ dump_offset_table(char *spec, ulong make fprintf(fp, "hw_interrupt_type_set_affinity: %ld\n", OFFSET(hw_interrupt_type_set_affinity)); + fprintf(fp, " irq_chip_typename: %ld\n", + OFFSET(irq_chip_typename)); + fprintf(fp, " irq_chip_startup: %ld\n", + OFFSET(irq_chip_startup)); + fprintf(fp, " irq_chip_shutdown: %ld\n", + OFFSET(irq_chip_shutdown)); + fprintf(fp, " irq_chip_enable: %ld\n", + OFFSET(irq_chip_enable)); + fprintf(fp, " irq_chip_disable: %ld\n", + OFFSET(irq_chip_disable)); + fprintf(fp, " irq_chip_ack: %ld\n", + OFFSET(irq_chip_ack)); + fprintf(fp, " irq_chip_mask: %ld\n", + OFFSET(irq_chip_mask)); + fprintf(fp, " irq_chip_mask_ack: %ld\n", + OFFSET(irq_chip_mask_ack)); + fprintf(fp, " irq_chip_unmask: %ld\n", + OFFSET(irq_chip_unmask)); + fprintf(fp, " irq_chip_eoi: %ld\n", + OFFSET(irq_chip_eoi)); + fprintf(fp, " irq_chip_end: %ld\n", + OFFSET(irq_chip_end)); + fprintf(fp, " irq_chip_set_affinity: %ld\n", + OFFSET(irq_chip_set_affinity)); + fprintf(fp, " irq_chip_retrigger: %ld\n", + OFFSET(irq_chip_retrigger)); + fprintf(fp, " irq_chip_set_type: %ld\n", + OFFSET(irq_chip_set_type)); + fprintf(fp, " irq_chip_set_wake: %ld\n", + OFFSET(irq_chip_set_wake)); + fprintf(fp, "irq_cpustat_t___softirq_active: %ld\n", OFFSET(irq_cpustat_t___softirq_active)); fprintf(fp, " irq_cpustat_t___softirq_mask: %ld\n", _ -- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/crash-utility