[Crash-utility] [PATCH] s390: support irq command via generic_dump_irq

Dave Anderson anderson at redhat.com
Mon Nov 17 18:52:27 UTC 2014



----- Original Message -----
> Hi,
> 
> here is a simple patch to rudimentary support the irq command on s390.
> Nothing special like irq statistics, just the plain list of irqs. Also
> this will only work on recent kernels. Old kernels (without
> GENERIC_HARDIRQ support) will print "cannot determine number of IRQs".
> 
> Regards,
> Sebastian

Queued for crash-7.1.0:

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

Thanks,
  Dave


> 
> From aa13aff5450686ac4438d771596e0faa041aa454 Mon Sep 17 00:00:00 2001
> From: Sebastian Ott <sebott at linux.vnet.ibm.com>
> Date: Fri, 14 Nov 2014 13:52:54 +0100
> Subject: [PATCH] s390: support irq command via generic_dump_irq
> 
> Signed-off-by: Sebastian Ott <sebott at linux.vnet.ibm.com>
> ---
>  kernel.c |  6 ------
>  s390.c   | 25 ++++++++++++-------------
>  s390x.c  | 24 +++++++++++-------------
>  3 files changed, 23 insertions(+), 32 deletions(-)
> 
> diff --git a/kernel.c b/kernel.c
> index 1cb0967..da1e48e 100644
> --- a/kernel.c
> +++ b/kernel.c
> @@ -5575,9 +5575,6 @@ cmd_irq(void)
>  			return;
>  
>  		case 'u':
> -			if (machine_type("S390") || machine_type("S390X"))
> -				command_not_supported();
> -
>  			pc->curcmd_flags |= IRQ_IN_USE;
>  			if (kernel_symbol_exists("no_irq_chip"))
>  				pc->curcmd_private = (ulonglong)symbol_value("no_irq_chip");
> @@ -5633,9 +5630,6 @@ cmd_irq(void)
>          if (argerrs)
>                  cmd_usage(pc->curcmd, SYNOPSIS);
>  
> -	if (machine_type("S390") || machine_type("S390X"))
> -		command_not_supported();
> -
>  	if ((nr_irqs = machdep->nr_irqs) == 0)
>  		error(FATAL, "cannot determine number of IRQs\n");
>  
> diff --git a/s390.c b/s390.c
> index 45da7c4..7740fe3 100644
> --- a/s390.c
> +++ b/s390.c
> @@ -57,7 +57,6 @@ static int s390_translate_pte(ulong, void *, ulonglong);
>  static ulong s390_processor_speed(void);
>  static int s390_eframe_search(struct bt_info *);
>  static void s390_back_trace_cmd(struct bt_info *);
> -static void s390_dump_irq(int);
>  static void s390_get_stack_frame(struct bt_info *, ulong *, ulong *);
>  static int s390_dis_filter(ulong, char *, unsigned int);
>  static void s390_cmd_mach(void);
> @@ -146,9 +145,18 @@ s390_init(int when)
>  		break;
>  
>  	case POST_GDB:
> -		machdep->nr_irqs = 0;  /* TBD */
> +
> +		if (symbol_exists("irq_desc"))
> +			ARRAY_LENGTH_INIT(machdep->nr_irqs, irq_desc,
> +					  "irq_desc", NULL, 0);
> +		else if (kernel_symbol_exists("nr_irqs"))
> +			get_symbol_data("nr_irqs", sizeof(unsigned int),
> +					&machdep->nr_irqs);
> +		else
> +			machdep->nr_irqs = 0;
> +
>  		machdep->vmalloc_start = s390_vmalloc_start;
> -		machdep->dump_irq = s390_dump_irq;
> +		machdep->dump_irq = generic_dump_irq;
>  		if (!machdep->hz)
>  			machdep->hz = HZ;
>  		machdep->section_size_bits = _SECTION_SIZE_BITS;
> @@ -194,7 +202,7 @@ s390_dump_machdep_table(ulong arg)
>  	fprintf(fp, "              uvtop: s390_uvtop()\n");
>  	fprintf(fp, "              kvtop: s390_kvtop()\n");
>  	fprintf(fp, "       get_task_pgd: s390_get_task_pgd()\n");
> -	fprintf(fp, "           dump_irq: s390_dump_irq()\n");
> +	fprintf(fp, "           dump_irq: generic_dump_irq()\n");
>  	fprintf(fp, "    get_stack_frame: s390_get_stack_frame()\n");
>  	fprintf(fp, "      get_stackbase: generic_get_stackbase()\n");
>  	fprintf(fp, "       get_stacktop: generic_get_stacktop()\n");
> @@ -954,15 +962,6 @@ s390_get_stack_frame(struct bt_info *bt, ulong *eip,
> ulong *esp)
>  }
>  
>  /*
> - *  cmd_irq() is not implemented for s390.
> - */
> -static void
> -s390_dump_irq(int irq)
> -{
> -	error(FATAL, "s390_dump_irq: TBD\n");
> -}
> -
> -/*
>   *  Filter disassembly output if the output radix is not gdb's default 10
>   */
>  static int
> diff --git a/s390x.c b/s390x.c
> index 5bd7a81..7d1310f 100644
> --- a/s390x.c
> +++ b/s390x.c
> @@ -104,7 +104,6 @@ static int s390x_translate_pte(ulong, void *, ulonglong);
>  static ulong s390x_processor_speed(void);
>  static int s390x_eframe_search(struct bt_info *);
>  static void s390x_back_trace_cmd(struct bt_info *);
> -static void s390x_dump_irq(int);
>  static void s390x_get_stack_frame(struct bt_info *, ulong *, ulong *);
>  static int s390x_dis_filter(ulong, char *, unsigned int);
>  static void s390x_cmd_mach(void);
> @@ -412,9 +411,17 @@ s390x_init(int when)
>  		break;
>  
>  	case POST_GDB:
> -		machdep->nr_irqs = 0;  /* TBD */
> +		if (symbol_exists("irq_desc"))
> +			ARRAY_LENGTH_INIT(machdep->nr_irqs, irq_desc,
> +					  "irq_desc", NULL, 0);
> +		else if (kernel_symbol_exists("nr_irqs"))
> +			get_symbol_data("nr_irqs", sizeof(unsigned int),
> +					&machdep->nr_irqs);
> +		else
> +			machdep->nr_irqs = 0;
> +
>  		machdep->vmalloc_start = s390x_vmalloc_start;
> -		machdep->dump_irq = s390x_dump_irq;
> +		machdep->dump_irq = generic_dump_irq;
>  		if (!machdep->hz)
>  			machdep->hz = HZ;
>  		machdep->section_size_bits = _SECTION_SIZE_BITS;
> @@ -462,7 +469,7 @@ s390x_dump_machdep_table(ulong arg)
>  	fprintf(fp, "              uvtop: s390x_uvtop()\n");
>  	fprintf(fp, "              kvtop: s390x_kvtop()\n");
>  	fprintf(fp, "       get_task_pgd: s390x_get_task_pgd()\n");
> -	fprintf(fp, "           dump_irq: s390x_dump_irq()\n");
> +	fprintf(fp, "           dump_irq: generic_dump_irq()\n");
>  	fprintf(fp, "    get_stack_frame: s390x_get_stack_frame()\n");
>  	fprintf(fp, "      get_stackbase: generic_get_stackbase()\n");
>  	fprintf(fp, "       get_stacktop: generic_get_stacktop()\n");
> @@ -1413,15 +1420,6 @@ s390x_get_stack_frame(struct bt_info *bt, ulong *eip,
> ulong *esp)
>  }
>  
>  /*
> - *  cmd_irq() is not implemented for s390x.
> - */
> -static void
> -s390x_dump_irq(int irq)
> -{
> -	error(FATAL, "s390x_dump_irq: TBD\n");
> -}
> -
> -/*
>   *  Filter disassembly output if the output radix is not gdb's default 10
>   */
>  static int
> --
> 1.8.5.5
> 
> 




More information about the Crash-utility mailing list