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

Dave Anderson anderson at redhat.com
Fri Apr 8 16:04:06 UTC 2016



----- Original Message -----
> 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.

Rabin,

I also added the new field to dump_offset_table().  Queued for crash-7.1.5:

  https://github.com/crash-utility/crash/commit/c1eb2b99e2d9201583aac5a664126d83039bddff

Thanks,
  Dave


> ---
>  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
> 
> --
> Crash-utility mailing list
> Crash-utility at redhat.com
> https://www.redhat.com/mailman/listinfo/crash-utility
> 




More information about the Crash-utility mailing list