在 2020年08月18日 14:46, HAGIO KAZUHITO(萩尾 一仁) 写道:
> On kernels that contain commit 9df872faa7e1 ("genirq: Move field
> 'affinity' from irq_data into irq_common_data"), without the patch,
> the "irq -a" option cannot work with the message "irq: -a option not
> supported or applicable on this architecture or kernel".
> 
> Signed-off-by: Kazuhito Hagio <k-hagio...@nec.com>
> ---
>  defs.h    |  3 +++
>  kernel.c  | 18 +++++++++++++-----
>  symbols.c |  5 +++++
>  3 files changed, 21 insertions(+), 5 deletions(-)
> 
> diff --git a/defs.h b/defs.h
> index 17e98763362b..ad91bfe184fc 100644
> --- a/defs.h
> +++ b/defs.h
> @@ -2089,6 +2089,8 @@ struct offset_table {                    /* stash of 
> commonly-used offsets */
>       long size_class_size;
>       long gendisk_private_data;
>       long zram_table_entry;
> +     long irq_common_data_affinity;
> +     long irq_desc_irq_common_data;
>  };
>  
>  struct size_table {         /* stash of commonly-used sizes */
> @@ -2247,6 +2249,7 @@ struct size_table {         /* stash of commonly-used 
> sizes */
>       long xarray;
>       long xa_node;
>       long zram_table_entry;
> +     long irq_common_data;
>  };
>  
>  struct array_table {
> diff --git a/kernel.c b/kernel.c
> index 5ed602108b87..15f9ab4b8449 100644
> --- a/kernel.c
> +++ b/kernel.c
> @@ -550,6 +550,12 @@ kernel_init()
>               MEMBER_OFFSET_INIT(irq_desc_irq_data, "irq_desc", "irq_data");
>       }
>  
> +     STRUCT_SIZE_INIT(irq_common_data, "irq_common_data");
> +     if (VALID_STRUCT(irq_common_data)) {
> +             MEMBER_OFFSET_INIT(irq_common_data_affinity, "irq_common_data", 
> "affinity");
> +             MEMBER_OFFSET_INIT(irq_desc_irq_common_data, "irq_desc", 
> "irq_common_data");
> +     }
> +
>          STRUCT_SIZE_INIT(irq_cpustat_t, "irq_cpustat_t");
>          MEMBER_OFFSET_INIT(irq_cpustat_t___softirq_active, 
>                  "irq_cpustat_t", "__softirq_active");
> @@ -6331,10 +6337,9 @@ cmd_irq(void)
>                       if (!machdep->get_irq_affinity)
>                               option_not_supported(c);
>  
> -                     if (VALID_STRUCT(irq_data)) {
> -                             if (INVALID_MEMBER(irq_data_affinity))
> -                                     option_not_supported(c);
> -                     } else if (INVALID_MEMBER(irq_desc_t_affinity))
> +                     if (INVALID_MEMBER(irq_data_affinity) &&
> +                         INVALID_MEMBER(irq_common_data_affinity) &&
> +                         INVALID_MEMBER(irq_desc_t_affinity))
>                               option_not_supported(c);
>  
>                       if ((nr_irqs = machdep->nr_irqs) == 0)
> @@ -7096,7 +7101,10 @@ generic_get_irq_affinity(int irq)
>               len = DIV_ROUND_UP(kt->cpus, BITS_PER_LONG) * sizeof(ulong);
>  
>       affinity = (ulong *)GETBUF(len);
> -     if (VALID_STRUCT(irq_data))
> +     if (VALID_MEMBER(irq_common_data_affinity))
> +             tmp_addr = irq_desc_addr + OFFSET(irq_desc_irq_common_data)
> +                             + OFFSET(irq_common_data_affinity);
> +     else if (VALID_MEMBER(irq_data_affinity))
>               tmp_addr = irq_desc_addr + \
>                          OFFSET(irq_data_affinity);
>       else
> diff --git a/symbols.c b/symbols.c
> index 2fecaee093a2..d18c88f2f3b0 100644
> --- a/symbols.c
> +++ b/symbols.c
> @@ -9310,8 +9310,12 @@ dump_offset_table(char *spec, ulong makestruct)
>               OFFSET(irq_data_chip));
>       fprintf(fp, "             irq_data_affinity: %ld\n",
>               OFFSET(irq_data_affinity));
> +     fprintf(fp, "      irq_common_data_affinity: %ld\n",
> +             OFFSET(irq_common_data_affinity));
>       fprintf(fp, "             irq_desc_irq_data: %ld\n",
>               OFFSET(irq_desc_irq_data));
> +     fprintf(fp, "      irq_desc_irq_common_data: %ld\n",
> +             OFFSET(irq_desc_irq_common_data));
>       fprintf(fp, "              kernel_stat_irqs: %ld\n",
>               OFFSET(kernel_stat_irqs));
>  
> @@ -10663,6 +10667,7 @@ dump_offset_table(char *spec, ulong makestruct)
>       fprintf(fp, "                      runqueue: %ld\n", SIZE(runqueue));
>       fprintf(fp, "                    irq_desc_t: %ld\n", SIZE(irq_desc_t));
>       fprintf(fp, "                      irq_data: %ld\n", SIZE(irq_data));
> +     fprintf(fp, "               irq_common_data: %ld\n", 
> SIZE(irq_common_data));
>       fprintf(fp, "                    task_union: %ld\n", SIZE(task_union));
>       fprintf(fp, "                  thread_union: %ld\n", 
> SIZE(thread_union));
>       fprintf(fp, "                    prio_array: %ld\n", SIZE(prio_array));
> 

It looks good to me. Thank you for the patch.

Acked-by: Lianbo Jiang <liji...@redhat.com>

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility

Reply via email to