<div dir="ltr"><div dir="ltr">Hi, Sven and Kazu<br></div><div dir="ltr"><br></div><div>The patchset really saves compilation time for crash build and the following three patches look good to me(need a minor adjustment as Kazu mentioned).</div><div>Thank you for the work, Sven.</div><div><br></div><div>[PATCH v2 1/4] make: set --no-print-directory once<br>[PATCH v2 3/4] make: use -C instead of (cd x; make)<br>[PATCH v2 4/4] make: replace make by $(MAKE)</div><div><br></div><div>Given that the gdb patch has specific rules,  Kazu(or me) can help to pack them into one patch with Sven's signature, if you have no objections.</div><div>Or could you please update the patchset? Sven.<br></div><div><br></div><div>Thanks.</div><div>Lianbo</div><div><br></div><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 23, 2021 at 5:14 PM <<a href="mailto:crash-utility-request@redhat.com">crash-utility-request@redhat.com</a>> wrote:</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Date: Thu, 23 Dec 2021 00:33:16 +0000<br>
From: HAGIO KAZUHITO(?????)     <<a href="mailto:k-hagio-ab@nec.com" target="_blank">k-hagio-ab@nec.com</a>><br>
To: Sven Schnelle <<a href="mailto:svens@linux.ibm.com" target="_blank">svens@linux.ibm.com</a>><br>
Cc: "Discussion list for crash utility usage,   maintenance and<br>
        development" <<a href="mailto:crash-utility@redhat.com" target="_blank">crash-utility@redhat.com</a>><br>
Subject: Re: [Crash-utility] [PATCH v2 4/4] make: replace make by<br>
        $(MAKE)<br>
Message-ID:<br>
        <<a href="mailto:OS3PR01MB677601D042591DF6451F477DDD7E9@OS3PR01MB6776.jpnprd01.prod.outlook.com" target="_blank">OS3PR01MB677601D042591DF6451F477DDD7E9@OS3PR01MB6776.jpnprd01.prod.outlook.com</a>><br>
<br>
Content-Type: text/plain; charset="iso-2022-jp"<br>
<br>
Hi Sven,<br>
<br>
thank you for the update.<br>
<br>
-----Original Message-----<br>
> diff --git a/gdb-10.2.patch b/gdb-10.2.patch<br>
> index 1280d0688e83..afdbe99eae0d 100644<br>
> --- a/gdb-10.2.patch<br>
> +++ b/gdb-10.2.patch<br>
> @@ -73,7 +73,7 @@<br>
>   # Removing the old gdb first works better if it is running, at least on SunOS.<br>
>   gdb$(EXEEXT): gdb.o $(LIBGDB_OBS) $(CDEPS) $(TDEPLIBS)<br>
>       $(SILENCE) rm -f gdb$(EXEEXT)<br>
> -+    @make -C ../.. GDB_FLAGS=-DGDB_10_2 library<br>
> ++    @$(MAKE) -C ../.. GDB_FLAGS=-DGDB_10_2 library<br>
>       $(ECHO_CXXLD) $(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) \<br>
>  -            -o gdb$(EXEEXT) gdb.o $(LIBGDB_OBS) \<br>
>  -            $(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES)<br>
<br>
When detecting any change of the gdb patch, it tries to re-apply the new one<br>
using "patch -N --fuzz=0" in order to update the gdb.  Please refer to<br>
Makefile::rebuild and the head of the gdb-10.2.patch.<br>
<br>
So I think that, to make a change to the gdb sources,<br>
<br>
1. we have to "add" patches to the end of the gdb patch, and<br>
2. if there are multiple patches for a gdb file, the "patch -N" doesn't work,<br>
so we have to revert the gdb file to the original one.<br>
<br>
(I will add this custom to crash guidelines later..)<br>
<br>
In your patches, there are multiple patches for gdb-10.2/gdb/Makefile.in<br>
so I would suggest that:<br>
<br>
1. pack the 1/4, 3/4 and 4/4 patches into a patch, do the three things together.<br>
2. add a hunk for the gdb-10.2/gdb/Makefile.in to the end of the gdb-10.2.patch.<br>
3. add the following change to the head the gdb-10.2.patch.<br>
<br>
--- a/gdb-10.2.patch<br>
+++ b/gdb-10.2.patch<br>
@@ -8,6 +8,11 @@<br>
 # shell script that can restore any gdb file to its original state prior<br>
 # to all subsequent patch applications.<br>
<br>
+tar xvzmf gdb-10.2.tar.gz \<br>
+       gdb-10.2/gdb/Makefile.in<br>
+<br>
+exit 0<br>
+<br>
<br>
(yeah, we forgot the "exit 0" here when moving to gdb-10.2..)<br>
<br>
Thanks,<br>
Kazu<br>
<br>
<br>
<br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Thu, 23 Dec 2021 14:42:33 +0800<br>
From: Lianbo Jiang <<a href="mailto:lijiang@redhat.com" target="_blank">lijiang@redhat.com</a>><br>
To: <a href="mailto:crash-utility@redhat.com" target="_blank">crash-utility@redhat.com</a><br>
Subject: [Crash-utility] [PATCH] Handle blk_mq_ctx member changes for<br>
        kernels v5.16-rc1~75^2~44<br>
Message-ID: <<a href="mailto:20211223064233.16028-1-lijiang@redhat.com" target="_blank">20211223064233.16028-1-lijiang@redhat.com</a>><br>
<br>
Kernel commit <9a14d6ce4135> ("block: remove debugfs blk_mq_ctx<br>
dispatched/merged/completed attributes") removed the member<br>
rq_dispatched and rq_completed from struct blk_mq_ctx. Without<br>
this patch, crash will fail with the following error:<br>
<br>
crash> dev -d<br>
MAJOR GENDISK            NAME       REQUEST_QUEUE      TOTAL ASYNC  SYNC<br>
<br>
dev: invalid structure member offset: blk_mq_ctx_rq_dispatched<br>
     FILE: dev.c  LINE: 4229  FUNCTION: get_one_mctx_diskio()<br>
<br>
Signed-off-by: Lianbo Jiang <<a href="mailto:lijiang@redhat.com" target="_blank">lijiang@redhat.com</a>><br>
---<br>
 dev.c | 4 ++++<br>
 1 file changed, 4 insertions(+)<br>
<br>
diff --git a/dev.c b/dev.c<br>
index effe789f38d8..dd21511e5dfc 100644<br>
--- a/dev.c<br>
+++ b/dev.c<br>
@@ -4246,6 +4246,10 @@ get_mq_diskio(unsigned long q, unsigned long *mq_count)<br>
        unsigned long mctx_addr;<br>
        struct diskio tmp;<br>
<br>
+       if (!MEMBER_EXISTS("blk_mq_ctx", "rq_dispatched") &&<br>
+               !MEMBER_EXISTS("blk_mq_ctx", "rq_completed"))<br>
+               return;<br>
+<br>
        memset(&tmp, 0x00, sizeof(struct diskio));<br>
<br>
        readmem(q + OFFSET(request_queue_queue_ctx), KVADDR, &queue_ctx,<br>
-- <br>
2.20.1<br>
<br>
<br>
<br>
------------------------------<br>
<br>
Message: 3<br>
Date: Thu, 23 Dec 2021 09:13:19 +0000<br>
From: "<a href="mailto:d.hatayama@fujitsu.com" target="_blank">d.hatayama@fujitsu.com</a>" <<a href="mailto:d.hatayama@fujitsu.com" target="_blank">d.hatayama@fujitsu.com</a>><br>
To: "<a href="mailto:shogo.matsumoto@fujitsu.com" target="_blank">shogo.matsumoto@fujitsu.com</a>" <<a href="mailto:shogo.matsumoto@fujitsu.com" target="_blank">shogo.matsumoto@fujitsu.com</a>><br>
Cc: "'<a href="mailto:crash-utility@redhat.com" target="_blank">crash-utility@redhat.com</a>'" <<a href="mailto:crash-utility@redhat.com" target="_blank">crash-utility@redhat.com</a>><br>
Subject: Re: [Crash-utility] [PATCH] log: output logs of printk safe<br>
        buffers<br>
Message-ID:<br>
        <<a href="mailto:TYAPR01MB6507BFD2235A5C6806C3D0E5957E9@TYAPR01MB6507.jpnprd01.prod.outlook.com" target="_blank">TYAPR01MB6507BFD2235A5C6806C3D0E5957E9@TYAPR01MB6507.jpnprd01.prod.outlook.com</a>><br>
<br>
Content-Type: text/plain; charset="iso-2022-jp"<br>
<br>
Hi,<br>
<br>
> <br>
> ________________________________________<br>
> From: <a href="mailto:crash-utility-bounces@redhat.com" target="_blank">crash-utility-bounces@redhat.com</a> <<a href="mailto:crash-utility-bounces@redhat.com" target="_blank">crash-utility-bounces@redhat.com</a>> on behalf of <a href="mailto:shogo.matsumoto@fujitsu.com" target="_blank">shogo.matsumoto@fujitsu.com</a> <<a href="mailto:shogo.matsumoto@fujitsu.com" target="_blank">shogo.matsumoto@fujitsu.com</a>><br>
> Sent: Thursday, December 16, 2021 16:39<br>
> To: '<a href="mailto:crash-utility@redhat.com" target="_blank">crash-utility@redhat.com</a>'<br>
> Subject: [Crash-utility] [PATCH] log: output logs of printk safe buffers<br>
> <br>
> We sometimes overlook logs written to printk safe buffers<br>
> (safe_print_seq/nmi_print_seq) which have not been flushed yet.<br>
> <br>
> This patch will output unflushed logs of the safe buffers<br>
> at the bottom of log command output as follows:<br>
> <br>
> [nmi_print_seq] CPU: 0  BUFFER: ffff888063c18ac0  LEN: 28<br>
> nmi print seq test message<br>
> [safe_print_seq] CPU: 1  BUFFER: ffff888063d19ae0  LEN: 30<br>
> safe print seq test message<br>
<br>
Could you share how to test this patch?<br>
such as how to create a memory dump where some messages are left<br>
in each log buffers without being flushed.<br>
I guess it would be helpful for reviewers.<br>
<br>
> <br>
> Note that the safe buffer (struct printk_safe_seq_buf) was introduced<br>
> in kernel-4.11 and removed in kernel-5.15.<br>
<br>
Describing the exact commit hashs in the kernel git repo are helpful.<br>
<br>
> <br>
> Signed-off-by: Shogo Matsumoto <<a href="mailto:shogo.matsumoto@fujitsu.com" target="_blank">shogo.matsumoto@fujitsu.com</a>><br>
> ---<br>
>  defs.h   |  3 +++<br>
>  kernel.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++<br>
>  2 files changed, 61 insertions(+)<br>
> <br>
> diff --git a/defs.h b/defs.h<br>
> index 7e2a16e..3ee51e0 100644<br>
> --- a/defs.h<br>
> +++ b/defs.h<br>
> @@ -2146,6 +2146,8 @@ struct offset_table {                    /* stash of commonly-used offsets */<br>
>         long wait_queue_entry_private;<br>
>         long wait_queue_head_head;<br>
>         long wait_queue_entry_entry;<br>
> +       long printk_safe_seq_buf_len;<br>
> +       long printk_safe_seq_buf_buffer;<br>
>  };<br>
> <br>
>  struct size_table {         /* stash of commonly-used sizes */<br>
> @@ -2310,6 +2312,7 @@ struct size_table {         /* stash of commonly-used sizes */<br>
>         long prb_desc;<br>
>         long wait_queue_entry;<br>
>         long task_struct_state;<br>
> +       long printk_safe_seq_buf_buffer;<br>
>  };<br>
<br>
Could you add support for the new members to help -o?<br>
<br>
help -o dumps contents of offset_table, size_table and array_table:<br>
<br>
crash> help help<br>
<br>
NAME<br>
  help -get help<br>
...snip...<br>
    -n - dumpfile contents/statistics<br>
    -o - offset_table and size_table<br>
    -p - program_context<br>
    -r - dump registers from dumpfile header<br>
    -s - symbol table data<br>
    -t - task_table<br>
    -T - task_table plus context_array<br>
    -v - vm_table<br>
    -V - vm_table (verbose)<br>
    -x - text cache<br>
    -z - help options<br>
crash> help -o | tail<br>
              prio_array_queue: 0<br>
            height_to_maxindex: 0<br>
            height_to_maxnodes: 0<br>
                      pid_hash: 0<br>
               kmem_cache_node: 1024<br>
           kmem_cache_cpu_slab: 0<br>
           rt_prio_array_queue: 0<br>
              task_struct_rlim: 0<br>
            signal_struct_rlim: 0<br>
                  vm_numa_stat: 0<br>
<br>
<br>
> <br>
>  struct array_table {<br>
> diff --git a/kernel.c b/kernel.c<br>
> index f4598ea..cc97176 100644<br>
> --- a/kernel.c<br>
> +++ b/kernel.c<br>
> @@ -93,6 +93,7 @@ static void source_tree_init(void);<br>
>  static ulong dump_audit_skb_queue(ulong);<br>
>  static ulong __dump_audit(char *);<br>
>  static void dump_audit(void);<br>
> +static void dump_printk_safe_seq_buf(void);<br>
>  static char *vmcoreinfo_read_string(const char *);<br>
>  static void check_vmcoreinfo(void);<br>
>  static int is_pvops_xen(void);<br>
> @@ -5048,6 +5049,7 @@ cmd_log(void)<br>
>         }<br>
> <br>
>         dump_log(msg_flags);<br>
> +       dump_printk_safe_seq_buf();<br>
>  }<br>
> <br>
> <br>
> @@ -11534,6 +11536,62 @@ dump_audit(void)<br>
>                 error(INFO, "kernel audit log is empty\n");<br>
>  }<br>
> <br>
> +static void<br>
> +__dump_printk_safe_seq_buf(char *buf_name)<br>
> +{<br>
> +       int cpu, buffer_size;<br>
> +       char *buffer;<br>
> +<br>
> +       if (!symbol_exists(buf_name)) {<br>
> +               return;<br>
> +       }<br>
> +<br>
> +       buffer_size = SIZE(printk_safe_seq_buf_buffer);<br>
> +       buffer = GETBUF(buffer_size);<br>
> +       for (cpu = 0; cpu < kt->cpus; cpu++) {<br>
> +               ulong len_addr, buffer_addr;<br>
> +               int len;<br>
> +<br>
> +               len_addr = symbol_value(buf_name) + kt->__per_cpu_offset[cpu] + OFFSET(printk_safe_seq_buf_len);<br>
> +               buffer_addr = symbol_value(buf_name) + kt->__per_cpu_offset[cpu] + OFFSET(printk_safe_seq_buf_buffer);<br>
> +               readmem(len_addr, KVADDR, &len, STRUCT_SIZE("atomic_t"), "printk_safe_seq_buf len", FAULT_ON_ERROR);<br>
> +               readmem(buffer_addr, KVADDR, buffer, buffer_size, "printk_safe_seq_buf buffer", FAULT_ON_ERROR);<br>
> +<br>
> +               if (len > 0) {<br>
> +                       int i, n;<br>
> +                       char *p;<br>
> +                       fprintf(fp, "[%s] CPU: %d  BUFFER: %lx  LEN: %d\n", buf_name, cpu, buffer_addr, len);<br>
> +                       n = (len <= buffer_size) ? len : buffer_size;<br>
> +                       for (i = 0, p = buffer; i < n; i++, p++) {<br>
> +                               if (*p == 0x1) { //SOH<br>
> +                                       i++; p++;<br>
> +                                       continue;<br>
> +                               } else {<br>
> +                                       fputc(ascii(*p) ? *p : '.', fp);<br>
> +                               }<br>
> +                       }<br>
> +                       fputc('\n', fp);<br>
> +               }<br>
> +       }<br>
> +       FREEBUF(buffer);<br>
> +}<br>
> +<br>
> +static void<br>
> +dump_printk_safe_seq_buf(void)<br>
> +{<br>
> +       if (!STRUCT_EXISTS("printk_safe_seq_buf"))<br>
> +               return;<br>
> +<br>
> +       if (INVALID_SIZE(printk_safe_seq_buf_buffer)) {<br>
> +               MEMBER_OFFSET_INIT(printk_safe_seq_buf_len, "printk_safe_seq_buf", "len");<br>
> +               MEMBER_OFFSET_INIT(printk_safe_seq_buf_buffer, "printk_safe_seq_buf", "buffer");<br>
> +               MEMBER_SIZE_INIT(printk_safe_seq_buf_buffer, "printk_safe_seq_buf", "buffer");<br>
> +       }<br>
> +<br>
> +       __dump_printk_safe_seq_buf("nmi_print_seq");<br>
> +       __dump_printk_safe_seq_buf("safe_print_seq");<br>
> +}<br>
> +<br>
>  /*<br>
>   * Reads a string value from the VMCOREINFO data stored in (live) memory.<br>
>   *<br>
<br>
<br>
<br>
<br>
<br>
------------------------------<br>
<br>
--<br>
Crash-utility mailing list<br>
<a href="mailto:Crash-utility@redhat.com" target="_blank">Crash-utility@redhat.com</a><br>
<a href="https://listman.redhat.com/mailman/listinfo/crash-utility" rel="noreferrer" target="_blank">https://listman.redhat.com/mailman/listinfo/crash-utility</a><br>
<br>
End of Crash-utility Digest, Vol 195, Issue 24<br>
**********************************************<br>
<br>
</blockquote></div></div></div>